go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.14k stars 5.42k forks source link

Systemd notify doesn't work for Install Page (INSTALL_LOCK=false) #28553

Open irfanjunaid opened 9 months ago

irfanjunaid commented 9 months ago

Description

Hi, I am still facing the same issue as #27422 Installed the latest version(1.21.2) following the docs. The service is not getting to active (running) state after copying the gitea.service.

root@localhost:/home/ubuntu# systemctl status gitea
● gitea.service - Gitea (Git with a cup of tea)
     Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: enabled)
     Active: activating (start) since Wed 2023-12-20 11:08:52 UTC; 52s ago
   Main PID: 9702 (gitea)
     Status: "Starting Gitea"
      Tasks: 8 (limit: 4590)
     Memory: 106.3M
        CPU: 491ms
     CGroup: /system.slice/gitea.service
             └─9702 /usr/local/bin/gitea web --config /etc/gitea/app.ini

Dec 20 11:08:52 ip-172-31-32-79 gitea[9702]: 2023/12/20 11:08:52 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.2 built with GNU Make 4.3, go1.21.5 : bindata, sqlite, sqlite_unlock_notify
Dec 20 11:08:52 ip-172-31-32-79 gitea[9702]: 2023/12/20 11:08:52 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
Dec 20 11:08:52 ip-172-31-32-79 gitea[9702]: 2023/12/20 11:08:52 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /usr/local/bin/gitea
Dec 20 11:08:52 ip-172-31-32-79 gitea[9702]: 2023/12/20 11:08:52 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /var/lib/gitea
Dec 20 11:08:52 ip-172-31-32-79 gitea[9702]: 2023/12/20 11:08:52 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /var/lib/gitea/custom
Dec 20 11:08:52 ip-172-31-32-79 gitea[9702]: 2023/12/20 11:08:52 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /etc/gitea/app.ini
Dec 20 11:08:52 ip-172-31-32-79 gitea[9702]: 2023/12/20 11:08:52 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run install page
Dec 20 11:08:52 ip-172-31-32-79 gitea[9702]: 2023/12/20 11:08:52 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000
Dec 20 11:08:52 ip-172-31-32-79 gitea[9702]: 2023/12/20 11:08:52 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): http://localhost:3000/
Dec 20 11:08:52 ip-172-31-32-79 gitea[9702]: 2023/12/20 11:08:52 ...s/graceful/server.go:70:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 9712

According to the changelog, only pre 1.20.x releases should be affected but the latest versions are also affected.

Gitea Version

1.21.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.43.0

Operating System

Ubuntu 22.04.3 LTS

How are you running Gitea?

Installation from binary

Database

SQLite

lng2020 commented 9 months ago

What's your gitea.service file?

irfanjunaid commented 9 months ago
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target

[Service]
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
# LimitNOFILE=524288:524288
RestartSec=2s
Type=notify
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
WatchdogSec=30s
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
PrivateUsers=false

[Install]
WantedBy=multi-user.target
bowaggoner commented 8 months ago

I ran into this issue on Debian 12 and Gitea 1.21.3 after a clean install. Installing from binary, following the docs. I found that if app.ini does not exist, then the issue occurs, i.e. the service status stays stuck on "activating". Attached are the results of systemctl status gitea and the relevant contents of gitea.service.

However, once app.ini exists with the correct permissions, the gitea service works normally. (So I can get around the issue by running gitea manually, completing the web setup, then stopping gitea and launching it as a service at that point.)

When I delete app.ini, the problem returns, and when I put app.ini back, the problem disappears.

systemctl_status_gitea.txt gitea_service.txt

wxiaoguang commented 8 months ago

There seems to be a bug.

So please use Type=simple at the moment (just as the old document said)

irfanjunaid commented 8 months ago

I can see that @bowaggoner comment seems to be true. Once the Gitea is initialized, Type=notify works(Alteast for me).