1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wikijs_ynh.git synced 2024-09-03 20:36:09 +02:00

Apply example_ynh

This commit is contained in:
yalh76 2019-12-27 23:53:20 +01:00
parent c47503c6ac
commit 0ab7d76234
7 changed files with 46 additions and 29 deletions

View file

@ -43,7 +43,6 @@ The app can be used by multiple users
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/wikijs%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/wikijs/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/wikijs%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/wikijs/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/wikijs%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/wikijs/)
## Limitations

View file

@ -38,7 +38,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#=================================================
ynh_print_info --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped wikijs service"
#=================================================
# BACKUP THE APP MAIN DIR
@ -70,6 +70,13 @@ ynh_print_info --message="Backing up systemd configuration..."
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server: [ RUNNING ]"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -35,6 +35,23 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before changing its url (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
@ -58,7 +75,7 @@ fi
#=================================================
ynh_print_info --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped wikijs service"
#=================================================
# MODIFY URL IN NGINX CONF
@ -96,7 +113,7 @@ fi
#=================================================
ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server: [ RUNNING ]"
#=================================================
# RELOAD NGINX

View file

@ -108,7 +108,7 @@ ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info --message="Configuring system user ..."
ynh_print_info --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
@ -138,16 +138,16 @@ ynh_add_systemd_config
config_file="$final_path/config.yml"
cp -f ../conf/config.sample.yml $config_file
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=$config_file
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file=$config_file
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file=$config_file
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_file"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config_file"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file=$config_file
ynh_store_file_checksum --file="$config_file"
#=================================================
# GENERIC FINALIZATION
@ -159,19 +159,17 @@ ynh_store_file_checksum --file=$config_file
chown -R "$app":"$app" "$final_path"
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
yunohost service add $app --description "$app daemon for Wiki.js" -t systemd
yunohost service add $app --description "$app daemon for Wiki.js" --log_type systemd
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_systemd_action --service_name=$app --action=start --line_match="Browse to http://localhost" --log_path=systemd
sleep 30
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server: [ RUNNING ]"
#=================================================
# SETUP SSOWAT

View file

@ -27,10 +27,10 @@ ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_print_info --message="Removing $app service..."

View file

@ -106,19 +106,17 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
yunohost service add $app --description "$app daemon for Wiki.js" -t systemd
yunohost service add $app --description "$app daemon for Wiki.js" --log_type systemd
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
sleep 30
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server: [ RUNNING ]"
#=================================================
# CREATE LDAP USER

View file

@ -101,7 +101,7 @@ ynh_abort_if_errors
#=================================================
ynh_print_info --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped wikijs service"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -150,16 +150,16 @@ config_file="$final_path/config.yml"
ynh_backup_if_checksum_is_different --file=$config_file
cp -f ../conf/config.sample.yml $config_file
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=$config_file
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file=$config_file
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file=$config_file
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_file"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config_file"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file=$config_file
ynh_store_file_checksum --file="$config_file"
#=================================================
# SETUP SYSTEMD
@ -196,9 +196,7 @@ fi
#=================================================
ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd
sleep 30
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server: [ RUNNING ]"
#=================================================
# RELOAD NGINX