Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading Docker container from version below 2.5 to 2.5+ #41

Closed
GuilhemSempere opened this issue Feb 24, 2022 · 0 comments
Closed

Upgrading Docker container from version below 2.5 to 2.5+ #41

GuilhemSempere opened this issue Feb 24, 2022 · 0 comments

Comments

@GuilhemSempere
Copy link
Collaborator

Gigwa container versions below 2.5 unfortunately had a bug regarding persistence of settings defined in config.properties. For persistence to work across container restarts, the real file has to be in a volume and the one in WEB-INF/classes has to be a symlink to the real file (this is how it works for other similar files). This will be fixed from v2.5, but upgrading will require to launch the script below while the old container is running:

#!/bin/bash

# This script must be executed on the Docker host while Gigwa container version below 2.5 is running, before upgrading to 2.5+. Its purpose is to move config.properties to a persistent volume $
# If you omitted to execute this script and upgraded to v2.5+, the web-application will fail starting. Just switch back to your previous container version, and you will still be able to execut$

containerId=$(docker ps -a | grep "guilhemsempere/gigwa:" | tr -s ' ' | cut -d ' ' -f1)
if [[ "$containerId" == "" ]]; then
        echo Gigwa container version BELOW 2.5 must running to apply this fix
        exit 1
fi

imageId=$(docker ps -a | grep "guilhemsempere/gigwa:" | tr -s ' ' | cut -d ' ' -f2)
result=$(docker exec -it ${containerId} bash -c "if [[ ! -L 'webapps/gigwa/WEB-INF/classes/config.properties' ]]; then mv webapps/gigwa/WEB-INF/classes/config.properties /usr/local/tomcat/config/config.properties && ln -s /usr/local/tomcat/config/config.properties webapps/gigwa/WEB-INF/classes/config.properties && echo 'Fix applied successfully: config.properties now in a volume'; else echo 'Nothing to do: config.properties was already in a volume'; fi")

echo $result

if [[ "$result" == *"successfully"* ]]; then
        docker commit ${containerId} ${imageId} >/dev/null
        echo Changes committed to current image ${imageId}, which should appear below as recently created. Upgrading to v2.5+ should be smooth...
        docker image ls | head -2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant