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

@@ -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