2021-09-21 00:25:53 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD MODIFICATIONS
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2022-04-01 04:57:51 +02:00
|
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
2021-09-21 00:25:53 +02:00
|
|
|
|
2023-10-09 12:55:47 +02:00
|
|
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
2021-09-21 00:25:53 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY URL IN NGINX CONF
|
|
|
|
#=================================================
|
2022-04-01 04:57:51 +02:00
|
|
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
2021-09-21 00:25:53 +02:00
|
|
|
|
2023-10-09 12:14:47 +02:00
|
|
|
ynh_change_url_nginx_config
|
|
|
|
|
2021-09-21 00:25:53 +02:00
|
|
|
#=================================================
|
2021-11-14 16:53:08 +01:00
|
|
|
# UPDATING A CONFIGURATION
|
2021-09-21 00:25:53 +02:00
|
|
|
#=================================================
|
2022-04-01 04:57:51 +02:00
|
|
|
ynh_script_progression --message="Updating the configuration file..." --weight=1
|
2021-11-14 16:53:08 +01:00
|
|
|
|
2023-10-09 12:14:47 +02:00
|
|
|
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
|
2021-11-14 16:53:08 +01:00
|
|
|
|
2023-10-09 12:14:47 +02:00
|
|
|
chmod 400 "$install_dir/.env"
|
|
|
|
chown $app:$app "$install_dir/.env"
|
2021-11-14 16:53:08 +01:00
|
|
|
|
2021-11-15 03:47:03 +01:00
|
|
|
#=================================================
|
|
|
|
# RUN DB MIGRATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Running DB initial migration..." --weight=3
|
|
|
|
|
2023-10-09 12:14:47 +02:00
|
|
|
pushd "$install_dir"
|
2021-11-15 03:47:03 +01:00
|
|
|
ynh_use_nodejs
|
|
|
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate
|
|
|
|
popd
|
|
|
|
|
2021-09-21 00:25:53 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2022-04-01 04:57:51 +02:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
2021-09-21 00:25:53 +02:00
|
|
|
|
2023-10-09 12:55:47 +02:00
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
2021-09-21 00:25:53 +02:00
|
|
|
|
2021-11-15 04:26:29 +01:00
|
|
|
#=================================================
|
|
|
|
# SLACK WARNING
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info --message="Don't forget to add a new redirction url in your Slack app settings !"
|
|
|
|
|
|
|
|
|
2021-09-21 00:25:53 +02:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-04-01 04:57:51 +02:00
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|