Skip to content

Instantly share code, notes, and snippets.

@knjname
Last active July 11, 2018 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knjname/22e1d0724cfa1a4a3550d1011865a80e to your computer and use it in GitHub Desktop.
Save knjname/22e1d0724cfa1a4a3550d1011865a80e to your computer and use it in GitHub Desktop.
Upgrading script of sameersbn/gitlab.
#!/bin/bash
# Usage:
# $ FROM_VERSION=10.8.3-1 TO_VERSION=11.0.0 bash upgrade-gitlab.sh
#
# Assuming that you have `sameersbn/gitlab:version_string` entry in docker-compose.yml.
# See https://github.com/sameersbn/docker-gitlab
: ${FROM_VERSION:?}
: ${TO_VERSION:?}
set -xe
if ! grep "sameersbn/gitlab:${FROM_VERSION}" docker-compose.yml ; then
echo "sameersbn/gitlab:${FROM_VERSION} is not found in docker-compose.yml. Error!"
exit 1
fi
echo "Take the TO_VERSION image."
docker pull "sameersbn/gitlab:${TO_VERSION}"
echo "Take a backup."
docker-compose exec gitlab /sbin/entrypoint.sh app:rake gitlab:backup:create
docker-compose stop gitlab
docker-compose rm -f gitlab
# docker-compose exec gitlab app:rake gitlab:backup:create
echo "Substitute sameersbn/gitlab:${FROM_VERSION} to sameersbn/gitlab:${TO_VERSION} in docker-compose.yml"
sed -i -s "s|sameersbn/gitlab:${FROM_VERSION}|sameersbn/gitlab:${TO_VERSION}|" docker-compose.yml
echo "Up the gitlab."
docker-compose up -d gitlab
## When you have some reverse-proxy.
# echo "Restart the Nginx."
# docker-compose restart nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment