1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/peertube_ynh.git synced 2024-09-03 19:56:29 +02:00

Fix ynh_systemd_action

This commit is contained in:
yalh76 2019-04-03 06:24:02 +02:00
parent c2b127eda7
commit 4c8cac74ee
5 changed files with 26 additions and 12 deletions

View file

@ -35,6 +35,7 @@ db_name=$(ynh_app_setting_get "$app" psql_db)
#=================================================
# STOP PEERTUBE FOR BACKUP
#=================================================
ynh_print_info "Stop $app service..."
ynh_systemd_action --service_name="$app" --action="stop"
@ -80,8 +81,9 @@ ynh_backup "/etc/systemd/system/$app.service"
#=================================================
# START PEERTUBE
#=================================================
ynh_print_info "Start $app service..."
ynh_systemd_action --service_name="$app" --action="start"
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Server listening on localhost:9000"
#=================================================
# END OF SCRIPT

View file

@ -16,6 +16,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
read-p "key"
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
@ -91,7 +92,7 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
#=================================================
ynh_print_info "Creating a PostgreSQL database..."
db_name=$(ynh_sanitize_dbid $app)
db_name="peertube_${app}"
db_pwd=$(ynh_string_random 30)
ynh_app_setting_set "$app" psql_db "$db_name"
ynh_app_setting_set "$app" psqlpwd "$db_pwd"
@ -107,6 +108,7 @@ CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS pg_trgm;"
#=================================================
ynh_print_info "Setting up source files..."
ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
@ -186,10 +188,6 @@ ynh_add_systemd_config
# SECURE FILES AND DIRECTORIES
#=================================================
### For security reason, any app should set the permissions to root: before anything else.
### Then, if write authorization is needed, any access should be given only to directories
### that really need such authorization.
# Set permissions to app files
chown -R "$app":"$app" $final_path
@ -230,9 +228,9 @@ systemctl reload nginx
#=================================================
# START SERVICE
#=================================================
ynh_print_info "Start service..."
ynh_print_info "Start $app service..."
ynh_systemd_action --service_name="$app" --action="start"
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Server listening on localhost:9000"
#=================================================
# CHANGE PEERTUBE ADMIN PASSWORD AFTER INITIAL GEN

View file

@ -47,6 +47,9 @@ ynh_remove_systemd_config
#=================================================
ynh_print_info "Removing the PostgreSQL database"
ynh_psql_execute_as_root "\connect $db_name
SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$db_name';"
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db "$db_name" "$app"

View file

@ -144,9 +144,9 @@ systemctl reload nginx
#=================================================
# START SERVICE
#=================================================
ynh_print_info "Start service..."
ynh_print_info "Start $app service..."
ynh_systemd_action --service_name="$app" --action="start"
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Server listening on localhost:9000"
#=================================================
# END OF SCRIPT

View file

@ -70,6 +70,7 @@ ynh_abort_if_errors
#=================================================
# STOP PEERTUBE FOR UPGRADE
#=================================================
ynh_print_info "Stop $app service..."
ynh_systemd_action --service_name="$app" --action="stop"
@ -106,7 +107,17 @@ ynh_print_info "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
#=================================================
# MODIFY A CONFIG FILE
#=================================================
cp ../conf/production.yaml "$final_path/config/production.yaml"
ynh_replace_string "__domain__" "$domain" "$final_path/config/production.yaml"
ynh_replace_string "__db_name__" "$app" "$final_path/config/production.yaml"
ynh_replace_string "__app__" "$app" "$final_path/config/production.yaml"
ynh_replace_string "__db_pwd__" "$db_pwd" "$final_path/config/production.yaml"
ynh_replace_string "__email__" "$admin_email" "$final_path/config/production.yaml"
ynh_replace_string "__PORT__" "$port" "$final_path/config/production.yaml"
#Copy the admin saved settings from tmp directory to final path
cp -a "$tmpdir/local-production.json" "$final_path/config/local-production.json"
@ -214,9 +225,9 @@ systemctl reload nginx
#=================================================
# START SERVICE
#=================================================
ynh_print_info "Start service..."
ynh_print_info "Start $app service..."
ynh_systemd_action --service_name="$app" --action="start"
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Server listening on localhost:9000"
#=================================================
# END OF SCRIPT