1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ffsync_ynh.git synced 2024-09-03 18:26:38 +02:00

Symplify nginx config and standardize start systemd action

This commit is contained in:
Josué Tille 2020-12-07 16:26:56 +01:00
parent d04aba1b4c
commit 0174f92354
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
4 changed files with 25 additions and 20 deletions

View file

@ -12,7 +12,7 @@ location __PATH__/ {
include uwsgi_params;
# Needed for long running operations in admin interface
uwsgi_read_timeout 3600;
uwsgi_param SCRIPT_NAME __PATH__;
uwsgi_modifier1 30;
__IS_SUBPATH__uwsgi_param SCRIPT_NAME __PATH__;
__IS_SUBPATH__uwsgi_modifier1 30;
uwsgi_pass unix:///run/__NAME__/app.socket;
}

View file

@ -81,17 +81,15 @@ install_sources
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring nginx"
ynh_add_nginx_config
if [ "$path_url" == "/" ]
then
# $finalnginxconf comes from ynh_add_nginx_config
# uwsgi_param is only needed for non-root installation
ynh_replace_string --match_string "uwsgi_param " --replace_string "#uwsgi_param " --target_file "$finalnginxconf"
ynh_replace_string --match_string "uwsgi_modifier1 " --replace_string "#uwsgi_modifier1 " --target_file "$finalnginxconf"
is_subpath="# "
else
is_subpath=" "
fi
ynh_store_file_checksum --file "$finalnginxconf"
systemctl reload nginx
ynh_add_nginx_config 'is_subpath'
#=================================================
# CREATE DEDICATED USER
@ -138,12 +136,15 @@ ynh_script_progression --message="Configuring permissions"
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
#=================================================
# RELOAD NGINX
# RELOAD Services
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_script_progression --message="Restart services..."
ynh_systemd_action --service_name=nginx --action=reload
ynh_script_progression --message="Starting $app services..." --weight=3
ynh_systemd_action --service_name "uwsgi-app@$app.service" \
--line_match "WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -94,7 +94,9 @@ systemctl enable "uwsgi-app@$app" --quiet
# RELOAD NGINX AND UWSGI
#=================================================
systemctl start "uwsgi-app@$app"
systemctl reload nginx
ynh_script_progression --message="Starting pgadmin services..." --weight=3
ynh_systemd_action --service_name "uwsgi-app@$app.service" \
--line_match "WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/$app.log"
ynh_systemd_action --service_name=nginx --action=reload
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -110,18 +110,16 @@ install_sources
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring nginx..."
ynh_add_nginx_config
ynh_script_progression --message="Configuring nginx"
if [ "$path_url" == "/" ]
then
# $finalnginxconf comes from ynh_add_nginx_config
# uwsgi_param is only needed for non-root installation
ynh_replace_string "uwsgi_param " "#uwsgi_param " "$finalnginxconf"
ynh_replace_string "uwsgi_modifier1 " "#uwsgi_modifier1 " "$finalnginxconf"
is_subpath="# "
else
is_subpath=" "
fi
ynh_store_file_checksum --file "$finalnginxconf"
systemctl reload nginx
ynh_add_nginx_config 'is_subpath'
#=================================================
# CREATE DEDICATED USER
@ -162,6 +160,10 @@ set_permissions
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
ynh_script_progression --message="Restarting $app services..." --weight=3
ynh_systemd_action --service_name "uwsgi-app@$app.service" \
--line_match "WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================