1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bonfire_ynh.git synced 2024-09-03 18:16:01 +02:00

build again on upgrade

This commit is contained in:
lapineige 2024-01-21 14:20:26 +01:00 committed by GitHub
parent c8f1fe98a0
commit af47664bbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,13 @@ source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
#=================================================
@ -27,24 +34,54 @@ fi
chown -R $app:www-data "$install_dir"
=================================================
# Building the release
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_add_nginx_config
ynh_script_progression --message="Building Bonfire release... (This will take a long time)" --weight=1
export TERM=linux # why is that not defined ?
export TERMINFO=/etc/terminfo
### DONT USE GLOBAL NPM INSTALL
ynh_replace_string --match_string="npm install --global" --replace_string="npm install" --target_file="$install_dir/justfile"
ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just rel-build"
#=================================================
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
#=================================================
# UPDATE A CONFIG FILE
#=================================================
#ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_script_progression --message="Updating a configuration file... (this will remove any manual change you could have made before)" --weight=1
#ynh_add_config --template="some_config_file" --destination="$install_dir/some_config_file"
ynh_add_config --template=".env" --destination="$install_dir/.env"
#chmod 400 "$install_dir/some_config_file"
#chown $app:$app "$install_dir/some_config_file"
chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS + Run the service
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
mkdir -p "/var/log/$app"
chown -R $app:$app "/var/log/$app"
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="Bonfire daemon" --log="/var/log/$app/$app.log"
ynh_script_progression --message="Starting Bonfire daemon service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT