diff --git a/conf/systemd.service b/conf/systemd.service index 40d306e..63b460e 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ Environment=NODE_ENV=production -Environment=DOTENV_CONFIG_PATH=__INSTALL_DIR__/etc/facilmap.env +Environment=DOTENV_CONFIG_PATH=__INSTALL_DIR__/config.env Environment="__YNH_NODE_LOAD_PATH__" #ExecStart=__INSTALL_DIR__/bin/facilmap-server WorkingDirectory=__INSTALL_DIR__/server diff --git a/scripts/install b/scripts/install index 142c9fc..070b177 100755 --- a/scripts/install +++ b/scripts/install @@ -53,11 +53,10 @@ chown -R "$app:www-data" "$install_dir" #================================================= ynh_script_progression --message="Adding configuration..." --weight=2 -mkdir -p "$install_dir/etc" -ynh_add_config --template="config.env" --destination="$install_dir/etc/facilmap.env" +ynh_add_config --template="config.env" --destination="$install_dir/config.env" -chown -R "$app:www-data" "$install_dir/etc" -chmod 400 "$install_dir/etc/facilmap.env" +chown -R "$app:www-data" "$install_dir/config.env" +chmod 400 "$install_dir/config.env" #================================================= # SYSTEM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 7c404d7..aeda32f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,15 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 + +ynh_setup_source --dest_dir="$install_dir" + +chown -R "$app:www-data" "$install_dir" + #================================================= # SPECIFIC UPGRADE #================================================= @@ -32,8 +41,9 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= ynh_script_progression --message="Install $app..." --weight=20 -pushd $install_dir - ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install --prefix "$install_dir" -g facilmap-server@"$facilmap_version" 2>/dev/null +pushd "$install_dir" + ynh_exec_warn_less env $ynh_node_load_PATH yarn install + ynh_exec_warn_less env $ynh_node_load_PATH yarn build popd chmod 750 "$install_dir" @@ -45,11 +55,10 @@ chown -R "$app:www-data" "$install_dir" #================================================= ynh_script_progression --message="Updating config files..." --weight=2 -mkdir -p "$install_dir/etc" -ynh_add_config --template="config.env" --destination="$install_dir/etc/facilmap.env" +ynh_add_config --template="config.env" --destination="$install_dir/config.env" -chown -R "$app:www-data" "$install_dir/etc" -chmod 400 "$install_dir/etc/facilmap.env" +chown -R "$app:www-data" "$install_dir/config.env" +chmod 400 "$install_dir/config.env" #================================================= # GENERIC FINALIZATION @@ -77,6 +86,7 @@ yunohost service add "$app" --description="Collaborative maps and routing" --log # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append +s #================================================= # START SYSTEMD SERVICE #=================================================