mirror of
https://github.com/YunoHost-Apps/concrete5_ynh.git
synced 2024-09-03 18:25:54 +02:00
Apply last example_ynh
This commit is contained in:
parent
a7ca3e9471
commit
14692cec9e
7 changed files with 160 additions and 82 deletions
|
@ -2,28 +2,24 @@
|
|||
"name": "Concrete5",
|
||||
"id": "concrete5",
|
||||
"packaging_format": 1,
|
||||
"requirements": {
|
||||
"yunohost": ">=2.6"
|
||||
},
|
||||
"description": {
|
||||
"en": "Create a modern Website",
|
||||
"fr": "Créer un site web moderne avec un CMS moderne"
|
||||
},
|
||||
"version": "8.4.4",
|
||||
"license": "MIT",
|
||||
"version": "8.4.4~ynh1",
|
||||
"url": "www.concrete5.org",
|
||||
"license": "free",
|
||||
"license": "MIT",
|
||||
"maintainer": {
|
||||
"name": "frju365",
|
||||
"email": "win10@tutanota.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.7.14"
|
||||
"yunohost": ">= 3.4"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7-fpm",
|
||||
"php7.0-fpm",
|
||||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
|
@ -67,6 +63,7 @@
|
|||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ============= FUTURE YUNOHOST HELPER =============
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Delete a file checksum from the app settings
|
||||
#
|
||||
# $app should be defined when calling this helper
|
||||
|
@ -67,4 +70,12 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
|||
|
||||
# Send the email to the recipients
|
||||
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||
}
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -23,6 +24,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -35,24 +37,28 @@ db_name=$(ynh_app_setting_get $app db_name)
|
|||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the main app directory..."
|
||||
|
||||
ynh_backup "$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Backing up nginx web server configuration..."
|
||||
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Backing up php-fpm configuration..."
|
||||
|
||||
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the MySQL database..."
|
||||
|
||||
ynh_mysql_dump_db "$db_name" > db.sql
|
||||
|
||||
|
@ -61,12 +67,14 @@ ynh_mysql_dump_db "$db_name" > db.sql
|
|||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info "Backing up logrotate configuration..."
|
||||
|
||||
#ynh_backup "/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info "Backing up systemd configuration..."
|
||||
|
||||
#ynh_backup "/etc/systemd/system/$app.service"
|
||||
|
||||
|
@ -75,3 +83,9 @@ ynh_mysql_dump_db "$db_name" > db.sql
|
|||
#=================================================
|
||||
|
||||
#ynh_backup "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -30,8 +30,8 @@ admin=$YNH_APP_ARG_ADMIN
|
|||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
admin_email=$(ynh_user_get_info $admin 'mail')
|
||||
website_title=$YNH_APP_ARG_WEBSITE_TITLE
|
||||
admin_email=$(ynh_user_get_info $admin 'mail')
|
||||
|
||||
|
||||
### If it's a multi-instance app, meaning it can be installed several times independently
|
||||
|
@ -49,6 +49,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_print_info "Validating installation parameters..."
|
||||
|
||||
### 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"
|
||||
|
@ -64,6 +65,7 @@ ynh_webpath_register $app $domain $path_url
|
|||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_print_info "Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set $app domain $domain
|
||||
ynh_app_setting_set $app path_url $path_url
|
||||
|
@ -78,6 +80,7 @@ ynh_app_setting_set $app website_title $website_title
|
|||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_print_info "Configuring firewall..."
|
||||
|
||||
### Use these lines if you have to open a port for the application
|
||||
### `ynh_find_port` will find the first available port starting from the given port.
|
||||
|
@ -87,12 +90,13 @@ ynh_app_setting_set $app website_title $website_title
|
|||
# Find a free port
|
||||
#port=$(ynh_find_port 8095)
|
||||
# Open this port
|
||||
#yunohost firewall allow --no-upnp TCP $port 2>&1
|
||||
#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||
#ynh_app_setting_set $app port $port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Installing dependencies..."
|
||||
|
||||
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
||||
### Those deb packages will be installed as dependencies of this package.
|
||||
|
@ -106,6 +110,7 @@ ynh_app_setting_set $app website_title $website_title
|
|||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info "Creating a MySQL database..."
|
||||
|
||||
### Use these lines if you need a database for the application.
|
||||
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
|
||||
|
@ -123,6 +128,7 @@ ynh_mysql_setup_db $db_name $db_name
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info "Setting up source files..."
|
||||
|
||||
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
||||
### downloaded from an upstream source, like a git repository.
|
||||
|
@ -135,6 +141,7 @@ ynh_setup_source "$final_path"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Configuring nginx web server..."
|
||||
|
||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||
|
||||
|
@ -144,6 +151,7 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create $app
|
||||
|
@ -151,6 +159,7 @@ ynh_system_user_create $app
|
|||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Configuring php-fpm..."
|
||||
|
||||
### `ynh_add_fpm_config` is used to set up a PHP config.
|
||||
### You can remove it if your app doesn't use PHP.
|
||||
|
@ -168,46 +177,35 @@ ynh_add_fpm_config
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# ...
|
||||
#=================================================
|
||||
|
||||
|
||||
#================================================
|
||||
# Installation : Get Composer:
|
||||
# CONCRETE5 INSTALLATION
|
||||
#=================================================
|
||||
echo "The installation can take long. So be patient ! :)"
|
||||
ynh_print_info "Concrete5 Installation, the installation can take long. So be patient ! :)"
|
||||
|
||||
pushd $final_path
|
||||
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
||||
sudo php composer-setup.php
|
||||
sudo php -r "unlink('composer-setup.php');"
|
||||
sudo ./composer.phar install
|
||||
sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \
|
||||
--db-database=$db_name \
|
||||
--db-username=$db_name \
|
||||
--db-password=$db_pwd \
|
||||
--site="$website_title" \
|
||||
--admin-email="$admin_email" \
|
||||
--admin-password=$password \
|
||||
--language=$language \
|
||||
--site-locale=$language \
|
||||
--verbose \
|
||||
--no-interaction \
|
||||
--allow-as-root
|
||||
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
sudo php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
||||
sudo php composer-setup.php
|
||||
sudo php -r "unlink('composer-setup.php');"
|
||||
sudo ./composer.phar install
|
||||
sudo ./concrete/bin/concrete5 c5:install --db-server=localhost \
|
||||
--db-database=$db_name \
|
||||
--db-username=$db_name \
|
||||
--db-password=$db_pwd \
|
||||
--site="$website_title" \
|
||||
--admin-email="$admin_email" \
|
||||
--admin-password=$password \
|
||||
--language=$language \
|
||||
--site-locale=$language \
|
||||
--verbose \
|
||||
--no-interaction \
|
||||
--allow-as-root
|
||||
popd
|
||||
|
||||
#time zone
|
||||
#CanonicalURL
|
||||
#alternative canoncial url
|
||||
#elemental_blank 0
|
||||
#Additional username
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info "Configuring a systemd service..."
|
||||
|
||||
### `ynh_systemd_config` is used to configure a systemd script for an app.
|
||||
### It can be used for apps that use sysvinit (with adaptation) or systemd.
|
||||
|
@ -216,7 +214,7 @@ popd
|
|||
### If you're not using these lines:
|
||||
### - You can remove those files in conf/.
|
||||
### - Remove the section "BACKUP SYSTEMD" in the backup script
|
||||
### - Remove also the section "STOP AND REMOVE SYSTEMD SERVICE" in the remove script
|
||||
### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script
|
||||
### - As well as the section "RESTORE SYSTEMD" in the restore script
|
||||
### - And the section "SETUP SYSTEMD" in the upgrade script
|
||||
|
||||
|
@ -236,6 +234,7 @@ popd
|
|||
#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
|
||||
|
@ -244,6 +243,7 @@ popd
|
|||
#systemctl reload nginx
|
||||
|
||||
# Installation with curl
|
||||
#ynh_print_info "Finalizing installation..."
|
||||
#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
|
||||
|
||||
# Remove the public access
|
||||
|
@ -289,6 +289,7 @@ sudo chmod 777 $final_path -R
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info "Configuring log rotation..."
|
||||
|
||||
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
|
||||
### Use this helper only if there is effectively a log file for this app.
|
||||
|
@ -311,7 +312,7 @@ sudo chmod 777 $final_path -R
|
|||
### 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"
|
||||
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
|
||||
|
@ -320,6 +321,7 @@ yunohost service add $app --log "/var/log/$app/APP.log"
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_print_info "Configuring SSOwat..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
|
@ -331,6 +333,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
|
@ -344,3 +347,9 @@ systemctl reload nginx
|
|||
message="To connect to your Concrete Website go to https://$domain$path_url/ with Username: admin"
|
||||
|
||||
ynh_send_readme_to_admin "$message"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Installation of $app completed"
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -24,40 +25,44 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# STOP AND REMOVE SYSTEMD SERVICE
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
#if yunohost service status $app >/dev/null 2>&1
|
||||
#then
|
||||
# ynh_print_info "Removing $app service"
|
||||
# yunohost service remove $app
|
||||
#fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_print_info "Stopping and removing the systemd service"
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
#ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
#if yunohost service status | grep -q $app
|
||||
#then
|
||||
# echo "Remove $app service"
|
||||
# yunohost service remove $app
|
||||
#fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
#ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info "Removing the MySQL database"
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db $db_user $db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Removing dependencies"
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
#ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Removing app main directory"
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove "$final_path"
|
||||
|
@ -65,6 +70,7 @@ ynh_secure_remove "$final_path"
|
|||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing nginx web server configuration"
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
@ -72,6 +78,7 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing php-fpm configuration"
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
ynh_remove_fpm_config
|
||||
|
@ -79,6 +86,7 @@ ynh_remove_fpm_config
|
|||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing logrotate configuration"
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
#ynh_remove_logrotate
|
||||
|
@ -89,8 +97,8 @@ ynh_remove_fpm_config
|
|||
|
||||
#if yunohost firewall list | grep -q "\- $port$"
|
||||
#then
|
||||
# echo "Close port $port" >&2
|
||||
# yunohost firewall disallow TCP $port 2>&1
|
||||
# ynh_print_info "Closing port $port"
|
||||
# ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
#fi
|
||||
|
||||
#=================================================
|
||||
|
@ -113,6 +121,13 @@ ynh_secure_remove "/var/log/$app/"
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Removing the dedicated system user"
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete $app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Removal of $app completed"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -23,6 +24,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -34,6 +36,7 @@ db_name=$(ynh_app_setting_get $app db_name)
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_print_info "Validating restoration parameters..."
|
||||
|
||||
ynh_webpath_available $domain $path_url \
|
||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||
|
@ -51,20 +54,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Restoring the app main directory..."
|
||||
|
||||
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
|
||||
#=================================================
|
||||
ynh_print_info "Recreating the dedicated system user..."
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
@ -87,23 +84,34 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
|
|||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
#ynh_install_app_dependencies deb1 deb2
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info "Restoring 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
|
||||
#=================================================
|
||||
ynh_print_info "Restoring the systemd configuration..."
|
||||
|
||||
#ynh_restore_file "/etc/systemd/system/$app.service"
|
||||
#systemctl enable $app.service
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app --log "/var/log/$app/APP.log"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
||||
#ynh_restore_file "/etc/systemd/system/$app.service"
|
||||
#systemctl enable $app.service
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CRON FILE
|
||||
#=================================================
|
||||
|
@ -121,6 +129,13 @@ yunohost service add $app --log "/var/log/$app/APP.log"
|
|||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server and php-fpm..."
|
||||
|
||||
systemctl reload php7.0-fpm
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Restoration completed for $app"
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -26,6 +27,7 @@ db_name=$(ynh_app_setting_get $app db_name)
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_print_info "Ensuring downward compatibility..."
|
||||
|
||||
# Fix is_public as a boolean value
|
||||
if [ "$is_public" = "Yes" ]; then
|
||||
|
@ -51,6 +53,7 @@ fi
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -73,6 +76,7 @@ path_url=$(ynh_normalize_url_path $path_url)
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
#ynh_setup_source "$final_path"
|
||||
|
@ -80,6 +84,7 @@ path_url=$(ynh_normalize_url_path $path_url)
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading nginx web server configuration..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
@ -93,6 +98,7 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
@ -100,6 +106,7 @@ ynh_system_user_create $app
|
|||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading php-fpm configuration..."
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
|
@ -126,6 +133,7 @@ popd
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading logrotate configuration..."
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
#ynh_use_logrotate --non-append
|
||||
|
@ -133,6 +141,7 @@ popd
|
|||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading systemd configuration..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
#ynh_add_systemd_config
|
||||
|
@ -149,6 +158,7 @@ chown -R root: $final_path
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading SSOwat configuration..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
|
@ -160,5 +170,12 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue