Published: Friday, Dec 5, 2014 Last modified: Monday, Dec 9, 2024
I setup Greptweet a few months ago on a DO “Droplet” aka VPS in London running CoreOS stable.
Over that period of time, there was at least one PHP update (as per bloody usual) and a cache bugfix (backstory) I need to rollout.
How do I test the fix?
This fix was to do with the nginx.conf, not the actual code, so it was easy to build the docker image locally, e.g. sudo docker build -t g5 .
& sudo docker run -v /srv/www/greptweet.com:/srv/http/u -p 80:80 -ti g5
NEED A SOLUTION: What I found difficult to do however, is test any local code changes, like a Bootstrap update. Since the Dockerfile checks the source code out from git, but I need to test my working changes.
UPDATE: Neerav Kumar from DockerSG suggested I use ADD instead of git clone in my Dockerfile.
How did I deploy the fix
On my CoreOS droplet, I built a new image (from scratch) with docker build --no-cache -t greptweet .
from a git checkout. I wasn’t too sure what was
going to happen, since there was already an image called “greptweet” there and
in fact running. The new build seemed to simply replace that currently running
build and all I then needed to do was sudo systemctl restart greptweet.service
for the systemd service
file to
serve it.
NEED A SOLUTION: Er, so what happened to the old build of Greptweet? Seems to
have disappeared by the build that replaced it. What happens if I want to
downgrade, just git checkout oldversion
and Docker build from there??
UPDATE: People suggested tags and updating the service file but I think git checking out and older version is a better approach for me.
Gotchas
WTH: Initially I built like so docker build -t greptweet .
and noticed no
changes on restart and an old version number on the
app. It seems that Docker caching can’t seem to tell
when a step is actually likely to change (new changes in git) and invalidate
it.
UPDATE: I’m told Docker can sense changes with ADD but not the RUN. So hopefully the change will make the builds better.
Had some issues with nginx configuration syntax error, independent of Docker.