~~Gitea destroyed all my data after moving its work path~~ (jk) #13356

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

Originally created by @hex-4d5a9000 on GitHub (Aug 2, 2024).

Description

So I had deployed gitea on my laptop a few months ago, and now I finally have got a server so I was trying to migrate gitea to the server. I know gitea have a backup command but since gitea currently cannot restore backups automatically and I was lazy, I decided to try if gitea will still run if I move the work path. This is what I did: (Inside start.sh is one command that starts gitea using nix: nix-shell -p gitea --command "gitea --work-path /home/rimuru/jura-production-data")

rimuru@jura:~/jura-production-data$ ls
custom  data  log  start.sh
rimuru@jura:~/jura-production-data$ nano start.sh 
rimuru@jura:~/jura-production-data$ cd ..
rimuru@jura:~$ mv jura-production-data/ gitea
rimuru@jura:~$ cd gitea/
rimuru@jura:~/gitea$ ls
custom  data  log  start.sh
rimuru@jura:~/gitea$ nano start.sh # I modified start.sh to make the work path pointing to the new work path
rimuru@jura:~/gitea$ ./start.sh 
2024/08/02 16:48:52 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 418086
2024/08/02 16:48:52 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify
2024/08/02 16:48:52 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
2024/08/02 16:48:52 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea
2024/08/02 16:48:52 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/jura-production-data
2024/08/02 16:48:52 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /home/rimuru/jura-production-data/custom
2024/08/02 16:48:52 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /home/rimuru/gitea/custom/conf/app.ini
2024/08/02 16:48:52 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server
2024/08/02 16:48:52 cmd/web.go:161:serveInstalled() [E] WORK_PATH from config "/home/rimuru/gitea/custom/conf/app.ini" doesn't match other paths from environment variables or command arguments. Only WORK_PATH in config should be set and used. Please make sure the path in config file is correct, remove the other outdated work paths from environment variables and command arguments
2024/08/02 16:48:52 routers/init.go:112:InitWebInstalled() [I] Git version: 2.44.0, Wire Protocol Version 2 Enabled (home: /home/rimuru/jura-production-data/data/home)
2024/08/02 16:48:52 ...les/setting/cache.go:75:loadCacheFrom() [I] Cache Service Enabled
2024/08/02 16:48:52 ...les/setting/cache.go:90:loadCacheFrom() [I] Last Commit Cache Service Enabled
2024/08/02 16:48:52 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled
2024/08/02 16:48:52 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/attachments
2024/08/02 16:48:52 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/avatars
2024/08/02 16:48:52 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/repo-avatars
2024/08/02 16:48:52 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local
2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/lfs
2024/08/02 16:48:52 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/repo-archive
2024/08/02 16:48:52 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/packages
2024/08/02 16:48:52 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local
2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/actions_log
2024/08/02 16:48:52 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local
2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/actions_artifacts
2024/08/02 16:48:53 routers/init.go:131:InitWebInstalled() [I] SQLite3 support is enabled
2024/08/02 16:48:53 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
2024/08/02 16:48:53 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2024/08/02 16:48:53 cmd/web.go:194:serveInstalled() [I] PING DATABASE sqlite3
^C2024/08/02 16:49:37 ...eful/manager_unix.go:203:handleSignals() [W] PID 418086. Received SIGINT. Shutting down...
2024/08/02 16:49:37 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition
2024/08/02 16:49:37 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: sync database struct error: context canceled
2024/08/02 16:49:37 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds
2024/08/02 16:49:38 .../graceful/manager.go:184:doTerminate() [W] Terminating
2024/08/02 16:49:38 ...eful/manager_unix.go:216:handleSignals() [W] PID: 418086. Background context for manager closed - context canceled - Shutting down...
2024/08/02 16:49:40 routers/init.go:69:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: Aborted due to shutdown:
in retry ORM engine initialization
rimuru@jura:~/gitea$ cd ..
rimuru@jura:~$ mv gitea/ jura-production-data
rimuru@jura:~$ cd jura-production-data/
data/  gitea/ 
rimuru@jura:~$ cd jura-production-data/
rimuru@jura:~/jura-production-data$ ls
data  gitea
rimuru@jura:~/jura-production-data$ ls
data  gitea
rimuru@jura:~/jura-production-data$ ls -al
总计 16
drwxr-xr-x  4 rimuru rimuru 4096  8月 2日 16:49 .
drwx------ 75 rimuru rimuru 4096  8月 2日 16:49 ..
drwxr-xr-x 13 rimuru rimuru 4096  8月 2日 16:49 data
drwxr-xr-x  6 rimuru rimuru 4096  8月 2日 16:48 gitea

Gitea reinitialized in the work path and deleted all the files in it. Luckily I was testing the backup functionality a few weeks ago and have a backup, otherwise it could be way worse...

Gitea Version

Gitea version 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Debian GNU/Linux 12 (bookworm) x86_64

How are you running Gitea?

I was using Gitea with nix, running it from command-line.

Database

SQLite

Originally created by @hex-4d5a9000 on GitHub (Aug 2, 2024). ### Description So I had deployed gitea on my laptop a few months ago, and now I finally have got a server so I was trying to migrate gitea to the server. I know gitea have a backup command but since gitea currently cannot restore backups automatically and I was lazy, I decided to try if gitea will still run if I move the work path. This is what I did: (Inside start.sh is one command that starts gitea using nix: `nix-shell -p gitea --command "gitea --work-path /home/rimuru/jura-production-data"`) ``` rimuru@jura:~/jura-production-data$ ls custom data log start.sh rimuru@jura:~/jura-production-data$ nano start.sh rimuru@jura:~/jura-production-data$ cd .. rimuru@jura:~$ mv jura-production-data/ gitea rimuru@jura:~$ cd gitea/ rimuru@jura:~/gitea$ ls custom data log start.sh rimuru@jura:~/gitea$ nano start.sh # I modified start.sh to make the work path pointing to the new work path rimuru@jura:~/gitea$ ./start.sh 2024/08/02 16:48:52 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 418086 2024/08/02 16:48:52 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify 2024/08/02 16:48:52 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod 2024/08/02 16:48:52 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea 2024/08/02 16:48:52 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/jura-production-data 2024/08/02 16:48:52 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /home/rimuru/jura-production-data/custom 2024/08/02 16:48:52 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /home/rimuru/gitea/custom/conf/app.ini 2024/08/02 16:48:52 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server 2024/08/02 16:48:52 cmd/web.go:161:serveInstalled() [E] WORK_PATH from config "/home/rimuru/gitea/custom/conf/app.ini" doesn't match other paths from environment variables or command arguments. Only WORK_PATH in config should be set and used. Please make sure the path in config file is correct, remove the other outdated work paths from environment variables and command arguments 2024/08/02 16:48:52 routers/init.go:112:InitWebInstalled() [I] Git version: 2.44.0, Wire Protocol Version 2 Enabled (home: /home/rimuru/jura-production-data/data/home) 2024/08/02 16:48:52 ...les/setting/cache.go:75:loadCacheFrom() [I] Cache Service Enabled 2024/08/02 16:48:52 ...les/setting/cache.go:90:loadCacheFrom() [I] Last Commit Cache Service Enabled 2024/08/02 16:48:52 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled 2024/08/02 16:48:52 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local 2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/attachments 2024/08/02 16:48:52 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local 2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/avatars 2024/08/02 16:48:52 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local 2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/repo-avatars 2024/08/02 16:48:52 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local 2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/lfs 2024/08/02 16:48:52 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local 2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/repo-archive 2024/08/02 16:48:52 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local 2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/packages 2024/08/02 16:48:52 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local 2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/actions_log 2024/08/02 16:48:52 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local 2024/08/02 16:48:52 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/jura-production-data/data/actions_artifacts 2024/08/02 16:48:53 routers/init.go:131:InitWebInstalled() [I] SQLite3 support is enabled 2024/08/02 16:48:53 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization. 2024/08/02 16:48:53 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10... 2024/08/02 16:48:53 cmd/web.go:194:serveInstalled() [I] PING DATABASE sqlite3 ^C2024/08/02 16:49:37 ...eful/manager_unix.go:203:handleSignals() [W] PID 418086. Received SIGINT. Shutting down... 2024/08/02 16:49:37 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition 2024/08/02 16:49:37 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: sync database struct error: context canceled 2024/08/02 16:49:37 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/08/02 16:49:38 .../graceful/manager.go:184:doTerminate() [W] Terminating 2024/08/02 16:49:38 ...eful/manager_unix.go:216:handleSignals() [W] PID: 418086. Background context for manager closed - context canceled - Shutting down... 2024/08/02 16:49:40 routers/init.go:69:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: Aborted due to shutdown: in retry ORM engine initialization rimuru@jura:~/gitea$ cd .. rimuru@jura:~$ mv gitea/ jura-production-data rimuru@jura:~$ cd jura-production-data/ data/ gitea/ rimuru@jura:~$ cd jura-production-data/ rimuru@jura:~/jura-production-data$ ls data gitea rimuru@jura:~/jura-production-data$ ls data gitea rimuru@jura:~/jura-production-data$ ls -al 总计 16 drwxr-xr-x 4 rimuru rimuru 4096 8月 2日 16:49 . drwx------ 75 rimuru rimuru 4096 8月 2日 16:49 .. drwxr-xr-x 13 rimuru rimuru 4096 8月 2日 16:49 data drwxr-xr-x 6 rimuru rimuru 4096 8月 2日 16:48 gitea ``` Gitea reinitialized in the work path and deleted all the files in it. Luckily I was testing the backup functionality a few weeks ago and have a backup, otherwise it could be way worse... ### Gitea Version Gitea version 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System Debian GNU/Linux 12 (bookworm) x86_64 ### How are you running Gitea? I was using Gitea with nix, running it from command-line. ### Database SQLite
GiteaMirror added the issue/needs-feedback label 2025-11-02 10:39:46 -06:00
Author
Owner

@lunny commented on GitHub (Aug 2, 2024):

You are still using old work path according your log

mv jura-production-data/ gitea
...
2024/08/02 16:48:52 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/jura-production-data
@lunny commented on GitHub (Aug 2, 2024): You are still using old work path according your log ``` mv jura-production-data/ gitea ... 2024/08/02 16:48:52 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/jura-production-data ```
Author
Owner

@hex-4d5a9000 commented on GitHub (Aug 2, 2024):

Hi everyone, I'm really, really sorry for the confusion. So I did an experiment to think about what actually happened again:

rimuru@jura:~/test$ nix-shell -p gitea --command="gitea --work-path /home/rimuru/jura-production-data"
error: unrecognised flag '--command=gitea --work-path /home/rimuru/jura-production-data'
Try 'nix-shell --help' for more information.
rimuru@jura:~/test$ nix-shell -p gitea --command "gitea --work-path /home/rimuru/test/1"
2024/08/02 22:28:34 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 1595633
2024/08/02 22:28:34 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify
2024/08/02 22:28:34 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
2024/08/02 22:28:34 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea
2024/08/02 22:28:34 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/test/1
2024/08/02 22:28:34 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /home/rimuru/test/1/custom
2024/08/02 22:28:34 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /home/rimuru/test/1/custom/conf/app.ini
2024/08/02 22:28:34 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run install page
2024/08/02 22:28:34 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000
2024/08/02 22:28:34 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): http://localhost:3000/
2024/08/02 22:28:34 ...s/graceful/server.go:70:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 1595633
2024/08/02 22:30:40 ...s/install/install.go:502:SubmitInstall() [I] Save settings to custom config file /home/rimuru/test/1/custom/conf/app.ini
2024/08/02 22:30:40 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
2024/08/02 22:30:40 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2024/08/02 22:30:40 ...s/install/install.go:579:SubmitInstall() [I] First-time run install finished!
2024/08/02 22:30:43 cmd/web.go:355:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed
2024/08/02 22:30:43 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify
2024/08/02 22:30:43 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
2024/08/02 22:30:43 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea
2024/08/02 22:30:43 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/test/1
2024/08/02 22:30:43 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /home/rimuru/test/1/custom
2024/08/02 22:30:43 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /home/rimuru/test/1/custom/conf/app.ini
2024/08/02 22:30:43 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server
2024/08/02 22:30:43 modules/git/git.go:135:checkInit() [W] git module has been initialized already, duplicate init may work but it's better to fix it
2024/08/02 22:30:44 routers/init.go:112:InitWebInstalled() [I] Git version: 2.44.0, Wire Protocol Version 2 Enabled (home: /home/rimuru/test/1/data/home)
2024/08/02 22:30:44 ...les/setting/cache.go:75:loadCacheFrom() [I] Cache Service Enabled
2024/08/02 22:30:44 ...les/setting/cache.go:90:loadCacheFrom() [I] Last Commit Cache Service Enabled
2024/08/02 22:30:44 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled
2024/08/02 22:30:44 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/attachments
2024/08/02 22:30:44 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/avatars
2024/08/02 22:30:44 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/repo-avatars
2024/08/02 22:30:44 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local
2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/lfs
2024/08/02 22:30:44 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/repo-archive
2024/08/02 22:30:44 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/packages
2024/08/02 22:30:44 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local
2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/actions_log
2024/08/02 22:30:44 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local
2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/actions_artifacts
2024/08/02 22:30:44 routers/init.go:131:InitWebInstalled() [I] SQLite3 support is enabled
2024/08/02 22:30:44 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
2024/08/02 22:30:44 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2024/08/02 22:30:44 cmd/web.go:194:serveInstalled() [I] PING DATABASE sqlite3
2024/08/02 22:30:44 cmd/web.go:194:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2024/08/02 22:30:44 routers/init.go:137:InitWebInstalled() [I] ORM engine initialization successful!
2024/08/02 22:30:49 ...er/issues/indexer.go:77:func1() [I] PID 1595633: Initializing Issue Indexer: bleve
2024/08/02 22:30:49 ...xer/stats/indexer.go:39:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories
2024/08/02 22:30:49 routers/init.go:81:syncAppConfForGit() [I] AppPath changed from '' to '/nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea'
2024/08/02 22:30:49 routers/init.go:86:syncAppConfForGit() [I] CustomConf changed from '' to '/home/rimuru/test/1/custom/conf/app.ini'
2024/08/02 22:30:49 routers/init.go:92:syncAppConfForGit() [I] re-sync repository hooks ...
2024/08/02 22:30:49 routers/init.go:95:syncAppConfForGit() [I] re-write ssh public keys ...
2024/08/02 22:30:49 ...s/actions/cleanup.go:29:CleanupArtifacts() [I] Found 0 expired artifacts
2024/08/02 22:30:49 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000
2024/08/02 22:30:49 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): http://127.0.0.1:3000/
2024/08/02 22:30:49 cmd/web.go:311:listen() [I] LFS server enabled
2024/08/02 22:30:49 ...s/graceful/server.go:70:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 1595633
2024/08/02 22:30:49 ...er/issues/indexer.go:154:func2() [I] Issue Indexer Initialization took 413.778153ms
2024/08/02 22:30:50 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login for 127.0.0.1:54288, 200 OK in 10.7ms @ auth/auth.go:146(auth.SignIn)
2024/08/02 22:30:50 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login for 127.0.0.1:54288, 200 OK in 5.8ms @ auth/auth.go:146(auth.SignIn)
^C2024/08/02 22:31:10 ...eful/manager_unix.go:203:handleSignals() [W] PID 1595633. Received SIGINT. Shutting down...
2024/08/02 22:31:10 cmd/web.go:355:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed
2024/08/02 22:31:10 ...eful/server_hooks.go:46:doShutdown() [I] PID: 1595633 Listener ([::]:3000) closed.
2024/08/02 22:31:10 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition
2024/08/02 22:31:11 .../graceful/manager.go:184:doTerminate() [W] Terminating
2024/08/02 22:31:11 ...er/issues/indexer.go:121:2() [I] PID: 1595633 Issue Indexer closed
2024/08/02 22:31:11 ...eful/manager_unix.go:216:handleSignals() [W] PID: 1595633. Background context for manager closed - context canceled - Shutting down...
2024/08/02 22:31:11 cmd/web.go:214:serveInstalled() [I] PID: 1595633 Gitea Web Finished
rimuru@jura:~/test$ ls 1
custom  data  log
rimuru@jura:~/test$ touch 1/file1
rimuru@jura:~/test$ touch 1/file2
rimuru@jura:~/test$ touch 1/file3
rimuru@jura:~/test$ mv 1 2
rimuru@jura:~/test$ nix-shell -p gitea --command "gitea --work-path /home/rimuru/test/2"
2024/08/02 22:31:51 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 1609436
2024/08/02 22:31:51 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify
2024/08/02 22:31:51 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
2024/08/02 22:31:51 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea
2024/08/02 22:31:51 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/test/1
2024/08/02 22:31:51 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /home/rimuru/test/1/custom
2024/08/02 22:31:51 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /home/rimuru/test/2/custom/conf/app.ini
2024/08/02 22:31:51 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server
2024/08/02 22:31:51 cmd/web.go:161:serveInstalled() [E] WORK_PATH from config "/home/rimuru/test/2/custom/conf/app.ini" doesn't match other paths from environment variables or command arguments. Only WORK_PATH in config should be set and used. Please make sure the path in config file is correct, remove the other outdated work paths from environment variables and command arguments
2024/08/02 22:31:51 routers/init.go:112:InitWebInstalled() [I] Git version: 2.44.0, Wire Protocol Version 2 Enabled (home: /home/rimuru/test/1/data/home)
2024/08/02 22:31:51 ...les/setting/cache.go:75:loadCacheFrom() [I] Cache Service Enabled
2024/08/02 22:31:51 ...les/setting/cache.go:90:loadCacheFrom() [I] Last Commit Cache Service Enabled
2024/08/02 22:31:51 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled
2024/08/02 22:31:51 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/attachments
2024/08/02 22:31:51 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/avatars
2024/08/02 22:31:51 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/repo-avatars
2024/08/02 22:31:51 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local
2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/lfs
2024/08/02 22:31:51 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/repo-archive
2024/08/02 22:31:51 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/packages
2024/08/02 22:31:51 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local
2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/actions_log
2024/08/02 22:31:51 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local
2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/actions_artifacts
2024/08/02 22:31:51 routers/init.go:131:InitWebInstalled() [I] SQLite3 support is enabled
2024/08/02 22:31:51 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
2024/08/02 22:31:51 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2024/08/02 22:31:51 cmd/web.go:194:serveInstalled() [I] PING DATABASE sqlite3
^C2024/08/02 22:32:00 ...eful/manager_unix.go:203:handleSignals() [W] PID 1609436. Received SIGINT. Shutting down...
2024/08/02 22:32:00 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition
2024/08/02 22:32:00 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: sync database struct error: context canceled
2024/08/02 22:32:00 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds
2024/08/02 22:32:01 .../graceful/manager.go:184:doTerminate() [W] Terminating
2024/08/02 22:32:01 ...eful/manager_unix.go:216:handleSignals() [W] PID: 1609436. Background context for manager closed - context canceled - Shutting down...
2024/08/02 22:32:03 routers/init.go:69:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: Aborted due to shutdown:
in retry ORM engine initialization
rimuru@jura:~/test$ ls 2
custom  data  file1  file2  file3  log
rimuru@jura:~/test$ mv 2 1
rimuru@jura:~/test$ nix-shell -p gitea --command "gitea --work-path /home/rimuru/test/1"
2024/08/02 22:32:42 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 1613708
2024/08/02 22:32:42 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify
2024/08/02 22:32:42 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
2024/08/02 22:32:42 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea
2024/08/02 22:32:42 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/test/1
2024/08/02 22:32:42 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /home/rimuru/test/1/custom
2024/08/02 22:32:42 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /home/rimuru/test/1/custom/conf/app.ini
2024/08/02 22:32:42 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run install page
2024/08/02 22:32:42 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000
2024/08/02 22:32:42 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): http://localhost:3000/
2024/08/02 22:32:42 ...s/graceful/server.go:70:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 1613708
^C2024/08/02 22:32:47 ...eful/manager_unix.go:203:handleSignals() [W] PID 1613708. Received SIGINT. Shutting down...
2024/08/02 22:32:47 cmd/web.go:355:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed
2024/08/02 22:32:47 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition
2024/08/02 22:32:47 ...eful/server_hooks.go:46:doShutdown() [I] PID: 1613708 Listener ([::]:3000) closed.
2024/08/02 22:32:48 .../graceful/manager.go:184:doTerminate() [W] Terminating
2024/08/02 22:32:48 ...eful/manager_unix.go:216:handleSignals() [W] PID: 1613708. Background context for manager closed - context canceled - Shutting down...
2024/08/02 22:32:48 cmd/web.go:145:serveInstall() [I] PID: 1613708 Gitea Web Finished
rimuru@jura:~/test$ ls 1
2  data

In a rush, I tried to move the folder back after seeing gitea not working. However, because gitea recreated the original working directory after the 2nd nix command nix-shell -p gitea --command "gitea --work-path /home/rimuru/test/2", the mv command rimuru@jura:~/test$ mv 2 1 will actually move /home/rimuru/test/2 to /home/rimuru/test/1/2 instead of /home/rimuru/test/1 as I expected.

This is purely my observational issue instead of an issue of gitea. The log I sent actually already tell that my data is still there, but I was in a panic, and was unable to check the terminal output more carefully:

rimuru@jura:~/jura-production-data$ ls -al
总计 16
drwxr-xr-x  4 rimuru rimuru 4096  8月 2日 16:49 .
drwx------ 75 rimuru rimuru 4096  8月 2日 16:49 ..
drwxr-xr-x 13 rimuru rimuru 4096  8月 2日 16:49 data
drwxr-xr-x  6 rimuru rimuru 4096  8月 2日 16:48 gitea

@lunny thank you for pointing out it might have things to do with the old work path. I apologize for the confusion I've caused.

@hex-4d5a9000 commented on GitHub (Aug 2, 2024): Hi everyone, I'm really, really sorry for the confusion. So I did an experiment to think about what actually happened again: ``` rimuru@jura:~/test$ nix-shell -p gitea --command="gitea --work-path /home/rimuru/jura-production-data" error: unrecognised flag '--command=gitea --work-path /home/rimuru/jura-production-data' Try 'nix-shell --help' for more information. rimuru@jura:~/test$ nix-shell -p gitea --command "gitea --work-path /home/rimuru/test/1" 2024/08/02 22:28:34 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 1595633 2024/08/02 22:28:34 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify 2024/08/02 22:28:34 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod 2024/08/02 22:28:34 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea 2024/08/02 22:28:34 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/test/1 2024/08/02 22:28:34 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /home/rimuru/test/1/custom 2024/08/02 22:28:34 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /home/rimuru/test/1/custom/conf/app.ini 2024/08/02 22:28:34 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run install page 2024/08/02 22:28:34 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000 2024/08/02 22:28:34 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): http://localhost:3000/ 2024/08/02 22:28:34 ...s/graceful/server.go:70:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 1595633 2024/08/02 22:30:40 ...s/install/install.go:502:SubmitInstall() [I] Save settings to custom config file /home/rimuru/test/1/custom/conf/app.ini 2024/08/02 22:30:40 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization. 2024/08/02 22:30:40 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10... 2024/08/02 22:30:40 ...s/install/install.go:579:SubmitInstall() [I] First-time run install finished! 2024/08/02 22:30:43 cmd/web.go:355:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed 2024/08/02 22:30:43 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify 2024/08/02 22:30:43 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod 2024/08/02 22:30:43 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea 2024/08/02 22:30:43 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/test/1 2024/08/02 22:30:43 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /home/rimuru/test/1/custom 2024/08/02 22:30:43 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /home/rimuru/test/1/custom/conf/app.ini 2024/08/02 22:30:43 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server 2024/08/02 22:30:43 modules/git/git.go:135:checkInit() [W] git module has been initialized already, duplicate init may work but it's better to fix it 2024/08/02 22:30:44 routers/init.go:112:InitWebInstalled() [I] Git version: 2.44.0, Wire Protocol Version 2 Enabled (home: /home/rimuru/test/1/data/home) 2024/08/02 22:30:44 ...les/setting/cache.go:75:loadCacheFrom() [I] Cache Service Enabled 2024/08/02 22:30:44 ...les/setting/cache.go:90:loadCacheFrom() [I] Last Commit Cache Service Enabled 2024/08/02 22:30:44 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled 2024/08/02 22:30:44 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local 2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/attachments 2024/08/02 22:30:44 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local 2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/avatars 2024/08/02 22:30:44 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local 2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/repo-avatars 2024/08/02 22:30:44 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local 2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/lfs 2024/08/02 22:30:44 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local 2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/repo-archive 2024/08/02 22:30:44 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local 2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/packages 2024/08/02 22:30:44 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local 2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/actions_log 2024/08/02 22:30:44 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local 2024/08/02 22:30:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/actions_artifacts 2024/08/02 22:30:44 routers/init.go:131:InitWebInstalled() [I] SQLite3 support is enabled 2024/08/02 22:30:44 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization. 2024/08/02 22:30:44 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10... 2024/08/02 22:30:44 cmd/web.go:194:serveInstalled() [I] PING DATABASE sqlite3 2024/08/02 22:30:44 cmd/web.go:194:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1 2024/08/02 22:30:44 routers/init.go:137:InitWebInstalled() [I] ORM engine initialization successful! 2024/08/02 22:30:49 ...er/issues/indexer.go:77:func1() [I] PID 1595633: Initializing Issue Indexer: bleve 2024/08/02 22:30:49 ...xer/stats/indexer.go:39:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories 2024/08/02 22:30:49 routers/init.go:81:syncAppConfForGit() [I] AppPath changed from '' to '/nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea' 2024/08/02 22:30:49 routers/init.go:86:syncAppConfForGit() [I] CustomConf changed from '' to '/home/rimuru/test/1/custom/conf/app.ini' 2024/08/02 22:30:49 routers/init.go:92:syncAppConfForGit() [I] re-sync repository hooks ... 2024/08/02 22:30:49 routers/init.go:95:syncAppConfForGit() [I] re-write ssh public keys ... 2024/08/02 22:30:49 ...s/actions/cleanup.go:29:CleanupArtifacts() [I] Found 0 expired artifacts 2024/08/02 22:30:49 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000 2024/08/02 22:30:49 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): http://127.0.0.1:3000/ 2024/08/02 22:30:49 cmd/web.go:311:listen() [I] LFS server enabled 2024/08/02 22:30:49 ...s/graceful/server.go:70:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 1595633 2024/08/02 22:30:49 ...er/issues/indexer.go:154:func2() [I] Issue Indexer Initialization took 413.778153ms 2024/08/02 22:30:50 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login for 127.0.0.1:54288, 200 OK in 10.7ms @ auth/auth.go:146(auth.SignIn) 2024/08/02 22:30:50 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/login for 127.0.0.1:54288, 200 OK in 5.8ms @ auth/auth.go:146(auth.SignIn) ^C2024/08/02 22:31:10 ...eful/manager_unix.go:203:handleSignals() [W] PID 1595633. Received SIGINT. Shutting down... 2024/08/02 22:31:10 cmd/web.go:355:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed 2024/08/02 22:31:10 ...eful/server_hooks.go:46:doShutdown() [I] PID: 1595633 Listener ([::]:3000) closed. 2024/08/02 22:31:10 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition 2024/08/02 22:31:11 .../graceful/manager.go:184:doTerminate() [W] Terminating 2024/08/02 22:31:11 ...er/issues/indexer.go:121:2() [I] PID: 1595633 Issue Indexer closed 2024/08/02 22:31:11 ...eful/manager_unix.go:216:handleSignals() [W] PID: 1595633. Background context for manager closed - context canceled - Shutting down... 2024/08/02 22:31:11 cmd/web.go:214:serveInstalled() [I] PID: 1595633 Gitea Web Finished rimuru@jura:~/test$ ls 1 custom data log rimuru@jura:~/test$ touch 1/file1 rimuru@jura:~/test$ touch 1/file2 rimuru@jura:~/test$ touch 1/file3 rimuru@jura:~/test$ mv 1 2 rimuru@jura:~/test$ nix-shell -p gitea --command "gitea --work-path /home/rimuru/test/2" 2024/08/02 22:31:51 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 1609436 2024/08/02 22:31:51 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify 2024/08/02 22:31:51 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod 2024/08/02 22:31:51 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea 2024/08/02 22:31:51 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/test/1 2024/08/02 22:31:51 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /home/rimuru/test/1/custom 2024/08/02 22:31:51 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /home/rimuru/test/2/custom/conf/app.ini 2024/08/02 22:31:51 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server 2024/08/02 22:31:51 cmd/web.go:161:serveInstalled() [E] WORK_PATH from config "/home/rimuru/test/2/custom/conf/app.ini" doesn't match other paths from environment variables or command arguments. Only WORK_PATH in config should be set and used. Please make sure the path in config file is correct, remove the other outdated work paths from environment variables and command arguments 2024/08/02 22:31:51 routers/init.go:112:InitWebInstalled() [I] Git version: 2.44.0, Wire Protocol Version 2 Enabled (home: /home/rimuru/test/1/data/home) 2024/08/02 22:31:51 ...les/setting/cache.go:75:loadCacheFrom() [I] Cache Service Enabled 2024/08/02 22:31:51 ...les/setting/cache.go:90:loadCacheFrom() [I] Last Commit Cache Service Enabled 2024/08/02 22:31:51 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled 2024/08/02 22:31:51 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local 2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/attachments 2024/08/02 22:31:51 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local 2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/avatars 2024/08/02 22:31:51 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local 2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/repo-avatars 2024/08/02 22:31:51 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local 2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/lfs 2024/08/02 22:31:51 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local 2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/repo-archive 2024/08/02 22:31:51 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local 2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/packages 2024/08/02 22:31:51 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local 2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/actions_log 2024/08/02 22:31:51 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local 2024/08/02 22:31:51 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /home/rimuru/test/1/data/actions_artifacts 2024/08/02 22:31:51 routers/init.go:131:InitWebInstalled() [I] SQLite3 support is enabled 2024/08/02 22:31:51 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization. 2024/08/02 22:31:51 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10... 2024/08/02 22:31:51 cmd/web.go:194:serveInstalled() [I] PING DATABASE sqlite3 ^C2024/08/02 22:32:00 ...eful/manager_unix.go:203:handleSignals() [W] PID 1609436. Received SIGINT. Shutting down... 2024/08/02 22:32:00 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition 2024/08/02 22:32:00 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: sync database struct error: context canceled 2024/08/02 22:32:00 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds 2024/08/02 22:32:01 .../graceful/manager.go:184:doTerminate() [W] Terminating 2024/08/02 22:32:01 ...eful/manager_unix.go:216:handleSignals() [W] PID: 1609436. Background context for manager closed - context canceled - Shutting down... 2024/08/02 22:32:03 routers/init.go:69:mustInitCtx() [F] code.gitea.io/gitea/routers/common.InitDBEngine(ctx) failed: Aborted due to shutdown: in retry ORM engine initialization rimuru@jura:~/test$ ls 2 custom data file1 file2 file3 log rimuru@jura:~/test$ mv 2 1 rimuru@jura:~/test$ nix-shell -p gitea --command "gitea --work-path /home/rimuru/test/1" 2024/08/02 22:32:42 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 1613708 2024/08/02 22:32:42 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.10 built with go1.22.1 : pam, sqlite, sqlite_unlock_notify 2024/08/02 22:32:42 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod 2024/08/02 22:32:42 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /nix/store/61nd725z0bsfhaa9d1g9zfhs0d1rbjfy-gitea-1.21.10/bin/gitea 2024/08/02 22:32:42 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /home/rimuru/test/1 2024/08/02 22:32:42 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /home/rimuru/test/1/custom 2024/08/02 22:32:42 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /home/rimuru/test/1/custom/conf/app.ini 2024/08/02 22:32:42 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run install page 2024/08/02 22:32:42 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000 2024/08/02 22:32:42 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): http://localhost:3000/ 2024/08/02 22:32:42 ...s/graceful/server.go:70:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 1613708 ^C2024/08/02 22:32:47 ...eful/manager_unix.go:203:handleSignals() [W] PID 1613708. Received SIGINT. Shutting down... 2024/08/02 22:32:47 cmd/web.go:355:listen() [I] HTTP Listener: 0.0.0.0:3000 Closed 2024/08/02 22:32:47 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition 2024/08/02 22:32:47 ...eful/server_hooks.go:46:doShutdown() [I] PID: 1613708 Listener ([::]:3000) closed. 2024/08/02 22:32:48 .../graceful/manager.go:184:doTerminate() [W] Terminating 2024/08/02 22:32:48 ...eful/manager_unix.go:216:handleSignals() [W] PID: 1613708. Background context for manager closed - context canceled - Shutting down... 2024/08/02 22:32:48 cmd/web.go:145:serveInstall() [I] PID: 1613708 Gitea Web Finished rimuru@jura:~/test$ ls 1 2 data ``` In a rush, I tried to move the folder back after seeing gitea not working. However, because gitea recreated the original working directory after the 2nd nix command `nix-shell -p gitea --command "gitea --work-path /home/rimuru/test/2"`, the mv command `rimuru@jura:~/test$ mv 2 1` will actually move `/home/rimuru/test/2` to `/home/rimuru/test/1/2` instead of `/home/rimuru/test/1` as I expected. This is purely my observational issue instead of an issue of gitea. The log I sent actually already tell that my data is still there, but I was in a panic, and was unable to check the terminal output more carefully: ``` rimuru@jura:~/jura-production-data$ ls -al 总计 16 drwxr-xr-x 4 rimuru rimuru 4096 8月 2日 16:49 . drwx------ 75 rimuru rimuru 4096 8月 2日 16:49 .. drwxr-xr-x 13 rimuru rimuru 4096 8月 2日 16:49 data drwxr-xr-x 6 rimuru rimuru 4096 8月 2日 16:48 gitea ``` @lunny thank you for pointing out it might have things to do with the old work path. I apologize for the confusion I've caused.
Author
Owner

@lunny commented on GitHub (Aug 2, 2024):

Thank you for your experiment which may also let others resolve similar problems easier.

@lunny commented on GitHub (Aug 2, 2024): Thank you for your experiment which may also let others resolve similar problems easier.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13356