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 2021-08-09 16:29:31 +02:00
parent 37b2897e41
commit ab19da6e2b
No known key found for this signature in database
GPG key ID: 574F281483054D44
7 changed files with 45 additions and 58 deletions

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/NodeBB/NodeBB/archive/refs/tags/v1.17.1.tar.gz SOURCE_URL=https://github.com/NodeBB/NodeBB/archive/refs/tags/v1.17.2.tar.gz
SOURCE_SUM=4d9350b089e69ce078e855607305aa37bdc711dea7559534c9b7a9ac5aba55ec SOURCE_SUM=0c6267f8ec69ce82868e430fd059c239a9927d279cb9aac99c8722d9c22eee53
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -1,4 +1,5 @@
location / { location / {
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }

View file

@ -6,7 +6,7 @@
"en": "Nodejs Forum", "en": "Nodejs Forum",
"fr": "Forum écrit en nodejs" "fr": "Forum écrit en nodejs"
}, },
"version": "1.17.1~ynh1", "version": "1.17.2~ynh1",
"url": "https://nodebb.org/", "url": "https://nodebb.org/",
"upstream": { "upstream": {
"license": "GPL-3.0", "license": "GPL-3.0",

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1 ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -67,14 +67,14 @@ fi
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -100,25 +100,19 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 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
@ -126,4 +120,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app" --time --last ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -83,7 +83,7 @@ ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
ynh_script_progression --message="Configuring system user..." --weight=3 ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user # Create a system user
ynh_system_user_create --username=$app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -112,6 +112,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#ynh_setup_source --dest_dir="$final_path" #ynh_setup_source --dest_dir="$final_path"
git clone -b v1.17.x https://github.com/NodeBB/NodeBB.git "$final_path" --quiet git clone -b v1.17.x https://github.com/NodeBB/NodeBB.git "$final_path" --quiet
#git clone https://github.com/NodeBB/NodeBB.git "$final_path" --quiet #git clone https://github.com/NodeBB/NodeBB.git "$final_path" --quiet
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"

View file

@ -52,10 +52,18 @@ test ! -d $final_path \
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
@ -63,14 +71,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
@ -84,14 +84,18 @@ popd
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --log "/var/log/$app/APP.log" yunohost service add $app --description="Nodejs Forum" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# INSTALL NODEJS # INSTALL NODEJS
#================================================= #=================================================
ynh_install_nodejs $NODEJS_VERSION ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
@ -106,7 +110,7 @@ systemctl start $app
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 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
@ -114,4 +118,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --time --last ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -93,7 +93,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -107,6 +107,10 @@ then
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
fi fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -121,6 +125,8 @@ ynh_add_nginx_config
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -134,47 +140,28 @@ ynh_add_systemd_config
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
### Same as during install ynh_add_config --template="../conf/config.json" --destination="$final_path/config.json"
### chmod 400 "$final_path/config.json"
### The file will automatically be backed-up if it's found to be manually modified (because chown $app "$final_path/config.json"
### ynh_add_config keeps track of the file's checksum)
ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file"
### For more complex cases where you want to replace stuff using regexes,
### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
### When doing so, you also need to manually call ynh_store_file_checksum
###
### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/some_config_file"
### ynh_store_file_checksum --file="$final_path/some_config_file"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
chown -R root: $final_path
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" yunohost service add $app --description="Nodejs Forum" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 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
@ -182,4 +169,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --time --last ynh_script_progression --message="Upgrade of $app completed" --last