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

[enh] create blocks for MySQL and PHP command lines which are optionnals.

This commit is contained in:
Moul 2016-06-14 14:09:29 +02:00
parent bdbe0ac79e
commit daaf1005d5
6 changed files with 23 additions and 17 deletions

View file

@ -3,7 +3,7 @@ location YNH_WWW_PATH {
# Path to source # Path to source
alias YNH_WWW_ALIAS ; alias YNH_WWW_ALIAS ;
# Example PHP configuration # Example PHP configuration (remove if not used)
index index.php; index index.php;
# Common parameter to increase upload size limit in conjuction with dedicated php-fpm file # Common parameter to increase upload size limit in conjuction with dedicated php-fpm file
@ -26,6 +26,7 @@ location YNH_WWW_PATH {
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
# PHP configuration end
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;

View file

@ -13,19 +13,21 @@ app=$YNH_APP_INSTANCE_NAME
# Note: the last argument is where to save this path, see the restore script. # Note: the last argument is where to save this path, see the restore script.
ynh_backup "/var/www/${app}" "sources" ynh_backup "/var/www/${app}" "sources"
### MySQL (remove if not used) ###
# If a MySQL database is used: # If a MySQL database is used:
#
# # Dump the database # # Dump the database
# dbname=$app # dbname=$app
# dbuser=$app # dbuser=$app
# dbpass=$(ynh_app_setting_get "$app" mysqlpwd) # dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
# mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql # mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
### MySQL end ###
# Copy NGINX configuration # Copy NGINX configuration
domain=$(ynh_app_setting_get "$app" domain) domain=$(ynh_app_setting_get "$app" domain)
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
### PHP (remove if not used) ###
# If a dedicated php-fpm process is used: # If a dedicated php-fpm process is used:
#
# # Copy PHP-FPM pool configuration # # Copy PHP-FPM pool configuration
# ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf" # ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
### PHP end ###

View file

@ -43,6 +43,7 @@ sudo cp -a ../sources/. $src_path
# you may need to make some file and/or directory writeable by www-data (nginx user) # you may need to make some file and/or directory writeable by www-data (nginx user)
sudo chown -R root: $src_path sudo chown -R root: $src_path
### MySQL (can be removed if not used) ###
# If your app use a MySQL database you can use these lines to bootstrap # If your app use a MySQL database you can use these lines to bootstrap
# a database, an associated user and save the password in app settings. # a database, an associated user and save the password in app settings.
# #
@ -56,6 +57,7 @@ sudo chown -R root: $src_path
# # Load initial SQL into the new database # # Load initial SQL into the new database
# ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" \ # ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" \
# < "../sources/sql/mysql.init.sql" # < "../sources/sql/mysql.init.sql"
### MySQL end ###
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
nginx_conf=../conf/nginx.conf nginx_conf=../conf/nginx.conf
@ -63,10 +65,10 @@ sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf
sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
# If a dedicated php-fpm process is used: # If a dedicated php-fpm process is used:
# Don't forget to modify ../conf/nginx.conf accordingly or your app will not work! # Don't forget to modify ../conf/nginx.conf accordingly or your app will not work!
#
# sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf # sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
### PHP (can be removed if not used) ###
# If a dedicated php-fpm process is used: # If a dedicated php-fpm process is used:
# Don't forget to modify ../conf/php-fpm.conf accordingly or your app will not work! # Don't forget to modify ../conf/php-fpm.conf accordingly or your app will not work!
# #
@ -77,6 +79,8 @@ sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
# sudo cp ../conf/php-fpm.conf $finalphpconf # sudo cp ../conf/php-fpm.conf $finalphpconf
# sudo chown root: $finalphpconf # sudo chown root: $finalphpconf
# sudo chmod 644 $finalphpconf # sudo chmod 644 $finalphpconf
# sudo service php5-fpm reload
### PHP end ###
# If app is public, add url to SSOWat conf as skipped_uris # If app is public, add url to SSOWat conf as skipped_uris
if [[ $is_public -eq 1 ]]; then if [[ $is_public -eq 1 ]]; then
@ -86,6 +90,3 @@ fi
# Reload services # Reload services
sudo service nginx reload sudo service nginx reload
# If a dedicated php-fpm process is used:
# sudo service php5-fpm reload

View file

@ -12,21 +12,23 @@ domain=$(ynh_app_setting_get "$app" domain)
# Remove sources # Remove sources
sudo rm -rf /var/www/$app sudo rm -rf /var/www/$app
# Remove configuration files # Remove nginx configuration file
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
### PHP (remove if not used) ###
# If a dedicated php-fpm process is used: # If a dedicated php-fpm process is used:
#
# sudo rm -f /etc/php5/fpm/pool.d/$app.conf # sudo rm -f /etc/php5/fpm/pool.d/$app.conf
# sudo service php5-fpm reload # sudo service php5-fpm reload
### PHP end ###
### MySQL (remove if not used) ###
# If a MySQL database is used: # If a MySQL database is used:
#
# # Drop MySQL database and user # # Drop MySQL database and user
# dbname=$app # dbname=$app
# dbuser=$app # dbuser=$app
# ynh_mysql_drop_db "$dbname" || true # ynh_mysql_drop_db "$dbname" || true
# ynh_mysql_drop_user "$dbuser" || true # ynh_mysql_drop_user "$dbuser" || true
### MySQL end ###
# Reload nginx service # Reload nginx service
sudo service nginx reload sudo service nginx reload

View file

@ -28,23 +28,25 @@ sudo cp -a ./sources "$src_path"
# you may need to make some file and/or directory writeable by www-data (nginx user) # you may need to make some file and/or directory writeable by www-data (nginx user)
sudo chown -R root: "$src_path" sudo chown -R root: "$src_path"
### MySQL (remove if not used) ###
# If a MySQL database is used: # If a MySQL database is used:
#
# # Create and restore the database # # Create and restore the database
# dbname=$app # dbname=$app
# dbuser=$app # dbuser=$app
# dbpass=$(ynh_app_setting_get "$app" mysqlpwd) # dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
# ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" # ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
# ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql # ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql
### MySQL end ###
# Restore NGINX configuration # Restore NGINX configuration
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf" sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
### PHP (remove if not used) ###
# If a dedicated php-fpm process is used: # If a dedicated php-fpm process is used:
#
# # Copy PHP-FPM pool configuration and reload the service # # Copy PHP-FPM pool configuration and reload the service
# sudo cp -a ./php-fpm.conf "/etc/php5/fpm/pool.d/${app}.conf" # sudo cp -a ./php-fpm.conf "/etc/php5/fpm/pool.d/${app}.conf"
# sudo service php5-fpm reload # sudo service php5-fpm reload
### PHP end ###
# Restart webserver # Restart webserver
sudo service nginx reload sudo service nginx reload

View file

@ -37,8 +37,8 @@ sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
# sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf # sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
### PHP (remove if not used) ###
# If a dedicated php-fpm process is used: # If a dedicated php-fpm process is used:
#
# # Modify PHP-FPM pool configuration and copy it to the pool directory # # Modify PHP-FPM pool configuration and copy it to the pool directory
# sed -i "s@YNH_WWW_APP@$app@g" ../conf/php-fpm.conf # sed -i "s@YNH_WWW_APP@$app@g" ../conf/php-fpm.conf
# sed -i "s@YNH_WWW_ALIAS@$src_path/@g" ../conf/php-fpm.conf # sed -i "s@YNH_WWW_ALIAS@$src_path/@g" ../conf/php-fpm.conf
@ -46,6 +46,8 @@ sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
# sudo cp ../conf/php-fpm.conf $finalphpconf # sudo cp ../conf/php-fpm.conf $finalphpconf
# sudo chown root: $finalphpconf # sudo chown root: $finalphpconf
# sudo chmod 644 $finalphpconf # sudo chmod 644 $finalphpconf
# sudo service php5-fpm restart
### PHP end ###
# If app is public, add url to SSOWat conf as skipped_uris # If app is public, add url to SSOWat conf as skipped_uris
if [[ $is_public -eq 1 ]]; then if [[ $is_public -eq 1 ]]; then
@ -53,9 +55,5 @@ if [[ $is_public -eq 1 ]]; then
ynh_app_setting_set "$app" unprotected_uris "/" ynh_app_setting_set "$app" unprotected_uris "/"
fi fi
# If a dedicated php-fpm process is used:
#
# sudo service php5-fpm restart
# Reload nginx service # Reload nginx service
sudo service nginx reload sudo service nginx reload