Problem with restore gitea from backup in docker #5902

Closed
opened 2025-11-02 06:39:50 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @melmus on GitHub (Aug 26, 2020).

  • Gitea version (or commit ref):
    1.13.0+dev-295-g16980d13c
  • Git version:
    2.17.1
  • Operating system:
    Ubuntu 18.04.4 LTS
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

HI! I have a problem with restore gitea from backup.
I made backup and restore command:

  1. docker exec -t -u git -w /data/dirtmp/ $(docker ps -qf name="gitea_server_1") sh -c "/app/gitea/gitea dump -c /data/gitea/conf/app.ini"
  2. sent gitea dump to remote server
  3. unzip gitea dump
  4. on new server I installed gitea(version) in docker(version)
  5. stopped gitea web: docker stop gitea_server_1
  6. Restore database: cat gitea-db.sql | docker exec -i gitea_db_1 psql -Ugitea
  7. copied repositories in data gitea
  8. started gitea web: docker start gitea_server_1

But I have a problem:
I don’t see visible repository, not visible organizations, users ssh keys, pull requests, webhooks. On page with statistics I see some repos, keys, webhooks.
If I go to page Explore, i see:

template: explore/repo_list:24:17: executing "explore/repo_list" at <.Owner.Visibility.IsPrivate>: nil pointer evaluating models.User.Visibility

I read documentation before make this. Please advise If I make something wrong?
How can i migrate gitea to new server in docker?
I see this problem on gitea version 1.12.3, and latest: 1.13.0+dev-295-g16980d13c, 1.13.0+dev-471-gb611ae190

Screenshots

Снимок экрана 2020-08-25 в 8 17 41
Снимок экрана 2020-08-26 в 18 08 14

Originally created by @melmus on GitHub (Aug 26, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.13.0+dev-295-g16980d13c - Git version: 2.17.1 - Operating system: Ubuntu 18.04.4 LTS - Database (use `[x]`): - [X] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X] Not relevant - Log gist: ## Description HI! I have a problem with restore gitea from backup. I made backup and restore command: 1. docker exec -t -u git -w /data/dirtmp/ $(docker ps -qf name="gitea_server_1") sh -c "/app/gitea/gitea dump -c /data/gitea/conf/app.ini" 2. sent gitea dump to remote server 3. unzip gitea dump 4. on new server I installed gitea(version) in docker(version) 5. stopped gitea web: docker stop gitea_server_1 6. Restore database: cat gitea-db.sql | docker exec -i gitea_db_1 psql -Ugitea 7. copied repositories in data gitea 8. started gitea web: docker start gitea_server_1 But I have a problem: I don’t see visible repository, not visible organizations, users ssh keys, pull requests, webhooks. On page with statistics I see some repos, keys, webhooks. If I go to page Explore, i see: **template: explore/repo_list:24:17: executing "explore/repo_list" at <.Owner.Visibility.IsPrivate>: nil pointer evaluating models.User.Visibility** I read documentation before make this. Please advise If I make something wrong? How can i migrate gitea to new server in docker? I see this problem on gitea version 1.12.3, and latest: 1.13.0+dev-295-g16980d13c, 1.13.0+dev-471-gb611ae190 ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** --> ![Снимок экрана 2020-08-25 в 8 17 41](https://user-images.githubusercontent.com/15018126/91315931-ecc08b00-e7c0-11ea-8aba-b86da340dfd0.png) ![Снимок экрана 2020-08-26 в 18 08 14](https://user-images.githubusercontent.com/15018126/91321647-85f2a000-e7c7-11ea-8e0c-4321de410480.png)
GiteaMirror added the type/bug label 2025-11-02 06:39:50 -06:00
Author
Owner

@melmus commented on GitHub (Sep 7, 2020):

This issue is actual now.

@melmus commented on GitHub (Sep 7, 2020): This issue is actual now.
Author
Owner

@6543 commented on GitHub (Sep 7, 2020):

@melmus did you use the SAME version for dump & restore
and did you copy the app.ini too?

@6543 commented on GitHub (Sep 7, 2020): @melmus did you use the **SAME** version for dump & restore and did you copy the app.ini too?
Author
Owner

@melmus commented on GitHub (Sep 16, 2020):

@6543, yes, I used the same version for dump & restore, and I copyed the app.ini too

@melmus commented on GitHub (Sep 16, 2020): @6543, yes, I used the same version for dump & restore, and I copyed the app.ini too
Author
Owner

@lakostin commented on GitHub (Sep 18, 2020):

have the same problem

@lakostin commented on GitHub (Sep 18, 2020): have the same problem
Author
Owner

@6543 commented on GitHub (Sep 18, 2020):

@melmus lots of patches have happend (353 pr's in total) can you upgrade the gitea who executes the dump comand?
PS: backup via simply copy data and dump DB mannualy should do it too

still, if this is a problem it should be solved ...

@6543 commented on GitHub (Sep 18, 2020): @melmus lots of patches have happend (353 pr's in total) can you upgrade the gitea who executes the dump comand? PS: backup via simply copy data and dump DB mannualy should do it too still, if this is a problem it should be solved ...
Author
Owner

@melmus commented on GitHub (Sep 18, 2020):

@6543, I dumped DB manually,

docker exec -i gitea_db_1 /bin/bash -c "export PGPASSWORD=giteapassword && /usr/bin/pg_dump -U gitea gitea"  > dump_DB.sql

And restored DB:

docker stop gitea_server_1
cat dump_DB.sql | docker exec -i gitea_db_1 psql -Ugitea

After I copied repositories:

cp -r repositories/ /data/git/git/repositories

And started gitea web

docker start gitea_server_1

This is working decision...

@melmus commented on GitHub (Sep 18, 2020): @6543, I dumped DB manually, ```bash docker exec -i gitea_db_1 /bin/bash -c "export PGPASSWORD=giteapassword && /usr/bin/pg_dump -U gitea gitea"  > dump_DB.sql ``` And restored DB: ```bash docker stop gitea_server_1 cat dump_DB.sql | docker exec -i gitea_db_1 psql -Ugitea ``` After I copied repositories: ```bash cp -r repositories/ /data/git/git/repositories ``` And started gitea web ```bash docker start gitea_server_1 ``` This is working decision...
Author
Owner

@HiranChaudhuri commented on GitHub (Oct 7, 2021):

Actually, since there is a really nice command to dump the gitea status into a zip or tar ball, would it be possible to create a restore command that takes such a dump archive and puts the files back where they belong?

In case of a restore situation there is tension already since all repositories and their history are at stake.
Relying on human beings to manually place the files where they should be, especially without written documentation leaves room for improvement.

To be more concise: Create a gitea command that can be launched like this:

gitea restore <path to dump file>

gitea would then finish ongoing requests, shutdown, restore the files and the database from the dump and start up the server again. Nice and smooth, with some output to keep the user informed.

@HiranChaudhuri commented on GitHub (Oct 7, 2021): Actually, since there is a really nice command to dump the gitea status into a zip or tar ball, would it be possible to create a restore command that takes such a dump archive and puts the files back where they belong? In case of a restore situation there is tension already since all repositories and their history are at stake. Relying on human beings to manually place the files where they should be, especially without written documentation leaves room for improvement. To be more concise: Create a gitea command that can be launched like this: gitea restore <path to dump file> gitea would then finish ongoing requests, shutdown, restore the files and the database from the dump and start up the server again. Nice and smooth, with some output to keep the user informed.
Author
Owner

@wxiaoguang commented on GitHub (Apr 13, 2022):

Outdated

@wxiaoguang commented on GitHub (Apr 13, 2022): Outdated
Author
Owner

@HiranChaudhuri commented on GitHub (May 4, 2022):

How come this is outdated? Does such a command exist meanwhile?

@HiranChaudhuri commented on GitHub (May 4, 2022): How come this is outdated? Does such a command exist meanwhile?
Author
Owner

@wxiaoguang commented on GitHub (May 5, 2022):

This issue was asking about the restore for 1.13.0, it's outdated.

The suggestion in comment is not obvious to maintainers, it may be worth to be a separate proposal issue if you like.

@wxiaoguang commented on GitHub (May 5, 2022): This issue was asking about the restore for 1.13.0, it's outdated. The suggestion in comment is not obvious to maintainers, it may be worth to be a separate proposal issue if you like.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5902