Description
Description
I am running gitea via the snap package, and have overridden the systemd unit file to set the --work-path
and --custom-path
to a mounted volume on my server, since there is no other way that I know about to override the environment variables in the snapcraft.yml
.
In /etc/systemd/system/snap.gitea.web.service.d/override.conf
:
[Service]
ExecStart=
ExecStart=/usr/bin/snap run gitea.web --config /mnt/mina-gitea-data/custom/conf/app.ini --work-path /mnt/mina-gitea-data --custom-path /mnt/mina-gitea-data/custom
User=git
In the logs for gitea I see the values that I expect:
34 cmd/web.go:105:runWeb() [I] Starting Gitea on PID: 1653
:34 ...ules/setting/time.go:58:loadTimeFrom() [I] Default UI Location is Europe/London
:34 cmd/web.go:159:runWeb() [I] Global init
:34 ...ules/setting/time.go:58:loadTimeFrom() [I] Default UI Location is Europe/London
:34 routers/init.go:118:GlobalInitInstalled() [I] Git Version: 2.17.1 (home: /mnt/mina-gitea-data/data/home)
:34 routers/init.go:119:GlobalInitInstalled() [I] AppPath: /snap/gitea/6474/gitea
:34 routers/init.go:120:GlobalInitInstalled() [I] AppWorkPath: /mnt/mina-gitea-data
:34 routers/init.go:121:GlobalInitInstalled() [I] Custom path: /mnt/mina-gitea-data/custom
:34 routers/init.go:122:GlobalInitInstalled() [I] Log path: /mnt/mina-gitea-data/log
:34 routers/init.go:123:GlobalInitInstalled() [I] Configuration file: /mnt/mina-gitea-data/custom/conf/app.ini
:34 routers/init.go:124:GlobalInitInstalled() [I] Run Mode: Dev
:34 routers/init.go:125:GlobalInitInstalled() [I] Gitea v1.19.3 built with GNU Make 4.1, go1.20.4 : bindata, sqlite, sqlite_unlock_notify, pam, cert
The doctor
command shows the Repository Root Path that I expect:
gregory@mina-gitea:~$ sudo runuser -u git -- gitea --config /mnt/mina-gitea-data/custom/conf/app.ini --work-path /mnt/mina-gitea-data/ --custom-path /mnt/mina-gitea-data/custom/ doctor
ERROR: Unable to write logs to provided file due to permissions error: doctor.log
failed to create sublogger (doctor): open doctor.log: permission denied
WARN: Logging will be disabled
Use `--log-file` to configure log file location
[1] Check paths and basic configuration
- [I] Configuration File Path: "/mnt/mina-gitea-data/custom/conf/app.ini"
- [I] Repository Root Path: "/mnt/mina-gitea-data/data/gitea-repositories"
- [I] Data Root Path: "/mnt/mina-gitea-data/data"
- [I] Custom File Root Path: "/mnt/mina-gitea-data/custom/"
- [I] Work directory: "/mnt/mina-gitea-data/"
- [I] Log Root Path: "/mnt/mina-gitea-data/log"
OK
However when I push commits to a repository, I receive the following error:
remote: Gitea: Incorrect configuration, no repository directory.
remote: Directory `[repository].ROOT` "/var/snap/gitea/common/data/gitea-repositories" was not found, please check if $GITEA_WORK_DIR is passed to the SSH connection or make `[repository].ROOT` an absolute value.
remote: panic: cannot create context from nil parent
It seems like different bits of gitea disagree about the value of this configuration setting?
Happy to provide more logs/info if needed!
Gitea Version
1.19.3
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
2.34.1
Operating System
Ubuntu 22.04
How are you running Gitea?
The Gitea server is provisioned using cloud-init and gitea is started using the systemd unit file.
The unit file has been overridden to specify the data paths and user:
[Service]
ExecStart=
ExecStart=/usr/bin/snap run gitea.web --config /mnt/mina-gitea-data/custom/conf/app.ini --work-path /mnt/mina-gitea-data --custom-path /mnt/mina-gitea-data/custom
User=git
It has been given the removable-media
permission via snap connect gitea:removable-media
before launching.
The entire app.ini
can be viewed as part of the cloud-init configuration here.
Database
SQLite