2023-04-03 21:32:47 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
2023-04-13 19:51:18 +02:00
|
|
|
admin=$(ynh_user_get_info --username=$admin --key=username)
|
|
|
|
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
2023-04-03 21:32:47 +02:00
|
|
|
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_app_setting_set_default --key=weather_api_provider --value=$weather_provider
|
2024-02-24 10:32:45 +01:00
|
|
|
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_app_setting_set_default --key=weather_api_key --value=$weather_key
|
2024-02-24 10:32:45 +01:00
|
|
|
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_app_setting_set_default --key=redis_db --value=$(ynh_redis_get_free_db)
|
2024-02-24 10:32:45 +01:00
|
|
|
|
2023-04-03 21:32:47 +02:00
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_script_progression "Stopping $app's systemd service..."
|
|
|
|
|
|
|
|
ynh_systemctl --action="stop" --service="${app}"
|
2023-04-03 21:32:47 +02:00
|
|
|
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_systemctl --action="stop" --service="${app}_workers"
|
2023-04-03 21:32:47 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY URL IN NGINX CONF
|
|
|
|
#=================================================
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_script_progression "Updating NGINX web server configuration..."
|
2023-04-03 21:32:47 +02:00
|
|
|
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_config_change_url_nginx
|
2023-04-03 21:32:47 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY THE CONFIG FILE
|
|
|
|
#=================================================
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_script_progression "Updating configuration..."
|
2023-04-03 21:32:47 +02:00
|
|
|
|
2023-09-14 19:16:04 +02:00
|
|
|
domain=$new_domain
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_config_add --template=".env.production" --destination="$install_dir/.env"
|
2023-04-03 21:32:47 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_script_progression "Starting the systemd services..."
|
2023-04-03 21:32:47 +02:00
|
|
|
|
|
|
|
# Start a systemd service
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_systemctl --service="${app}" --action="start"
|
|
|
|
|
|
|
|
ynh_systemctl --service="${app}_workers" --action="start"
|
2023-04-03 21:32:47 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-06-23 08:56:30 +02:00
|
|
|
ynh_script_progression "Upgrade of $app completed"
|