1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nodebb_ynh.git synced 2024-09-03 19:46:29 +02:00
This commit is contained in:
ericgaspar 2024-04-14 18:18:35 +02:00
parent 95b03ec867
commit f49b5e40e7
5 changed files with 16 additions and 92 deletions

View file

@ -5,7 +5,7 @@ name = "NodeBB"
description.en = "Forum software built for the modern web" description.en = "Forum software built for the modern web"
description.fr = "Logiciel de forum conçu pour le Web moderne" description.fr = "Logiciel de forum conçu pour le Web moderne"
version = "3.5.0~ynh1" version = "3.7.3~ynh1"
maintainers = [""] maintainers = [""]

View file

@ -57,7 +57,7 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Configuring the app..." --weight=2 ynh_script_progression --message="Configuring the app..." --weight=2
ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" ynh_add_config --template="config.json" --destination="$install_dir/config.json"
setup="{ setup="{
\"admin:username\": \"$admin\", \"admin:username\": \"$admin\",
@ -84,21 +84,9 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Forum software" --log="/var/log/$app/$app.log" yunohost service add $app --description="Forum software" --log="/var/log/$app/$app.log"
#================================================= #=================================================

View file

@ -22,35 +22,15 @@ then
yunohost service remove $app yunohost service remove $app
fi fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_nodejs ynh_remove_nodejs

View file

@ -10,15 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
@ -51,14 +42,11 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#================================================= #=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Forum software" --log="/var/log/$app/$app.log" yunohost service add $app --description="Forum software" --log="/var/log/$app/$app.log"
#================================================= #=================================================
@ -68,13 +56,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================

View file

@ -11,12 +11,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -29,23 +23,19 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ] pushd $install_dir
then ynh_use_nodejs
ynh_script_progression --message="Upgrading source files..." --weight=1 # Shut down your forum
git config --system --add safe.directory $install_dir
pushd $install_dir ynh_exec_as $app env "$ynh_node_load_PATH" $install_dir/nodebb stop
ynh_use_nodejs # Grab the latest and greatest code
# Shut down your forum git fetch # Grab the latest code from the NodeBB Repository
git config --system --add safe.directory $install_dir git reset --hard origin/$nodebb_version # Replace v1.12.x with the branch name!
ynh_exec_as $app env "$ynh_node_load_PATH" $install_dir/nodebb stop # Run the NodeBB upgrade script
# Grab the latest and greatest code ynh_exec_as $app $ynh_node_load_PATH $install_dir/nodebb upgrade 2>/dev/null
git fetch # Grab the latest code from the NodeBB Repository popd
git reset --hard origin/$nodebb_version # Replace v1.12.x with the branch name!
# Run the NodeBB upgrade script
ynh_exec_as $app $ynh_node_load_PATH $install_dir/nodebb upgrade 2>/dev/null
popd
fi
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"
@ -58,27 +48,12 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
# Install Nodejs # Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Forum software" --log="/var/log/$app/$app.log" yunohost service add $app --description="Forum software" --log="/var/log/$app/$app.log"
#================================================= #=================================================