mirror of
https://github.com/YunoHost-Apps/ffsync_ynh.git
synced 2024-09-03 18:26:38 +02:00
Remove start service by the socket
This commit is contained in:
parent
ad64328a68
commit
c8b399afaa
7 changed files with 8 additions and 23 deletions
|
@ -13,5 +13,5 @@ location __PATH__/ {
|
||||||
uwsgi_read_timeout 3600;
|
uwsgi_read_timeout 3600;
|
||||||
uwsgi_param SCRIPT_NAME __PATH__;
|
uwsgi_param SCRIPT_NAME __PATH__;
|
||||||
uwsgi_modifier1 30;
|
uwsgi_modifier1 30;
|
||||||
uwsgi_pass unix:///var/run/uwsgi/__NAME__.socket;
|
uwsgi_pass unix:///var/run/__NAME__/app.socket;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=%i uWSGI app
|
Description=%i uWSGI app
|
||||||
After=syslog.target
|
After=syslog.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
RuntimeDirectory=%i
|
||||||
ExecStart=/usr/bin/uwsgi \
|
ExecStart=/usr/bin/uwsgi \
|
||||||
--ini /etc/uwsgi/apps-available/%i.ini \
|
--ini /etc/uwsgi/apps-available/%i.ini \
|
||||||
--socket /var/run/uwsgi/%i.socket \
|
--socket /var/run/%i/app.socket \
|
||||||
--logto /var/log/uwsgi/%i/%i.log
|
--logto /var/log/uwsgi/%i/%i.log
|
||||||
User=%i
|
User=%i
|
||||||
Group=www-data
|
Group=www-data
|
||||||
|
@ -15,3 +15,6 @@ KillSignal=SIGQUIT
|
||||||
Type=notify
|
Type=notify
|
||||||
StandardError=syslog
|
StandardError=syslog
|
||||||
NotifyAccess=all
|
NotifyAccess=all
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Socket for uWSGI app %i
|
|
||||||
|
|
||||||
[Socket]
|
|
||||||
ListenStream=/var/run/uwsgi/%i.socket
|
|
||||||
SocketUser=%i
|
|
||||||
SocketGroup=www-data
|
|
||||||
SocketMode=0775
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=sockets.target
|
|
|
@ -2,7 +2,8 @@
|
||||||
plugins = python
|
plugins = python
|
||||||
master = true
|
master = true
|
||||||
protocol = uwsgi
|
protocol = uwsgi
|
||||||
socket = /var/run/uwsgi/__APP__.socket
|
socket = /var/run/__APP__/app.socket
|
||||||
|
chmod-socket = 660
|
||||||
virtualenv = __FINALPATH__/local
|
virtualenv = __FINALPATH__/local
|
||||||
wsgi-file = __FINALPATH__/syncserver.wsgi
|
wsgi-file = __FINALPATH__/syncserver.wsgi
|
||||||
python-path = __FINALPATH__/local
|
python-path = __FINALPATH__/local
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
ynh_check_global_uwsgi_config () {
|
ynh_check_global_uwsgi_config () {
|
||||||
uwsgi --version || ynh_die "You need to add uwsgi (and appropriate plugin) as a dependency"
|
uwsgi --version || ynh_die "You need to add uwsgi (and appropriate plugin) as a dependency"
|
||||||
|
|
||||||
cp ../conf/uwsgi-app@.socket /etc/systemd/system/uwsgi-app@.socket
|
|
||||||
cp ../conf/uwsgi-app@.service /etc/systemd/system/uwsgi-app@.service
|
cp ../conf/uwsgi-app@.service /etc/systemd/system/uwsgi-app@.service
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a dedicated uwsgi ini file to use with generic uwsgi service
|
# Create a dedicated uwsgi ini file to use with generic uwsgi service
|
||||||
# It will install generic uwsgi.socket and
|
|
||||||
#
|
#
|
||||||
# This will use a template in ../conf/uwsgi.ini
|
# This will use a template in ../conf/uwsgi.ini
|
||||||
# and will replace the following keywords with
|
# and will replace the following keywords with
|
||||||
|
@ -74,8 +72,6 @@ ynh_add_uwsgi_service () {
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl stop "uwsgi-app@$app.service"
|
systemctl stop "uwsgi-app@$app.service"
|
||||||
systemctl enable "uwsgi-app@$app.socket"
|
|
||||||
systemctl restart "uwsgi-app@$app.socket"
|
|
||||||
systemctl enable "uwsgi-app@$app.service"
|
systemctl enable "uwsgi-app@$app.service"
|
||||||
systemctl start "uwsgi-app@$app.service"
|
systemctl start "uwsgi-app@$app.service"
|
||||||
|
|
||||||
|
@ -89,8 +85,6 @@ ynh_add_uwsgi_service () {
|
||||||
ynh_remove_uwsgi_service () {
|
ynh_remove_uwsgi_service () {
|
||||||
local finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
local finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
||||||
if [ -e "$finaluwsgiini" ]; then
|
if [ -e "$finaluwsgiini" ]; then
|
||||||
systemctl stop "uwsgi-app@$app.socket"
|
|
||||||
systemctl disable "uwsgi-app@$app.socket"
|
|
||||||
systemctl stop "uwsgi-app@$app.service"
|
systemctl stop "uwsgi-app@$app.service"
|
||||||
systemctl disable "uwsgi-app@$app.service"
|
systemctl disable "uwsgi-app@$app.service"
|
||||||
yunohost service remove "uwsgi-app@$app"
|
yunohost service remove "uwsgi-app@$app"
|
||||||
|
|
|
@ -60,4 +60,3 @@ ynh_backup "/var/log/uwsgi/$app"
|
||||||
|
|
||||||
ynh_backup "/etc/uwsgi/apps-available/$app.ini"
|
ynh_backup "/etc/uwsgi/apps-available/$app.ini"
|
||||||
ynh_backup "/etc/systemd/system/uwsgi-app@.service"
|
ynh_backup "/etc/systemd/system/uwsgi-app@.service"
|
||||||
ynh_backup "/etc/systemd/system/uwsgi-app@.socket"
|
|
||||||
|
|
|
@ -101,6 +101,5 @@ yunohost service add "uwsgi-app@$app.service" --log "/var/log/uwsgi/app/$app"
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl start "uwsgi-app@$app.socket"
|
|
||||||
systemctl start "uwsgi-app@$app.service"
|
systemctl start "uwsgi-app@$app.service"
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
Loading…
Reference in a new issue