This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.
Build Nice Docker Image¶
Note
For Nice older than 3.0, see Nice2 and Docker (Nice <v3.0).
Build Docker Image¶
Change working directory
cd ${ROOT_DIR_OF_NICE2_REPOSITORY}
Build a specific customer:
./gradlew clean customer:${CUSTOMER_NAME}:build -P productionMode=true -x test
Note
See Production when doing production builds.
Building the Docker image
cd customer/${CUSTOMER_NAME} docker build -t nice .
The resulting image is called nice.
Deploy Docker Image¶
Login
oc whoami -t | docker login registry.apps.openshift.tocco.ch -u any --password-stdin
Tag image
This additionally tags the image named nice with the name registry.apps.openshift.tocco.ch/…. nice is the name of the image if you followed the instructions above.
docker tag nice registry.apps.openshift.tocco.ch/nice-${INSTALLATION}/nice
Tip
You can also directly build an image with the appropriate name:
docker build -t ${TAG_NAME}
Deploy image
docker push registry.apps.openshift.tocco.ch/nice-${INSTALLATION}/nice
Deployment is automatically triggered once image has been pushed.
Pull a Docker Image from VSHN’s Registry¶
This is useful when you want to copy a Docker image from production for local debugging.
Login
oc whoami -t | docker login registry.apps.openshift.tocco.ch -u any --password-stdin
Find Image
oc project nice-${INSTALLATION_NAME} oc get is NAME DOCKER REPO TAGS UPDATED nice 172.30.1.1:5000/nice-stn/nice latest 2 weeks ago
Pull image
docker pull registry.apps.openshift.tocco.ch/nice-stn/nice:latest
Start Nice2¶
Start Nice2:
docker run --rm -p 8080:8080 ${DOCKER_IMAGE_TAG} run
This will start Nice2 with the default options. That is, it will try to use the customer’s dev DB on postgres.tocco.ch.
Should you require to set any additional options, like a custom DB server, create a ${OPTIONS_FILE} and tell docker about it:
docker run --rm -p 8080:8080 --env-file ${OPTIONS_FILE} ${DOCKER_IMAGE_TAG} run
Minimal ${OPTIONS_FILE} example:
# DB settings
hibernate.main.serverName=postgres.tocco.ch
hibernate.main.user=nice_master
hibernate.main.password=<secret>
hibernate.main.databaseName=nice_master
Tip
You can obtain the settings used for an installation on OpenShift like so:
oc project nice-${INSTALLATION_NAME} oc set env -c nice dc/nice --list
The output can be used, verbatim, in ${OPTIONS_FILE}.
Schema Upgrade¶
Run schema upgrade:
docker run --rm -p 8080:8080 ${DOCKER_IMAGE_TAG} dbref
Configuration can be changes as described in Start Nice2.