Skip to main content

Gitea Updates: quick'n'dirty

·232 words·2 mins·

Okay, let’s get right into it.

The gitea stuff is located at /var/lib/gitea.

The gitea config file is located at /etc/gitea/app.ini.

The gitea.service file is located at /etc/systemd/system/gitea.service and contains:

[Unit]
Description=Gitea
After=syslog.target
After=network.target
After=mysql.service

[Service]
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/var/lib/gitea/gitea web -c /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/var/lib/gitea/data/home GITEA_WORK_DIR=/var/lib/gitea

[Install]
WantedBy=multi-user.target

Check the Changelog for breaking changes.

Create a backup first (or after renamed the executable file gitea to gitea.back):

# sudo -u git ./gitea.back dump -c /etc/gitea/app.ini

That creates a file

# ll gitea-dump*
.rw-------. git  git  835 MB Sun Mar 12 07:32:49 2023  gitea-dump-1678602739.zip

Just for the record: I’ll include a recovery routine here, which is basically unzipping the dump file from above and moving the contained files to the right directory.

# unzip gitea-dump-1610949662.zip
# cd gitea-dump-1610949662
# mv data/conf/app.ini /etc/gitea/app.ini
# mv data/* /var/lib/gitea/data/
# mv log/* /var/lib/gitea/log/
# mv repos/* /var/lib/gitea/repositories/
# chown -R gitea:gitea /etc/gitea/conf/app.ini /var/lib/gitea

# mysql --default-character-set=utf8mb4 -u$USER -p$PASS $DATABASE <gitea-db.sql

# systemctl restart gitea

Have a look at https://docs.gitea.io/en-us/backup-and-restore/#restore-command-restore for a full and/or actual version of the recovery process.

Download the new binary file from https://dl.gitea.com/gitea/.

I usually download to my root’s home folder.

# wget https://dl.gitea.com/gitea/1.18.5/gitea-1.18.5-linux-amd64
# cd /var/lib/gitea
# cp gitea gitea.back
# mv ~/gitea-1.18.5-linux-amd64 gitea
# systemctl restart gitea

That’s it. I won’t need this again but I like to keep this information somewhere I can find it ;-)