Gitlab Logo Website
Pankaj Patel via Unsplash
Home / Gitlab Upgrade Approach in Docker Compose (sameersbn)
Self Hosting

Gitlab Upgrade Approach in Docker Compose (sameersbn)

Upgrading my Gitlab instance was long overdue. Since I had to upgrade over 2 major versions, I decided to share my upgrade approach and implementation plan in this post. There are some special commands involved in sameersbn/docker-gitlab.

Gitlab Upgrade Approach

Creating Backups

Documentation


Advertisement Begins

Advertisement End


Make sure you configure GITLAB_BACKUP_DIR external to your container and set up something like AWS S3 storage backups in addition to local harddrive backup. Your data is almost guaranteed to be safe of AWS S3, however the reason I recommend two modes of backup is in case one method fails (e.g. no internet connection or AWS credential expiry.) You will be very happy to realize that a local filesystem backup is still available.

Backup script

docker exec -it gitlab_gitlab_1 /bin/sh
# /sbin/entrypoint.sh app:rake gitlab:backup:create

Upgrade Procedure


Affiliate Content Start

Affiliate Content End


Documentation


Advertisement Begins

Advertisement End


docker-compose down

echo "Upgrade postgres, redis versions" 


docker-compose up

echo "Confirm new version of postgres and redis are  running using docker ps"

docker-compose down




docker-compose stop gitlab
docker-compose rm gitlab

echo "Change version from x to 11.11.0 in your docker-compose.yml file - required migration path before going to 12.2.5"

docker-compose up 

echo "confirm usng gitlab admin login that new version is installed."


docker-compose down

echo "Change version to 12.2.5 in docker-compose.yml"

Docker-compose stop gitlab
Docker-compose rm gitlab
Docker-compose up -d

docker-compose logs -tf

Setting up a DEV environment to practice the whole change implementation

Use this to setup a (local) dev environment, load in your data from backup and practise the whole change implementation before doing in Production. Any issues you find can be adopted into the change implementation plan.


Kitchen Multi-Timer Pro

Now you’re cooking

Multi Timer Pro is your ultimate meal prep companion, keeping track of multiple cooking times and making adjustments on the fly. Give it a try today and become a better home cook!

Get it on Google Play


Create dev environment

Docker-compose down -v
Docker-compose up -d
Docker-compose logs -tf

docker exec -it gitlab_gitlab_1 /bin/sh


#  /sbin/entrypoint.sh app:rake db:setup

#  /sbin/entrypoint.sh app:rake gitlab:backup:restore BACKUP=1568373821

    Yes
    Yes

# exit

docker-compose restart

Conclusion

Let me know in the comments any issues you came across or clarifications you need. In another post I explain how to deploy Gitlab behind Traefik reverse proxy.

Continue your adventure here

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

DON’T MISS OUT!
Subscribe To Newsletter
Be the first to get latest updates and exclusive content straight to your email inbox.
Stay Updated
Give it a try, you can unsubscribe anytime.
close-link