This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.

Build Nice Docker Image

Build Docker Image

  1. Change working directory

    cd ${ROOT_DIR_OF_NICE2_REPOSITORY}
  2. Build a specific customer:

    ./gradlew clean customer:${CUSTOMER_NAME}:build -P productionMode=true -x test

    Note

    See Production when doing production builds.

  3. Building the Docker image

    cd customer/${CUSTOMER_NAME}
    docker build -t nice .

    The resulting image is called nice.

Deploy Docker Image

  1. Login

    oc whoami -t | docker login registry.apps.openshift.tocco.ch -u any --password-stdin
    
  2. 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}
    
  3. 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.

  1. Login

    oc whoami -t | docker login registry.apps.openshift.tocco.ch -u any --password-stdin
    
  2. 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

    Hint

    An oc describe on RCs and pods will also reveal the used images.

    Nginx image can be found in the project shared-imagestreams.

  3. Pull image

    docker pull registry.apps.openshift.tocco.ch/nice-stn/nice:latest

Start Nice2

Start Nice2:

docker run --rm --network=host ${DOCKER_IMAGE_TAG} run

This will start Nice2 with the default options.

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 --network=host --env-file ${OPTIONS_FILE} ${DOCKER_IMAGE_TAG} run

Minimal ${OPTIONS_FILE} example:

# DB settings
hibernate.main.serverName=localhost
hibernate.main.user=USER
hibernate.main.password=PASSWORD
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 --network=host ${DOCKER_IMAGE_TAG} dbref

Configuration can be changes as described in Start Nice2.