Backup at least /var/lib/gitea/ on update #2

Open
opened 2023-04-13 10:01:57 +02:00 by Benjamin_Loison · 4 comments

Use:

/var/backups

When running my update command:

VERSION=1.19.1
cd /usr/local/bin/
wget https://github.com/go-gitea/gitea/releases/download/v$VERSION/gitea-$VERSION-linux-amd64 -O newgitea
chmod +x newgitea
mv newgitea gitea
killall gitea # use `;` if used as a single line
sudo -u gitea GITEA_WORK_DIR=/var/lib/gitea/ nohup /usr/local/bin/gitea web -c /etc/gitea/app.ini &

Don't forget to compress /var/lib/gitea/.
/etc/gitea/ could be backed up as well.

Use: ``` /var/backups ``` When running my update command: ```sh VERSION=1.19.1 cd /usr/local/bin/ wget https://github.com/go-gitea/gitea/releases/download/v$VERSION/gitea-$VERSION-linux-amd64 -O newgitea chmod +x newgitea mv newgitea gitea killall gitea # use `;` if used as a single line sudo -u gitea GITEA_WORK_DIR=/var/lib/gitea/ nohup /usr/local/bin/gitea web -c /etc/gitea/app.ini & ``` Don't forget to compress `/var/lib/gitea/`. `/etc/gitea/` could be backed up as well.
Author
Owner

Note that backing up is especially important when update contains breaking change.

Could investigate rsnapshot possibility. Otherwise:

VERSION=1.19.1
cd /usr/local/bin/
wget https://github.com/go-gitea/gitea/releases/download/v$VERSION/gitea-$VERSION-linux-amd64 -O newgitea
chmod +x newgitea
mv newgitea gitea
killall gitea # use `;` if used as a single line
zip -r /var/backups/gitea-$VERSION.zip /etc/gitea/ /var/lib/gitea/ /var/lib/mysql/gitea/
sudo -u gitea GITEA_WORK_DIR=/var/lib/gitea/ nohup /usr/local/bin/gitea web -c /etc/gitea/app.ini &

does the job.

Note that backing up is especially important when update contains breaking change. Could investigate rsnapshot possibility. Otherwise: ```sh VERSION=1.19.1 cd /usr/local/bin/ wget https://github.com/go-gitea/gitea/releases/download/v$VERSION/gitea-$VERSION-linux-amd64 -O newgitea chmod +x newgitea mv newgitea gitea killall gitea # use `;` if used as a single line zip -r /var/backups/gitea-$VERSION.zip /etc/gitea/ /var/lib/gitea/ /var/lib/mysql/gitea/ sudo -u gitea GITEA_WORK_DIR=/var/lib/gitea/ nohup /usr/local/bin/gitea web -c /etc/gitea/app.ini & ``` does the job.
Author
Owner

By the way should make sure that gitea isn't running anymore after the killall call. How to make killall wait gitea to stop running?

By the way should make sure that `gitea` isn't running anymore after the `killall` call. How to make `killall` wait `gitea` to stop running?
Author
Owner

Use rsnapshot to reduce the size of backups.

Use rsnapshot to reduce the size of backups.
Author
Owner
Related to [Benjamin-Loison/gitea/issues/119](https://github.com/Benjamin-Loison/gitea/issues/119).
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Benjamin_Loison/Gitea_instance#2
No description provided.