mirror of
https://github.com/YunoHost-Apps/drupal7_ynh.git
synced 2024-09-03 18:26:19 +02:00
Merge pull request #11 from YunoHost-Apps/example_ynh
Apply example_ynh
This commit is contained in:
commit
b8fb714bdf
9 changed files with 107 additions and 96 deletions
|
@ -29,9 +29,9 @@ LDAP module can be installed
|
|||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/drupal7/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/drupal7/)
|
||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/drupal7/)
|
||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/drupal7/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/drupal7/)
|
||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/drupal7/)
|
||||
|
||||
## Links
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ le module d'authentification LDAP peut être installé
|
|||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/drupal7/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/drupal7/)
|
||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/drupal7/)
|
||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/drupal7/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/drupal7/)
|
||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/drupal7/)
|
||||
|
||||
## Liens
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
SOURCE_URL=url of app's source
|
||||
SOURCE_SUM=sha256 checksum
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
|
@ -5,7 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="deb1 deb2"
|
||||
pkg_dependencies="curl libzip-dev"
|
||||
|
||||
extra_pkg_dependencies="php7.2-fpm php7.2-cli php7.2-gd php7.2-mysql php7.2-xml php7.2-ldap php7.2-mbstring php7.2-uploadprogress"
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
|
||||
# Add settings here as needed by your application
|
||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#db_user=$db_name
|
||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
|
||||
#=================================================
|
||||
|
@ -89,10 +90,10 @@ ynh_print_info --message="Updating Drush alias..."
|
|||
|
||||
cp -f "../conf/yoursite.aliases.drushrc.php" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string "__APP__" "$app" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string "__DOMAIN__" "$new_domain" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string "__PATH_URL__" "$new_path" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$new_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
|
@ -101,7 +102,7 @@ ynh_replace_string "__PATH_URL__" "$new_path" "$final_path/.drush/$app.aliases.d
|
|||
#=================================================
|
||||
ynh_print_info --message="Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -31,7 +31,7 @@ language=$YNH_APP_ARG_LANGUAGE
|
|||
password=$YNH_APP_ARG_PASSWORD
|
||||
install_profil=$YNH_APP_ARG_INSTALL_PROFIL
|
||||
|
||||
admin_mail=$(ynh_user_get_info $admin 'mail')
|
||||
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -41,7 +41,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
ynh_print_info --message="Validating installation parameters..."
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
@ -65,30 +65,18 @@ ynh_app_setting_set --app=$app --key=install_profil --value=$install_profil
|
|||
#=================================================
|
||||
ynh_print_info --message="Installing dependencies..."
|
||||
|
||||
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||
|
||||
#ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Creating a MySQL database..."
|
||||
|
||||
db_name=$(ynh_sanitize_dbid $app)
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info --message="Setting up source files..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
#ynh_setup_source --dest_dir="$final_path"
|
||||
mkdir -p "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -105,8 +93,23 @@ ynh_print_info --message="Configuring system user..."
|
|||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# INSTALL PHP 7.2
|
||||
#=================================================
|
||||
ynh_print_info --message="Installing PHP 7.2..."
|
||||
|
||||
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# CREATE FINAL PATH
|
||||
#=================================================
|
||||
ynh_print_info --message="Creating final path..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
mkdir -p "$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE DRUSH ALIAS
|
||||
#=================================================
|
||||
|
@ -116,10 +119,10 @@ mkdir -p "$final_path/.drush"
|
|||
|
||||
cp -f "../conf/yoursite.aliases.drushrc.php" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string "__APP__" "$app" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string "__PATH_URL__" "$path_url" "$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$final_path/.drush/$app.aliases.drushrc.php"
|
||||
|
||||
#=================================================
|
||||
# INSTALL COMPOSER
|
||||
|
@ -160,22 +163,14 @@ sudo -u $app env PATH=$PATH drush @$app pm-update
|
|||
sudo -u $app env PATH=$PATH drush @$app core-cron
|
||||
|
||||
#=================================================
|
||||
# SET THE CRON FILE
|
||||
# SETUP THE CRON FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Set the cron file"
|
||||
ynh_print_info --message="Setuping the cron file"
|
||||
|
||||
cp ../conf/cron /etc/cron.d/$app
|
||||
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" /etc/cron.d/$app
|
||||
ynh_replace_string "__APP__" "$app" /etc/cron.d/$app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring php-fpm..."
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --phpversion="7.2"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
|
@ -186,6 +181,14 @@ ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php"
|
|||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring php-fpm..."
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --phpversion="7.2"
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
@ -210,7 +213,7 @@ fi
|
|||
#=================================================
|
||||
ynh_print_info --message="Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -29,32 +29,23 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing the MySQL database"
|
||||
ynh_print_info --message="Removing the MySQL database..."
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing php-fpm configuration"
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing dependencies"
|
||||
ynh_print_info --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
#ynh_remove_app_dependencies
|
||||
ynh_remove_php
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing app main directory"
|
||||
ynh_print_info --message="Removing app main directory..."
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
@ -62,26 +53,42 @@ ynh_secure_remove --file="$final_path"
|
|||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing nginx web server configuration"
|
||||
ynh_print_info --message="Removing nginx web server configuration..."
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing php-fpm configuration..."
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE THE CRON FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing the cron file..."
|
||||
|
||||
# Remove a cron file
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing php..."
|
||||
|
||||
ynh_remove_php
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing the dedicated system user"
|
||||
ynh_print_info --message="Removing the dedicated system user..."
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
|
|
@ -30,6 +30,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
|
@ -71,6 +72,13 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
|||
# Restore permissions on app files
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# REINSTALL PHP
|
||||
#=================================================
|
||||
ynh_print_info --message="Reinstalling php..."
|
||||
|
||||
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -85,8 +93,7 @@ ynh_restore_file --origin_path="/etc/php/7.2/fpm/pool.d/$app.conf"
|
|||
ynh_print_info --message="Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
#ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
|
@ -94,8 +101,8 @@ ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
|||
ynh_print_info --message="Restoring the MySQL database..."
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CRON FILE
|
||||
|
@ -110,8 +117,8 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
|
|||
#=================================================
|
||||
ynh_print_info --message="Reloading nginx web server and php-fpm..."
|
||||
|
||||
systemctl reload php7.2-fpm
|
||||
systemctl reload nginx
|
||||
ynh_systemd_action --service_name=php7.2-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -27,6 +27,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -42,13 +48,13 @@ elif [ "$is_public" = "No" ]; then
|
|||
fi
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z $db_name ]; then
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z $final_path ]; then
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
@ -69,14 +75,6 @@ ynh_abort_if_errors
|
|||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
#ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -90,8 +88,7 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_print_info --message="Upgrading dependencies..."
|
||||
|
||||
#ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -101,6 +98,13 @@ ynh_print_info --message="Making sure dedicated system user exists..."
|
|||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPDATE PHP
|
||||
#=================================================
|
||||
ynh_print_info --message="Updating PHP..."
|
||||
|
||||
ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -142,14 +146,16 @@ ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/setti
|
|||
ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php"
|
||||
|
||||
#=================================================
|
||||
# SET THE CRON FILE
|
||||
# SETUP THE CRON FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Set the cron file"
|
||||
ynh_print_info --message="Setuping the cron file"
|
||||
|
||||
cp -f ../conf/cron /etc/cron.d/$app
|
||||
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" /etc/cron.d/$app
|
||||
ynh_replace_string "__APP__" "$app" /etc/cron.d/$app
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
|
||||
|
||||
ynh_systemd_action --service_name=cron --action=restart
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -177,14 +183,7 @@ fi
|
|||
#=================================================
|
||||
ynh_print_info --message="Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# RESTART CRON
|
||||
#=================================================
|
||||
ynh_print_info --message="Restarting cron..."
|
||||
|
||||
systemctl restart cron
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Add table
Reference in a new issue