|
|
|
+++
|
|
|
|
title = '''Gitea Updates: quick'n'dirty'''
|
|
|
|
aliases = '/posts/2023-04-09-gitea-updates'
|
|
|
|
summary = 'After a lot of lookups, a quick reminder in copy&paste mode for me.'
|
|
|
|
date = '2023-04-09T17:07:01+0200'
|
|
|
|
categories = [ 'computerstuff' ]
|
|
|
|
tags = [ 'server', 'linux', 'git', 'selfhost' ]
|
|
|
|
|
|
|
|
+++
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
```ini
|
|
|
|
[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](https://blog.gitea.io/) for breaking changes.
|
|
|
|
|
|
|
|
Create a backup first (or after renamed the executable file `gitea` to
|
|
|
|
`gitea.back`):
|
|
|
|
|
|
|
|
```console
|
|
|
|
# sudo -u git ./gitea.back dump -c /etc/gitea/app.ini
|
|
|
|
```
|
|
|
|
|
|
|
|
That creates a file
|
|
|
|
|
|
|
|
```console
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
```console
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
```console
|
|
|
|
# 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 ;-)
|
|
|
|
|