I use a docker image “gitea/gitea:1.17-rootless” to create my docker environment. I recently needed to migrate my environment to a new server. When restoring the backup to a new installation the repositories became inaccessible. When I click on a repository a 500 error is shown.
Backup and restore documentation for rootless containers appears to be out of date.
With the command below I generated the backup of my gitea installation in docker:
docker exec -u git -it -w /tmp $(docker ps -qf "name=gitea") bash -c '/usr/local/bin/gitea dump -c /etc/gitea/app.ini --file /tmp/gitea-dump.zip'
- The gitea-dump.zip file has the following content:
app.ini
data/
gitea-db.sql
repos/
I did a fresh install of gitea using docker and did the following steps:
- Mysql database restore:
docker cp gitea-db.sql giteadb:/gitea-db.sql
docker exec -it giteadb /bin/bash
mysql -u gitea -v gitea -p < gitea-db.sql
- Restore Gitea files with root user:
docker exec --user root -it cont-gitea-01 /bin/bash
cd /
unzip gitea-dump.zip -d /backup
cp backup/app.ini /etc/gitea/app.ini
cp -R backup/data/* /var/lib/gitea
cp -R backup/repos/* /var/lib/gitea/git/repositories
chown -R git:git /etc/gitea/app.ini /var/lib/gitea
Running the hooks with the git user:
docker exec -it gitea /bin/bash
/usr/local/bin/gitea -c '/etc/gitea/app.ini' admin regenerate hooks
Restored repository error: