Files
wiki/Upgrade_Gitea.md

1.9 KiB

title, description, published, date, tags, editor, dateCreated
title description published date tags editor dateCreated
Upgrading Gitea true 2022-04-30T20:10:44.240Z git, backup, docker, linux, restore, upgrade markdown 2022-01-31T18:03:38.387Z

Upgrading Gitea can involve migrating the Postgresql settings, which must be done carefully. It consists of two phases - the export, which is done via the Gitea server, and the import - which is done partly through the server and partly through the database.

Export

Gitea has a built in dump utility - executing the following will dump a .zip file into your current directory:

docker exec -u git -w /data $(docker ps -qf "name=gitea_server") sh -c '/app/gitea/gitea dump -c /data/gitea/conf/app.ini'

This will generate a zipped dump file:

Takahe:/Red-Vol/Media/Containers/gitea # ll /Red-Vol/Media/Containers/gitea/*.zip
-rw------- 1 shmick 1000 355487720 Jan 31 20:01 /Red-Vol/Media/Containers/gitea/gitea-dump-1643652088.zip

Now, this zip will consist of the server directories, and a .sql dump to restore to the database.

Import

Server

The dump is simply the contents of the /data directory, wherever it is mapped.

Simply move it where it should be and chown it to your user:

Takahe:/Red-Vol/Media/Containers/gitea # chown -R shmick data/

Database

Inside the dumped archive you will find an SQL file:

Takahe:/Red-Vol/Media/Containers/gitea/postgresql # ll *.sql
-rw------- 1 70 root 775806 Jan 31 20:01 gitea-db.sql

In order to restore it, you must first bring up the database on the new container after updating the image. Then, move it to the database's mapped directory on the host.

Then, exec into the container: docker exec -ti gitea_db /bin/bash

Finally, restore using the psql command: psql -U $USER -d $DATABASE < gitea-db.sql

Finally, exit the container, bring the stack down with docker-compose down and recreate with docker-compose up -d.

Enjoy your new blazing fast Gitea!