Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haiduc2005 ex188 #367

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
88ace0f
Update README.md
haiduc2005 Sep 19, 2023
c5159f0
Update README.md
haiduc2005 Sep 19, 2023
018173b
Update README.md
haiduc2005 Sep 19, 2023
b4ec34d
Update README.md
haiduc2005 Sep 19, 2023
f995c70
Update README.md
haiduc2005 Sep 19, 2023
779ba13
Update README.md
haiduc2005 Sep 19, 2023
6e2f0d2
Update README.md
haiduc2005 Sep 19, 2023
4ff9fbf
Update README.md
haiduc2005 Sep 19, 2023
0b35226
Update README.md
haiduc2005 Sep 19, 2023
01eb758
Create test.md
haiduc2005 Sep 20, 2023
f8fd25d
Update test.md
haiduc2005 Sep 20, 2023
63ce6d5
Update test.md
haiduc2005 Sep 20, 2023
f1fb2fa
Update test.md
haiduc2005 Sep 20, 2023
cf6ed2c
Update test.md
haiduc2005 Sep 20, 2023
f8e6dfe
Update test.md
haiduc2005 Sep 20, 2023
9410873
Update test.md
haiduc2005 Sep 20, 2023
9cd0f99
Update test.md
haiduc2005 Sep 20, 2023
143bb58
Update test.md
haiduc2005 Sep 20, 2023
90b6b65
Update test.md
haiduc2005 Sep 20, 2023
711e4e3
Update test.md
haiduc2005 Sep 21, 2023
6e8e48d
Update test.md
haiduc2005 Sep 21, 2023
b86f718
Update test.md
haiduc2005 Sep 21, 2023
4af4558
Update test.md
haiduc2005 Sep 21, 2023
1465a1c
Update test.md
haiduc2005 Sep 21, 2023
fc57d1b
Update test.md
haiduc2005 Sep 21, 2023
76d0da2
Update README.md
haiduc2005 Sep 21, 2023
aa2b098
Update README.md
haiduc2005 Sep 21, 2023
56bfcd6
Update test.md
haiduc2005 Sep 21, 2023
96d1d43
Update README.md
haiduc2005 Sep 21, 2023
ab23dd3
Update README.md
haiduc2005 Sep 21, 2023
27ef5ad
Update README.md
haiduc2005 Sep 21, 2023
98d0405
Update README.md
haiduc2005 Sep 21, 2023
0b24f8c
Update README.md
haiduc2005 Sep 21, 2023
4fc1cd5
Update README.md
haiduc2005 Nov 26, 2023
fb1ff26
Create Dockerfile.md
haiduc2005 Nov 26, 2023
387f979
Update Dockerfile.md
haiduc2005 Nov 26, 2023
9785808
Update Dockerfile.md
haiduc2005 Nov 26, 2023
c8a19e5
Update test.md
haiduc2005 Nov 26, 2023
76a9141
Update Dockerfile.md
haiduc2005 Nov 26, 2023
928715d
Rename test.md to EXAM.md
haiduc2005 Dec 7, 2023
d2b3cd3
Creating_Accessing-Containers_Networking
haiduc2005 Dec 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Creating_Accessing-Containers_Networking
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Lab 1 -- Creating Containers
podman pull registry.access.redhat.com/ubi8/ubi-minimal:8.8
podman images
podman run registry.access.redhat.com/ubi8/ubi-minimal:8.8 echo 'Hello Red Hat'
podman ps
podman run -e GREET=Hello -e NAME='Red Hat' registry.access.redhat.com/ubi8/ubi-minimal:8.8 printenv GREET NAME
podman run -d -p 8080:8080 registry.access.redhat.com/ubi8/httpd-24
podman stop (id)
podman ps -a
podman rm (id)
podman rmi (id)

Lab 2 -- Container Networking
podman network inspect podman
podman network create cities
podman network inspect cities
podman run --name times-app --network cities -p 8080:8080 -d docker.io/tsrana1/podman-info-times:v0.1
podman inspect times-app -f '{{.NetworkSettings.Networks.cities.IPAddress}}'
podman run --rm --network cities registry.access.redhat.com/ubi8/ubi-minimal:8.5 curl -s http://IP_ADDRESS:8080/times/BKK
podman run --rm --network cities registry.access.redhat.com/ubi8/ubi-minimal:8.5 curl -s http://times-app:8080/times/BKK
podman run --name cities-app --network cities -p 8090:8090 -d -e TIMES_APP_URL=http://times-app:8080/times docker.io/tsrana1/podman-info-cities:v0.1
curl http://localhost:8090/cities/MAD
curl http://localhost:8090/cities/SAN

Lab 3 -- Accessing Containers
podman run --name nginx -d -p 8080:8080 docker.io/tsrana1/podman-nginx-helloworld
podman cp nginx:/var/log/nginx/error.log error.log
podman exec nginx ls /usr/share/nginx/html/public
podman cp nginx:/etc/nginx/nginx.conf nginx.conf
podman exec -it nginx bash
vim /etc/nginx/nginx.conf
podman exec nginx nginx -s reload
49 changes: 49 additions & 0 deletions Dockerfile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
```
# dockerfile to build image for JBoss EAP 6.4

# start from rhel 7.2
FROM ubi8

# file author / maintainer
MAINTAINER "FirstName LastName" "emailaddress@gmail.com"

# update OS
RUN yum -y update && \
yum -y install sudo openssh-clients unzip java-1.8.0-openjdk-devel && \
yum clean all

# enabling sudo group
# enabling sudo over ssh
RUN echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \
sed -i 's/.*requiretty$/Defaults !requiretty/' /etc/sudoers

# add a user for the application, with sudo permissions
RUN useradd -m jboss ; echo jboss: | chpasswd ; usermod -a -G wheel jboss

# create workdir
RUN mkdir -p /opt/jboss

WORKDIR /opt/jboss

# install JBoss EAP 6.4.0
ADD jboss-eap-6.4.0.zip /opt/jboss/jboss-eap-6.4.0.zip
RUN unzip /opt/jboss/jboss-eap-6.4.0.zip
# set environment
ENV JBOSS_HOME /opt/jboss/jboss-eap-6.4
# create JBoss console user
RUN $JBOSS_HOME/bin/add-user.sh admin admin@2016 --silent
# configure JBoss
RUN echo "JAVA_OPTS=\"\$JAVA_OPTS -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0\"" >> $JBOSS_HOME/bin/standalone.conf

# set permission folder
RUN chown -R jboss:jboss /opt/jboss

# JBoss ports
EXPOSE 8080 9990 9999
# start JBoss
ENTRYPOINT $JBOSS_HOME/bin/standalone.sh-c standalone-full-ha.xml
USER jboss

CMD /bin/bash

```
80 changes: 80 additions & 0 deletions EXAM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
1

Edit the Docker file in path /home/openshift ex180 practice/EX180 as instructed below and build an image with name iboss-eap
Copy the file /home/openshift_ex180 _ practice/jboss-eap-6.4.0 .zip from host to container image path /opt/jboss/. Unzip the copied file.

Set ENV for BOSS HOME to /opt/jboss/jboss-eap-6.4
Create EAP user using $JBOSS_HOME/bin/add-user.sh admin admin@2016 --silent
Expose ports 8080,9990 and 9999
Start JBOSS using $JBOSS_HOME/bin/standalone.sh-c standalone-full-ha.xml



2

RUN container and use the image jboss-eap build in previous section.
Expose ports 8080 ,9990 and 9999 of containers to local host ports 8080,9990 and 9999 respectively.
Set name of the container as "jboss-eap-app"



3

Get last 10 lines of logs for container jboss-eap-app
Stop the container boss-eap-app
Remove the container jboss-eap-app



4

Add a tag "6.4.v1" to the image jboss-eap (Build in Test 1)
Save the image with new tag to tar file jboss-eap.6.4.v1.tar
Push the image with new tag "6.4.v1 to docker registry


5


Run myg| container using Podman and image registry.access.redhat.com/rhscl/mysql-57-rhel7
Name of the container mydb
Expose container port 3306 to port 30306 on local h
Pass the container parameter values
MYSQL_ROOT_PASSWORD=password
MYSQL_USER=user1
MYSQL_PASSWORD=password
MYSQL_DATABASE=books

6

Create an mysql application as instructed below
Name of the app is mysql-app

Use image registry.access.redhat.com/rhscl/mysql-57-rhel7

Parameters to be
used MYSQL_USER=user MYSQL_PASSWORD=password MYSQL_DATABASE=books
All resources should have label "app=mydbapp"

7

Expose the service to url "mysaltestapptesturl.com"
Copy file mytestfile. txt from host to the mysql application path /tmp/
Check pod logs
Login into application and check the version of mysq|

8

Create mysql application as instructed below
Use mysql.son or mysql.yaml for application creation  
Variable to be set  
MYSQL_USER=user1 MYSQL_PASSWORD=password MYSQL_DATABASE=books  

9

Create Template from mysql. json or mysql. yaml file  
Create mysql application as instructed below  
• Use the template created  
• Variable to be set  
MYSQL_USER=user1 MYSQL_PASSWORD=password MYSQL_DATABASE=books  

47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
# DO180-apps
DO180 Repository for Sample Applications
DO180 Repository for Sample Applications

Dockerfile:
```
# install JBoss EAP 6.4.0
ADD jboss-eap-6.4.0.zip /opt/jboss/jboss-eap-6.4.0.zip
RUN unzip /opt/jboss/jboss-eap-6.4.0.zip
# set environment
ENV JBOSS_HOME /opt/jboss/jboss-eap-6.4
# create JBoss console user
RUN $JBOSS_HOME/bin/add-user.sh admin admin@2016 --silent
# configure JBoss
RUN echo "JAVA_OPTS=\"\$JAVA_OPTS -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0\"" >> $JBOSS_HOME/bin/standalone.conf

# set permission folder
RUN chown -R jboss:jboss /opt/jboss

# JBoss ports
EXPOSE 8080 9990 9999
# start JBoss
ENTRYPOINT $JBOSS_HOME/bin/standalone.sh -c standalone-full-ha.xml
```

sudo podman build -t jboss-eap .
sudo podman run -d --name jboss-eap-app -p 8080:8080 -p 9990:9990 -p 9999:9999 localhost/jboss-eap

sudo podman logs --tail=10 jboss-eap-app
sudo podman stop jboss-eap-app
sudo podman ps -a
sudo podman rm jboss-eap-app

sudo podman tag localhost/jboss-eap localhost/jboss-eap:6.4.v1
sudo podman save -o localhost/jboss-eap.6.4.v1.tar localhost/jboss-eap:6.4.v1
sudo podman images
sudo podman tag localhost/jboss-eap:6.4.v1 docker.io/haiduc2023/jboss-eap:6.4.v1
sudo podman push docker.io/haiduc2023/jboss-eap:6.4.v1

sudo podman run -d --name mydb -v /home/student/local/mysql:/var/lib/mysql/data -p 30306:3306 -e MYSQL_ROOT_PASSWORD=password -e MYSQL_USER=user1 -e MYSQL_PASSWORD=password -e MYSQL_DATABASE=books registry.access.redhat.com/rhscl/mysql-57-rhel7
gedit mysql.sh
```
#!/bin/bash

sudo podman run -d --pod mypod --name mydb2 -e MYSQL_ROOT_PASSWORD=password -e MYSQL_USER=user1 -e MYSQL_PASSWORD=password -e MYSQL_DATABASE=books registry.access.redhat.com/rhscl/mysql-57-rhel7
```