2021-09-21 00:25:53 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2023-10-09 12:14:47 +02:00
|
|
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
|
|
|
|
|
|
#REMOVEME? utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret)
|
|
|
|
#REMOVEME? dex_app=$(ynh_app_setting_get --app=$app --key=dex_app)
|
|
|
|
#REMOVEME? dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain)
|
|
|
|
#REMOVEME? dex_path=$(ynh_app_setting_get --app=$app --key=dex_path)
|
|
|
|
#REMOVEME? oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret)
|
|
|
|
#REMOVEME? oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name)
|
|
|
|
#REMOVEME? oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback)
|
|
|
|
#REMOVEME? dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri)
|
|
|
|
#REMOVEME? dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri)
|
|
|
|
#REMOVEME? dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri)
|
2021-09-21 00:25:53 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# 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
|