Closed
Description
- Gitea version (or commit ref):
$ gitea --version
Gitea version 1.9.5 built with GNU Make 4.1, go1.12.11 : bindata, sqlite, sqlite_unlock_notify
- Git version:
$ git --version
git version 2.20.1
- Operating system:
$ < /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ uname -a
Linux gitea 5.0.21-3-pve #1 SMP PVE 5.0.21-7 (Mon, 30 Sep 2019 09:11:02 +0200) x86_64 GNU/Linux
-
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:
The systemd socket unitgitea.main.socket
should be renamed togitea.socket
to make the service unitgitea.service
work.
Description
Systemd refuses to load the socket unit gitea.main.socket
, when I try to run gitea with a privileged port (80)
from the given example gitea.service
:
$ journalctl -xefu gitea.service
[...]
-- The job identifier is 242 and the job result is done.
Nov 03 03:12:16 gitea systemd[1]: gitea.main.socket: Socket service gitea.main.service not loaded, refusing.
Nov 03 03:12:16 gitea systemd[1]: Failed to listen on Gitea Web Socket.
-- Subject: A start job for unit gitea.main.socket has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit gitea.main.socket has finished with a failure.
[...]
Solution
Gitea can only be started successfully, if the socket unit gitea.main.socket
is renamed to its corresponding service unit gitea.service
:
Edit: It is possible to use the socket unit without renaming it #8804 (comment)
$ mv /etc/systemd/system/gitea{.main,}.socket
$ systemctl daemon-reload
$ systemctl start gitea.service
$ journalctl -xefu gitea.service
[...]
Nov 03 03:26:52 gitea systemd[1]: Started Gitea (Git with a cup of tea).
-- Subject: A start job for unit gitea.service has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit gitea.service has finished successfully.
--
-- The job identifier is 380.
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 ...dules/setting/git.go:83:newGit() [I] Git Version: 2.20.1, Wire Protocol Version 2 Enabled
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 routers/init.go:72:GlobalInit() [T] AppPath: /usr/local/sbin/gitea
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 routers/init.go:73:GlobalInit() [T] AppWorkPath: /var/lib/gitea
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 routers/init.go:74:GlobalInit() [T] Custom path: /var/lib/gitea/custom
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 routers/init.go:75:GlobalInit() [T] Log path: /var/lib/gitea/log
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 ...dules/setting/log.go:226:newLogService() [I] Gitea v1.9.5 built with GNU Make 4.1, go1.12.11 : bindata, sqlite, sqlite_unlock_notify
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 ...dules/setting/log.go:269:newLogService() [I] Gitea Log Mode: Console(Console:info)
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 ...les/setting/cache.go:42:newCacheService() [I] Cache Service Enabled
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 ...s/setting/session.go:45:newSessionService() [I] Session Service Enabled
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 routers/init.go:106:GlobalInit() [I] SQLite3 Supported
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 routers/init.go:37:checkRunMode() [I] Run Mode: Development
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 cmd/web.go:151:runWeb() [I] Listen: http://0.0.0.0:80
Nov 03 03:26:52 gitea gitea[4871]: 2019/11/03 03:26:52 ...ce/gracehttp/http.go:135:Serve() [I] Listening on init activated [::]:80
[...]
Pull request link
A pull request can be found here.
Additional information
Working configuration files
$ systemctl cat gitea.service
# /etc/systemd/system/gitea.service
# custom - 20191103 - rfischer: add the service unit for "gitea"
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
###
# Don't forget to add the database service requirements
###
#
#Requires=mysql.service
#Requires=mariadb.service
#Requires=postgresql.service
#Requires=memcached.service
#Requires=redis.service
#
###
# If using socket activation for main http/s
###
#
After=gitea.socket
Requires=gitea.socket
#
###
# (You can also provide gitea an http fallback and/or ssh socket too)
#
# An example of /etc/systemd/system/gitea.socket
###
##
## [Unit]
## Description=Gitea Web Socket
## PartOf=gitea.service
##
## [Socket]
## ListenStream=<some_port>
## NoDelay=true
##
## [Install]
## WantedBy=sockets.target
##
###
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=gitea
Group=gitea
WorkingDirectory=/var/lib/gitea/
# If using unix socket: Tells Systemd to create /run/gitea folder to home gitea.sock
# Manual creation would vanish after reboot.
#RuntimeDirectory=gitea
ExecStart=/usr/local/sbin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=gitea HOME=/home/gitea GITEA_WORK_DIR=/var/lib/gitea
# If you want to bind Gitea to a port below 1024, uncomment
# the two values below, or use socket activation to pass Gitea its ports as above
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
###
[Install]
WantedBy=multi-user.target
$ systemctl cat gitea.socket
# /etc/systemd/system/gitea.socket
# custom - 20191103 - rfischer: add the main socket for "gitea" for the unprivileged user "gitea" using the privileged port "80"
[Unit]
Description=Gitea Web Socket
PartOf=gitea.service
[Socket]
ListenStream=80
NoDelay=true
[Install]
WantedBy=sockets.target
$ < /etc/gitea/conf/app.ini
[oauth2]
JWT_SECRET = <secret_censored>
[security]
INTERNAL_TOKEN = <token_censored>
[server]
LOCAL_ROOT_URL = http://localhost:80/
Screenshots
None.
Metadata
Metadata
Assignees
Labels
No labels