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

update to last example_ynh

This commit is contained in:
yalh76 2019-02-10 15:54:37 +01:00
parent 027773843d
commit 8045091cb5
6 changed files with 39 additions and 25 deletions

View file

@ -7,8 +7,9 @@
; Manifest
domain="domain.tld" (DOMAIN)
admin="john" (USER)
password="pass"
is_public=1 (PUBLIC|public=1|private=0)
password="pass"
single_user="true"
site_name="WriteFreely"
site_description="WriteFreely Blogs"
@ -29,7 +30,7 @@
backup_restore=1
multi_instance=1
incorrect_path=1
port_already_use=1
port_already_use=0
change_url=0
;;; Levels
Level 1=auto

View file

@ -59,7 +59,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
#ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
#ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE

View file

@ -73,6 +73,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_print_info "Validating arguments ..."
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
@ -89,6 +90,7 @@ ynh_webpath_register $app $domain $path_url
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_print_info "Starting example app installation ..."
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app admin $admin
@ -115,6 +117,7 @@ ynh_app_setting_set $app local_timeline $local_timeline
### If you're not using these lines:
### - Remove the section "CLOSE A PORT" in the remove script
ynh_print_info "Configuring firewall ..."
# Find a free port
port=$(ynh_find_port 8095)
# Open this port
@ -132,6 +135,7 @@ ynh_app_setting_set $app port $port
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
ynh_print_info "Installing dependencies ..."
#ynh_install_app_dependencies deb1 deb2
#=================================================
@ -147,6 +151,7 @@ ynh_app_setting_set $app port $port
### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
ynh_print_info "Initializing database ..."
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
ynh_mysql_setup_db $db_name $db_name
@ -159,6 +164,7 @@ ynh_mysql_setup_db $db_name $db_name
### downloaded from an upstream source, like a git repository.
### `ynh_setup_source` use the file conf/app.src
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"
@ -169,6 +175,7 @@ ynh_setup_source "$final_path"
### `ynh_add_nginx_config` will use the file conf/nginx.conf
ynh_print_info "Configuring nginx ..."
# Create a dedicated nginx config
ynh_add_nginx_config
@ -177,6 +184,7 @@ ynh_add_nginx_config
#=================================================
# Create a system user
ynh_print_info "Configuring system user ..."
ynh_system_user_create "$app" "$final_path"
#=================================================
@ -195,6 +203,7 @@ ynh_system_user_create "$app" "$final_path"
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
# Create a dedicated php-fpm config
#ynh_print_info "Configuring php-fpm ..."
#ynh_add_fpm_config
#=================================================
@ -219,6 +228,7 @@ ynh_system_user_create "$app" "$final_path"
### - And the section "SETUP SYSTEMD" in the upgrade script
# Create a dedicated systemd config
ynh_print_info "Configuring systemd service ..."
ynh_add_systemd_config
#=================================================
@ -234,6 +244,7 @@ ynh_add_systemd_config
#chown -R $app: $final_path
# Set the app as temporarily public for curl call
#ynh_print_info "Configuring ssowat ..."
#ynh_app_setting_set $app skipped_uris "/"
# Reload SSOwat config
#yunohost app ssowatconf
@ -326,6 +337,7 @@ chown -R "$app":"$app" "$final_path"
### - And the section "SETUP LOGROTATE" in the upgrade script
# Use logrotate to manage application logfile(s)
#ynh_print_info "Configuring log rotation ..."
#ynh_use_logrotate
#=================================================
@ -338,7 +350,7 @@ chown -R "$app":"$app" "$final_path"
### If you're not using these lines:
### - You can remove these files in conf/.
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
### - As well as the section "ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
#yunohost service add $app --log "/var/log/$app/APP.log"
@ -360,6 +372,7 @@ fi
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx ..."
systemctl reload nginx
#=================================================

View file

@ -51,13 +51,6 @@ fi
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
# Remove metapackage and its dependencies
#ynh_remove_app_dependencies
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
@ -65,6 +58,13 @@ ynh_remove_systemd_config
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_name $db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
# Remove metapackage and its dependencies
#ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================

View file

@ -65,14 +65,6 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file "$final_path"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_mysql_setup_db $db_name $db_name $db_pwd
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -91,7 +83,7 @@ chown -R "$app":"$app" "$final_path"
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
#ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
#ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
#=================================================
# SPECIFIC RESTORATION
@ -100,7 +92,15 @@ chown -R "$app":"$app" "$final_path"
#=================================================
# Define and install dependencies
#ynh_install_app_dependencies mysql
#ynh_install_app_dependencies deb1 deb2
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_mysql_setup_db $db_name $db_name $db_pwd
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#=================================================
# RESTORE SYSTEMD
@ -134,7 +134,7 @@ yunohost service add $app --description "$app daemon for WriteFreely" --log_type
# RELOAD NGINX AND PHP-FPM
#=================================================
#systemctl reload php5-fpm
#systemctl reload php7.0-fpm
systemctl reload nginx
#=================================================

View file

@ -100,9 +100,9 @@ path_url=$(ynh_normalize_url_path $path_url)
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
fi
@ -117,7 +117,7 @@ ynh_add_nginx_config
# UPGRADE DEPENDENCIES
#=================================================
#ynh_install_app_dependencies mysql
#ynh_install_app_dependencies deb1 deb2
#=================================================
# CREATE DEDICATED USER