Skip to content

Commit 9e481a5

Browse files
committed
OCP-DEMO Add docker layer with Infinispan server task
1 parent 8cf563d commit 9e481a5

File tree

5 files changed

+53
-3
lines changed

5 files changed

+53
-3
lines changed

openshift/message-board/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ script/nocontent
4242
script/account-service
4343
script/message-service
4444
script/message-board-web
45+
script/CUSTOM_INFINISPAN_IMAGE
4546
!*sh

openshift/message-board/README.asciidoc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ Made with Hibernate ORM, Hibernate OGM and Infinispan for OpenShift Container Pl
1616
mvn clean install
1717
----
1818

19+
## Deploy Infinispan custom Docker image
20+
----
21+
cd script
22+
sh ./add-custom-infinispan-image.sh
23+
----
24+
1925
## Install demo
2026
----
2127
cd script
2228

23-
oc login -u [YOUR-USER-NAME]
24-
oc new-project [YOUR-PROJECT-NAME]
29+
( oc login -u [YOUR-USER-NAME] ) <<optional>>
30+
( oc new-project [YOUR-PROJECT-NAME] ) <<optional>>
2531

2632
sh ./install-all.sh
2733
----
@@ -38,6 +44,12 @@ cd script
3844
sh ./binary-build-message.sh
3945
----
4046

47+
## Update Web App
48+
----
49+
cd script
50+
sh ./binary-build-web.sh
51+
----
52+
4153
## Test
4254

4355
### Web [FORM]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM jboss/infinispan-server:9.3.0.Final
2+
3+
# add Docker layer with the server task
4+
COPY ./target/message-server-task.jar /opt/jboss/infinispan-server/standalone/deployments

openshift/message-board/script/install-all.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
set -x
23
set -e
34

45
# Copy bundles for the binary builds
@@ -10,7 +11,8 @@ oc create -f ../template/infinispan-persistent.json
1011
oc import-image openshift/wildfly-130-centos7 --confirm
1112

1213
# Install Infinispan Server
13-
oc new-app --template=infinispan-persistent
14+
CUSTOM_INFINISPAN_IMAGE=`cat CUSTOM_INFINISPAN_IMAGE`
15+
oc new-app --template=infinispan-persistent -p IMAGE="$CUSTOM_INFINISPAN_IMAGE"
1416
oc delete route infinispan-persistent-app-management
1517

1618
# Install MySql Server
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Creates custom Infinispan image and deploy it to OpenShift docker registry,
2+
# this code is inspired by the project https://github.com/jboss-dockerfiles/infinispan
3+
4+
#!/usr/bin/env bash
5+
set -x
6+
set -e
7+
8+
# add developer the ability to push a image
9+
oc login -u system:admin
10+
oc adm policy add-role-to-user system:registry developer
11+
oc adm policy add-role-to-user admin developer -n myproject
12+
oc adm policy add-role-to-user system:image-builder developer
13+
14+
# take OpenShift Docker registry IP
15+
oc project default
16+
REGISTRY_IP=`oc get svc/docker-registry -o yaml | grep clusterIP: | awk '{print $2}'`
17+
18+
# build image
19+
IMAGE="${REGISTRY_IP}:5000/myproject/infinispan-with-board-task"
20+
docker build --no-cache --force-rm -t $IMAGE ../extra/message-server-task
21+
22+
# push the image from local Docker repo to the OCP Docker repo
23+
# we need a regular user to login to the OpenShift Docker registry
24+
oc login -u developer -p developer
25+
docker login -u $(oc whoami) -p $(oc whoami -t) ${REGISTRY_IP}:5000
26+
docker push ${IMAGE}
27+
28+
# store the image reference to file
29+
# it will be used by the install-all script
30+
rm ./CUSTOM_INFINISPAN_IMAGE
31+
echo "$IMAGE" >> CUSTOM_INFINISPAN_IMAGE

0 commit comments

Comments
 (0)