dump / backup does not contain data directory #5312

Closed
opened 2025-11-02 06:21:12 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @MonkeySon on GitHub (Apr 26, 2020).

  • Gitea version (or commit ref): 1.11.4
  • Git version: 2.20.1
  • Operating system: Ubuntu 19.10 Server
  • 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

I was trying to create a backup of my Gitea instance as found on the official docs. As I run my gitea as a service, I prepended the working directory manually when running the command. But the resulting zip files misses the data and custom directories. The log file states that it searched for custom at /usr/local/bin/ which is obviously the wrong directory. Maybe the data directory was silently skipped after that.

Is this a bug or am I missing something?

Commands and resulting zip file:

git@homeserver:~$ GITEA_WORK_DIR=/var/lib/gitea/; gitea dump -c /etc/gitea/app.ini
2020/04/26 17:55:09 ...dules/setting/git.go:91:newGit() [I] Git Version: 2.20.1, Wire Protocol Version 2 Enabled
git@homeserver:~$ unzip -l gitea-dump-1587916509.zip 
Archive:  gitea-dump-1587916509.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
    90955  2020-04-26 17:55   gitea-db.sql
     1751  2020-04-19 18:49   app.ini
   386969  2020-04-26 17:55   gitea-repo.zip
        0  2020-04-26 17:55   log/
    10661  2020-04-22 00:05   log/gitea.log.2020-04-22.001.gz
   276985  2020-04-26 17:55   log/gitea.log
    21062  2020-04-21 00:05   log/gitea.log.2020-04-21.001.gz
    29819  2020-04-25 00:05   log/gitea.log.2020-04-25.001.gz
     2744  2020-04-24 00:05   log/gitea.log.2020-04-24.001.gz
   131732  2020-04-20 00:05   log/gitea.log.2020-04-20.001.gz
    12852  2020-04-26 00:05   log/gitea.log.2020-04-26.001.gz
     6231  2020-04-23 00:05   log/gitea.log.2020-04-23.001.gz
---------                     -------
   971761                     12 files

Log file:

2020/04/26 17:55:09 ...dules/setting/log.go:276:newLogService() [I] Gitea Log Mode: File(File:info)
2020/04/26 17:55:09 ...les/setting/cache.go:45:newCacheService() [I] Cache Service Enabled
2020/04/26 17:55:09 ...s/setting/session.go:44:newSessionService() [I] Session Service Enabled
2020/04/26 17:55:09 cmd/dump.go:80:runDump() [I] Creating tmp work dir: /tmp/gitea-dump-120227348
2020/04/26 17:55:09 cmd/dump.go:90:runDump() [I] Packing dump files...
2020/04/26 17:55:09 cmd/dump.go:101:runDump() [I] Dumping local repositories.../home/git/gitea-repositories
2020/04/26 17:55:09 cmd/dump.go:115:runDump() [I] Dumping database...
2020/04/26 17:55:09 cmd/dump.go:127:runDump() [I] Adding custom configuration file from /etc/gitea/app.ini
2020/04/26 17:55:09 cmd/dump.go:139:runDump() [I] Custom dir /usr/local/bin/custom doesn't exist, skipped
2020/04/26 17:55:09 cmd/dump.go:169:runDump() [I] Removing tmp work dir: /tmp/gitea-dump-120227348

Thanks for your help :)

Originally created by @MonkeySon on GitHub (Apr 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.11.4 - Git version: 2.20.1 - Operating system: Ubuntu 19.10 Server - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description I was trying to create a backup of my Gitea instance as found on the [official docs](https://docs.gitea.io/en-us/backup-and-restore/). As I run my gitea as a service, I prepended the working directory manually when running the command. But the resulting zip files misses the `data` and `custom` directories. The log file states that it searched for `custom` at `/usr/local/bin/` which is obviously the wrong directory. Maybe the data directory was silently skipped after that. Is this a bug or am I missing something? Commands and resulting zip file: ``` git@homeserver:~$ GITEA_WORK_DIR=/var/lib/gitea/; gitea dump -c /etc/gitea/app.ini 2020/04/26 17:55:09 ...dules/setting/git.go:91:newGit() [I] Git Version: 2.20.1, Wire Protocol Version 2 Enabled git@homeserver:~$ unzip -l gitea-dump-1587916509.zip Archive: gitea-dump-1587916509.zip Length Date Time Name --------- ---------- ----- ---- 90955 2020-04-26 17:55 gitea-db.sql 1751 2020-04-19 18:49 app.ini 386969 2020-04-26 17:55 gitea-repo.zip 0 2020-04-26 17:55 log/ 10661 2020-04-22 00:05 log/gitea.log.2020-04-22.001.gz 276985 2020-04-26 17:55 log/gitea.log 21062 2020-04-21 00:05 log/gitea.log.2020-04-21.001.gz 29819 2020-04-25 00:05 log/gitea.log.2020-04-25.001.gz 2744 2020-04-24 00:05 log/gitea.log.2020-04-24.001.gz 131732 2020-04-20 00:05 log/gitea.log.2020-04-20.001.gz 12852 2020-04-26 00:05 log/gitea.log.2020-04-26.001.gz 6231 2020-04-23 00:05 log/gitea.log.2020-04-23.001.gz --------- ------- 971761 12 files ``` Log file: ``` 2020/04/26 17:55:09 ...dules/setting/log.go:276:newLogService() [I] Gitea Log Mode: File(File:info) 2020/04/26 17:55:09 ...les/setting/cache.go:45:newCacheService() [I] Cache Service Enabled 2020/04/26 17:55:09 ...s/setting/session.go:44:newSessionService() [I] Session Service Enabled 2020/04/26 17:55:09 cmd/dump.go:80:runDump() [I] Creating tmp work dir: /tmp/gitea-dump-120227348 2020/04/26 17:55:09 cmd/dump.go:90:runDump() [I] Packing dump files... 2020/04/26 17:55:09 cmd/dump.go:101:runDump() [I] Dumping local repositories.../home/git/gitea-repositories 2020/04/26 17:55:09 cmd/dump.go:115:runDump() [I] Dumping database... 2020/04/26 17:55:09 cmd/dump.go:127:runDump() [I] Adding custom configuration file from /etc/gitea/app.ini 2020/04/26 17:55:09 cmd/dump.go:139:runDump() [I] Custom dir /usr/local/bin/custom doesn't exist, skipped 2020/04/26 17:55:09 cmd/dump.go:169:runDump() [I] Removing tmp work dir: /tmp/gitea-dump-120227348 ``` Thanks for your help :)
Author
Owner

@MonkeySon commented on GitHub (Apr 26, 2020):

Okay, problem solved. I had to set the working directory with -w or --work-path and not via environment variable.
Like so: gitea dump -c /etc/gitea/app.ini -w /var/lib/gitea/

@MonkeySon commented on GitHub (Apr 26, 2020): Okay, problem solved. I had to set the working directory with `-w` or `--work-path` and not via environment variable. Like so: `gitea dump -c /etc/gitea/app.ini -w /var/lib/gitea/`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5312