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:
parent
d04aba1b4c
commit
0174f92354
4 changed files with 25 additions and 20 deletions
|
@ -12,7 +12,7 @@ location __PATH__/ {
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
# Needed for long running operations in admin interface
|
# Needed for long running operations in admin interface
|
||||||
uwsgi_read_timeout 3600;
|
uwsgi_read_timeout 3600;
|
||||||
uwsgi_param SCRIPT_NAME __PATH__;
|
__IS_SUBPATH__uwsgi_param SCRIPT_NAME __PATH__;
|
||||||
uwsgi_modifier1 30;
|
__IS_SUBPATH__uwsgi_modifier1 30;
|
||||||
uwsgi_pass unix:///run/__NAME__/app.socket;
|
uwsgi_pass unix:///run/__NAME__/app.socket;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,17 +81,15 @@ install_sources
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring nginx"
|
ynh_script_progression --message="Configuring nginx"
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
if [ "$path_url" == "/" ]
|
if [ "$path_url" == "/" ]
|
||||||
then
|
then
|
||||||
# $finalnginxconf comes from ynh_add_nginx_config
|
# $finalnginxconf comes from ynh_add_nginx_config
|
||||||
# uwsgi_param is only needed for non-root installation
|
# uwsgi_param is only needed for non-root installation
|
||||||
ynh_replace_string --match_string "uwsgi_param " --replace_string "#uwsgi_param " --target_file "$finalnginxconf"
|
is_subpath="# "
|
||||||
ynh_replace_string --match_string "uwsgi_modifier1 " --replace_string "#uwsgi_modifier1 " --target_file "$finalnginxconf"
|
else
|
||||||
|
is_subpath=" "
|
||||||
fi
|
fi
|
||||||
ynh_store_file_checksum --file "$finalnginxconf"
|
ynh_add_nginx_config 'is_subpath'
|
||||||
systemctl reload nginx
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -138,12 +136,15 @@ ynh_script_progression --message="Configuring permissions"
|
||||||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
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_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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -94,7 +94,9 @@ systemctl enable "uwsgi-app@$app" --quiet
|
||||||
# RELOAD NGINX AND UWSGI
|
# RELOAD NGINX AND UWSGI
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl start "uwsgi-app@$app"
|
ynh_script_progression --message="Starting pgadmin services..." --weight=3
|
||||||
systemctl reload nginx
|
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
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
|
@ -110,18 +110,16 @@ install_sources
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring nginx..."
|
ynh_script_progression --message="Configuring nginx"
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
if [ "$path_url" == "/" ]
|
if [ "$path_url" == "/" ]
|
||||||
then
|
then
|
||||||
# $finalnginxconf comes from ynh_add_nginx_config
|
# $finalnginxconf comes from ynh_add_nginx_config
|
||||||
# uwsgi_param is only needed for non-root installation
|
# uwsgi_param is only needed for non-root installation
|
||||||
ynh_replace_string "uwsgi_param " "#uwsgi_param " "$finalnginxconf"
|
is_subpath="# "
|
||||||
ynh_replace_string "uwsgi_modifier1 " "#uwsgi_modifier1 " "$finalnginxconf"
|
else
|
||||||
|
is_subpath=" "
|
||||||
fi
|
fi
|
||||||
ynh_store_file_checksum --file "$finalnginxconf"
|
ynh_add_nginx_config 'is_subpath'
|
||||||
systemctl reload nginx
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -162,6 +160,10 @@ set_permissions
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue