A gentle introduction to the gitea doctor - Blog

Tue Jun 14, 2022 by dachary


This is a companion discussion topic for the original entry at https://blog.gitea.io/2022/06/a-gentle-introduction-to-the-gitea-doctor/

Thanks for the introduction to gitea doctor. I was going to try it out on my self-hosted Docker instance of Gitea using the --all flag, but it stopped after the first check.

m@f /etc/docker/gitea $ docker compose exec gitea gitea doctor --all
[1] Check paths and basic configuration
m@f /etc/docker/gitea $ 

Same behavior applies, when I do this inside the container (docker compose exec gitea bash …). I even tried to push it into the right direction by passing these environment variables:

bash-5.1# HOME=/data/gitea GITEA_WORK_DIR=/data/gitea gitea -c /data/gitea/conf/app.ini doctor --all                                                                                          
[1] Check paths and basic configuration
bash-5.1#

This is on Gitea 1.16.8 installed from image: gitea/gitea:1.16.

Can you explain what went wrong?

You need more flags when not using rootless:

$ docker exec --user git --workdir=/tmp gitea gitea doctor --all

See below for details.

Gave it a try tonight. Gitea is running fine. It is installed on a VM. This is version 1.16.5

$ gitea doctor -c /etc/gitea/app.ini
[1] Check paths and basic configuration
 - [I] Configuration File Path:    "/etc/gitea/app.ini"
[git@projects ~]$ echo $?
1
[git@projects ~]$ gitea doctor -c /etc/gitea/app.ini 
[1] Check paths and basic configuration
 - [I] Configuration File Path:    "/etc/gitea/app.ini"
 - [I] Repository Root Path:       "/var/lib/gitea/data/gitea-repositories"
 - [I] Data Root Path:             "/usr/local/bin/data"
 - [E]     Is REQUIRED but is not accessible. ERROR: stat /usr/local/bin/data: no such file or directory
 - [I] Custom File Root Path:      "/usr/local/bin/custom"
 - [W]     NOTICE: is not accessible (Error: stat /usr/local/bin/custom: no such file or directory)
 - [I] Work directory:             "/usr/local/bin"
 - [I] Log Root Path:              "/var/lib/gitea/log"
 - [C] Please check your configuration files and try again.
FAIL

Everything is under /var/lib/gitea and owned by gitea. /usr/local/bin/custom is not referenced by the config file. Do you know why it’s trying to look there?

Assuming you are running Gitea from binary with systemd, you need to specify --work-path:

$ gitea doctor --work-path /var/lib/gitea -c /etc/gitea/app.ini

See below for details: