2022-02-27 16:11:02 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
2022-03-02 17:05:24 +01:00
|
|
|
source ynh_redis
|
|
|
|
source ynh_uwsgi_service__2
|
2022-02-27 16:11:02 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Stopping a systemd service..."
|
|
|
|
|
2024-03-15 23:40:31 +01:00
|
|
|
for service in "${services[@]}"; do
|
|
|
|
ynh_systemd_action --service_name="${app}_${service}" --action="stop" --log_path="systemd"
|
|
|
|
done
|
2022-02-28 02:36:15 +01:00
|
|
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="stop" --log_path="systemd"
|
2022-02-27 16:11:02 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY URL IN NGINX CONF
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Updating NGINX web server configuration..."
|
|
|
|
|
2024-03-15 23:27:46 +01:00
|
|
|
ynh_change_url_nginx_config
|
|
|
|
|
2022-02-27 16:11:02 +01:00
|
|
|
#=================================================
|
|
|
|
# UPDATE A CONFIG FILE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Updating a configuration file..."
|
2022-03-02 22:28:57 +01:00
|
|
|
|
2024-03-15 23:40:31 +01:00
|
|
|
ynh_add_config --template="pagure.cfg.sample" --destination="$install_dir/pagure.cfg"
|
2022-02-27 16:11:02 +01:00
|
|
|
|
2024-03-15 23:27:46 +01:00
|
|
|
chmod 400 "$install_dir/pagure.cfg"
|
2024-03-15 23:40:31 +01:00
|
|
|
chown "$app:$app" "$install_dir/pagure.cfg"
|
2022-02-27 16:11:02 +01:00
|
|
|
|
2024-03-15 23:40:31 +01:00
|
|
|
ynh_add_config --template="pagure.wsgi" --destination="$install_dir/pagure.wsgi"
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_add_uwsgi_service --service="$app" --template="uwsgi.ini"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..."
|
|
|
|
|
|
|
|
# Start a systemd service
|
2024-03-15 23:40:31 +01:00
|
|
|
for service in "${services[@]}"; do
|
|
|
|
ynh_systemd_action --service_name="${app}_${service}" --action="start" --log_path="systemd" --line_match="ready"
|
|
|
|
done
|
2024-03-15 23:41:16 +01:00
|
|
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --log_path="systemd"
|
2022-02-27 16:11:02 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Change of URL completed for $app"
|