Skip to content
Simon Redfern edited this page Dec 7, 2015 · 6 revisions

Motivation

There might be the time when a Docker image with the latest code changes is not available or you need to check out a different branch of an OBP service. This page will explain how you can accomplish that.

Enter the container

You need the container id, e.g. by checking ps

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                              NAMES
5daeadd895cd        dde5c1d02fee        "/bin/sh -c /usr/loca"   About an hour ago   Up About an hou 0.0.0.0:8080-8082->8080-8082/tcp   fervent_heisenberg

In this case, it will be 5daeadd895cd.

Then enter the container like this:

$ docker exec -it 5daeadd895cd /bin/bash

The options to exec mean: interactive and allocate pseudo-tty, so input and output will work properly. The result should look like:

root@5daeadd895cd:/#

Switch branch

Now change to the directory of the OBP service you want to switch the branch to:

root@5daeadd895cd:/# cd /opt/OBP/Social-Finance

Next you switch the branch and pull the latest code

root@5daeadd895cd:/opt/OBP/Social-Finance# git checkout 2015-11-design && git pull

Although things might already work now, it's probably safer to clean the code base and (re)compile afterwards:

root@5daeadd895cd:/opt/OBP/Social-Finance# ./mvn.sh clean && ./mvn.sh compile

This might take a while, depending on your machine.

Restart the service - maybe

Usually jetty realises the code change and restarts automatically. If it doesn't, you can tell supervisor manually to restart the service.

root@5daeadd895cd:/opt/OBP/Social-Finance# supervisorctl restart Social-Finance 

Finally point your browser at the service, e.g. http://localhost:8081/ .

Troubleshooting

If things don't work, the supervisor log files in /var/log/supervisor might help, e.g.

root@5daeadd895cd:/# tail -f /var/log/supervisor/Social-Finance-stdout.log

Note that less or sophisticated text editors are not installed in the container. You can install them by running:

root@5daeadd895cd:/# apt-get install less vim
Clone this wiki locally