1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/distbin_ynh.git synced 2024-09-03 18:26:10 +02:00

Full configuration

This commit is contained in:
Yalh 2019-01-28 19:56:51 +01:00
parent 5319f66234
commit f9a54235f5
8 changed files with 54 additions and 55 deletions

View file

@ -15,17 +15,17 @@ location __PATH__/ {
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
#client_max_body_size 50M;
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
#try_files $uri $uri/ index.php;
#location ~ [^/]\.php(/|$) {
#fastcgi_split_path_info ^(.+?\.php)(/.*)$;
#fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
#fastcgi_index index.php;
#include fastcgi_params;
#fastcgi_param REMOTE_USER $remote_user;
#fastcgi_param PATH_INFO $fastcgi_path_info;
#fastcgi_param SCRIPT_FILENAME $request_filename;
#}
### End of PHP configuration part
# Include SSOWAT user panel.

View file

@ -7,7 +7,7 @@ Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/
ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1
ExecStart=__FINALPATH__/bin/server >> /var/log/__APP__/__APP__.log 2>&1
[Install]
WantedBy=multi-user.target

View file

@ -19,9 +19,7 @@
},
"multi_instance": true,
"services": [
"nginx",
"php5-fpm",
"mysql"
"nginx"
],
"arguments": {
"install" : [

View file

@ -48,13 +48,13 @@ 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/php5/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_mysql_dump_db "$db_name" > db.sql
#ynh_mysql_dump_db "$db_name" > db.sql
#=================================================
# SPECIFIC BACKUP
@ -74,4 +74,4 @@ ynh_backup "/etc/systemd/system/$app.service"
# BACKUP A CRON FILE
#=================================================
ynh_backup "/etc/cron.d/$app"
#ynh_backup "/etc/cron.d/$app"

View file

@ -82,7 +82,7 @@ ynh_app_setting_set $app language $language
# Find a free port
port=$(ynh_find_port 8095)
# Open this port
yunohost firewall allow --no-upnp TCP $port 2>&1
#yunohost firewall allow --no-upnp TCP $port 2>&1
ynh_app_setting_set $app port $port
#=================================================
@ -96,7 +96,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_install_app_dependencies deb1 deb2
#ynh_install_app_dependencies deb1 deb2
#=================================================
# CREATE A MYSQL DATABASE
@ -111,9 +111,9 @@ ynh_install_app_dependencies deb1 deb2
### - 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
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
ynh_mysql_setup_db $db_name $db_name
#db_name=$(ynh_sanitize_dbid $app)
#ynh_app_setting_set $app db_name $db_name
#ynh_mysql_setup_db $db_name $db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -125,7 +125,8 @@ ynh_mysql_setup_db $db_name $db_name
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"
#ynh_setup_source "$final_path"
git clone https://github.com/gobengo/distbin "$final_path"
#=================================================
# NGINX CONFIGURATION
@ -159,7 +160,7 @@ ynh_system_user_create $app
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
# Create a dedicated php-fpm config
ynh_add_fpm_config
#ynh_add_fpm_config
#=================================================
# SPECIFIC SETUP
@ -195,24 +196,24 @@ ynh_add_systemd_config
### forms.
# Set right permissions for curl install
chown -R $app: $final_path
#chown -R $app: $final_path
# Set the app as temporarily public for curl call
ynh_app_setting_set $app skipped_uris "/"
#ynh_app_setting_set $app skipped_uris "/"
# Reload SSOwat config
yunohost app ssowatconf
#yunohost app ssowatconf
# Reload Nginx
systemctl reload nginx
#systemctl reload nginx
# Installation with curl
ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
# Remove the public access
if [ $is_public -eq 0 ]
then
ynh_app_setting_delete $app skipped_uris
fi
#if [ $is_public -eq 0 ]
#then
# ynh_app_setting_delete $app skipped_uris
#fi
#=================================================
# MODIFY A CONFIG FILE
@ -221,7 +222,7 @@ fi
### `ynh_replace_string` is used to replace a string in a file.
### (It's compatible with sed regular expressions syntax)
ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE"
#ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
@ -232,7 +233,7 @@ ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE"
### you can make a backup of this file before modifying it again if the admin had modified it.
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/CONFIG_FILE"
#ynh_store_file_checksum "$final_path/CONFIG_FILE"
#=================================================
# GENERIC FINALIZATION
@ -274,9 +275,9 @@ ynh_use_logrotate
### - 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
yunohost service add $app --log "/var/log/$app/APP.log"
yunohost service add $app --log "/var/log/$app/$app.log"
# 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 XXX" --log "/var/log/$app/APP.log"
#yunohost service add $app --description "$app daemon for XXX" --log "/var/log/$app/$app.log"
#=================================================
# SETUP SSOWAT

View file

@ -46,14 +46,14 @@ ynh_remove_systemd_config
#=================================================
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#ynh_remove_app_dependencies
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_user $db_name
#ynh_mysql_remove_db $db_user $db_name
#=================================================
# REMOVE APP MAIN DIR
@ -74,7 +74,7 @@ ynh_remove_nginx_config
#=================================================
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
#ynh_remove_fpm_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
@ -100,10 +100,10 @@ fi
#=================================================
# Remove a cron file
ynh_secure_remove "/etc/cron.d/$app"
#ynh_secure_remove "/etc/cron.d/$app"
# Remove a directory securely
ynh_secure_remove "/etc/$app/"
#ynh_secure_remove "/etc/$app/"
# Remove the log files
ynh_secure_remove "/var/log/$app/"

View file

@ -58,9 +58,9 @@ 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
#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
@ -80,7 +80,7 @@ chown -R root: $final_path
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
#ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
#=================================================
# SPECIFIC RESTORATION
@ -89,7 +89,7 @@ ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
#=================================================
# Define and install dependencies
ynh_install_app_dependencies deb1 deb2
#ynh_install_app_dependencies deb1 deb2
#=================================================
# RESTORE SYSTEMD
@ -102,13 +102,13 @@ systemctl enable $app.service
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add $app --log "/var/log/$app/APP.log"
yunohost service add $app --log "/var/log/$app/$app.log"
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_restore_file "/etc/cron.d/$app"
#ynh_restore_file "/etc/cron.d/$app"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
@ -122,5 +122,5 @@ ynh_restore_file "/etc/logrotate.d/$app"
# RELOAD NGINX AND PHP-FPM
#=================================================
systemctl reload php5-fpm
#systemctl reload php5-fpm
systemctl reload nginx

View file

@ -74,7 +74,7 @@ path_url=$(ynh_normalize_url_path $path_url)
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
# Download, check integrity, uncompress and patch the source from app.src#
ynh_setup_source "$final_path"
#=================================================
@ -88,7 +88,7 @@ ynh_add_nginx_config
# UPGRADE DEPENDENCIES
#=================================================
ynh_install_app_dependencies deb1 deb2
#ynh_install_app_dependencies deb1 deb2
#=================================================
# CREATE DEDICATED USER
@ -102,7 +102,7 @@ ynh_system_user_create $app
#=================================================
# Create a dedicated php-fpm config
ynh_add_fpm_config
#ynh_add_fpm_config
#=================================================
# SPECIFIC UPGRADE
@ -112,9 +112,9 @@ ynh_add_fpm_config
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE"
#ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum "$final_path/CONFIG_FILE"
#ynh_store_file_checksum "$final_path/CONFIG_FILE"
#=================================================
# SETUP LOGROTATE