Upgrade Gitea Docker Compose

Been using Gitea for about a week under docker and so far so good. One thing which wasn’t clear to me was how best to upgrade to a new tag. I understand this will vary depending on how Gitea is installed but it would be nice to see at least some basic advice either in the documentation or on the image README itself.

Here’s what I did to upgrade to the latest version, which probably wasn’t the best approach given it caused a few seconds of downtime:

docker-compose pull gitea
docker-compose down gitea
docker-compose rm gitea
docker-compose up -d gitea

Is there a preferred way to manage upgrades while minimizing (or, better yet, eliminating) downtime during the upgrade process when using docker-compose? For example, would it be wise (or even safe) to scale up a second gitea instance under a different docker process name to handle requests while performing the above tasks?

Given there could be cronjobs running when the container goes down or a write operation in progress it seems providing some guidance here and/or in the docs would be useful for mitigating future support requests.

The use of tags, rather than :latest tag should be mentioned when creating a docker-compose file. Also the mention of backups should be included.

1 Like

Thanks for the reply. I usually like to tag a version in my compose files (e.g. :1.5) for deterministic builds but given the rapid development going on I’ve kept the latest tag as you’ve mentioned.

The one gotcha I ran into which caused me to run the above process seems more to do with heavy caching in Docker than anything and a few seconds of downtime is okay for me right now as I can throw up a maintenance page.

Any other tips on achieving zero downtime deployments are appreciated. Running a distributed DB like Maria with Galera comes to mind and possibly just scaling up multiple Gitea instances in a Swarm behind a load balancer should do the trick. We’ll see.

Loving the product!! Arc Green rules.

I’ve opened an issue here to further explore the potential for zero-downtime upgrades using Docker Compose. Solving it is not a priority for me right now though any contributions here or in the linked issue are appreciated.

As suggested by @techknowlogick I’m including backup procedures for Docker which I dropped into a separate discussion topic:

Also, be sure to explicitly set the tag version (e.g. 1.5.2) in your docker-compose.yml file. If you’re having any difficulty pulling a specific image version using Compose try instead docker pull gitea/gitea:1.5.2 where 1.5.2 is the tagged version desired (see Docker Hub for available tags).

Last thing worth noting. If you run into any issues use docker ps to ensure you’re not running two instances of gitea on different versions and if docker down <service> isn’t working you may use docker stop <service> instead.