build_gitea: fix: missing dependency(Alpine), init.d / nginx_build_script: add: init.d
This commit is contained in:
parent
9a47f97982
commit
6510607877
@ -86,7 +86,7 @@ DISTRO=linux-x64
|
||||
|
||||
case $os in
|
||||
"alpine")
|
||||
apk add nodejs # NodeJS broken when install from binary
|
||||
apk add nodejs npm # NodeJS broken when install from binary
|
||||
;;
|
||||
* )
|
||||
wget https://nodejs.org/dist/$NODEJS_VERSION/node-$NODEJS_VERSION-$DISTRO.tar.xz -O $DESTINATION/node-$NODEJS_VERSION-$DISTRO.tar.xz
|
||||
|
32
build_gitea/Linux/init.d/gitea.initd
Normal file
32
build_gitea/Linux/init.d/gitea.initd
Normal file
@ -0,0 +1,32 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
supervisor=supervise-daemon
|
||||
name=gitea
|
||||
command="/usr/bin/gitea"
|
||||
command_user="${GITEA_USER:-gitea}"
|
||||
command_args="web --config '${GITEA_CONF:-/etc/gitea/app.ini}'"
|
||||
supervise_daemon_args="--env GITEA_WORK_DIR='${GITEA_WORK_DIR:-/var/lib/gitea}' --chdir '${GITEA_WORK_DIR:-/var/lib/gitea}' --stdout '${GITEA_LOG_FILE:-/var/log/gitea/http.log}' --stderr '${GITEA_LOG_FILE:-/var/log/gitea/http.log}'"
|
||||
pidfile="/run/gitea.pid"
|
||||
extra_started_commands="reopen_log"
|
||||
capabilities="^cap_net_bind_service"
|
||||
|
||||
depend() {
|
||||
use logger dns
|
||||
need net
|
||||
after firewall mysql postgresql
|
||||
}
|
||||
|
||||
#https://github.com/go-gitea/gitea/issues/17976
|
||||
#reload() {
|
||||
# ebegin "Reloading ${RC_SVCNAME}"
|
||||
# ${supervisor} ${RC_SVCNAME} --signal HUP --pidfile "${pidfile}"
|
||||
# eend $?
|
||||
#}
|
||||
|
||||
reopen_log() {
|
||||
ebegin "Reopening logfile for ${RC_SVCNAME}"
|
||||
${supervisor} ${RC_SVCNAME} --signal USR1 --pidfile "${pidfile}"
|
||||
eend $?
|
||||
}
|
||||
|
||||
# Taken from https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/gitea/gitea.initd
|
@ -118,3 +118,81 @@ KillMode=mixed
|
||||
WantedBy=multi-user.target
|
||||
|
||||
```
|
||||
|
||||
Nginx init.d
|
||||
|
||||
```initd
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Nginx http and reverse proxy server"
|
||||
extra_commands="checkconfig"
|
||||
extra_started_commands="reload reopen upgrade"
|
||||
|
||||
cfgfile=${cfgfile:-/etc/nginx/nginx.conf}
|
||||
pidfile=/run/nginx.pid
|
||||
command=${command:-/usr/sbin/nginx}
|
||||
command_args="-c $cfgfile"
|
||||
required_files="$cfgfile"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use dns logger netmount
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath --directory --owner www-data:www-data ${pidfile%/*}
|
||||
$command $command_args -t -q
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
ebegin "Checking $RC_SVCNAME configuration"
|
||||
start_pre
|
||||
eend $?
|
||||
}
|
||||
|
||||
reload() {
|
||||
ebegin "Reloading $RC_SVCNAME configuration"
|
||||
start_pre && start-stop-daemon --signal HUP --pidfile $pidfile
|
||||
eend $?
|
||||
}
|
||||
|
||||
reopen() {
|
||||
ebegin "Reopening $RC_SVCNAME log files"
|
||||
start-stop-daemon --signal USR1 --pidfile $pidfile
|
||||
eend $?
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
start_pre || return 1
|
||||
|
||||
ebegin "Upgrading $RC_SVCNAME binary"
|
||||
|
||||
einfo "Sending USR2 to old binary"
|
||||
start-stop-daemon --signal USR2 --pidfile $pidfile
|
||||
|
||||
einfo "Sleeping 3 seconds before pid-files checking"
|
||||
sleep 3
|
||||
|
||||
if [ ! -f $pidfile.oldbin ]; then
|
||||
eerror "File with old pid ($pidfile.oldbin) not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -f $pidfile ]; then
|
||||
eerror "New binary failed to start"
|
||||
return 1
|
||||
fi
|
||||
|
||||
einfo "Sleeping 3 seconds before WINCH"
|
||||
sleep 3 ; start-stop-daemon --signal 28 --pidfile $pidfile.oldbin
|
||||
|
||||
einfo "Sending QUIT to old binary"
|
||||
start-stop-daemon --signal QUIT --pidfile $pidfile.oldbin
|
||||
|
||||
einfo "Upgrade completed"
|
||||
|
||||
eend $? "Upgrade failed"
|
||||
}
|
||||
|
||||
modified from https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/nginx/nginx.initd
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user