mirror of
https://github.com/YunoHost-Apps/cachet_ynh.git
synced 2024-09-03 18:16:03 +02:00
Apply last example_ynh
This commit is contained in:
parent
6fcddf8128
commit
98edecb0a6
11 changed files with 66 additions and 46 deletions
|
@ -14,9 +14,11 @@
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
# 2.3.15~ynh1
|
# 2.3.15~ynh1
|
||||||
upgrade=1 from_commit=7497ea8b6915b725358db0d4a1210f999961cfee
|
upgrade=1 from_commit=7497ea8b6915b725358db0d4a1210f999961cfee
|
||||||
# 2.4.0~ynh3
|
# 2.4.0~ynh3
|
||||||
upgrade=1 from_commit=1a0fd240d86ffaf5bcee61c176a22a7d075688a6
|
upgrade=1 from_commit=1a0fd240d86ffaf5bcee61c176a22a7d075688a6
|
||||||
|
# 2.4.0~ynh4
|
||||||
|
upgrade=1 from_commit=6fcddf81286fb845735978ed832c9273c3b783ce
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
|
|
@ -23,7 +23,7 @@ CACHET_EMOJI=false
|
||||||
CACHET_AUTO_TWITTER=true
|
CACHET_AUTO_TWITTER=true
|
||||||
|
|
||||||
MAIL_DRIVER=sendmail
|
MAIL_DRIVER=sendmail
|
||||||
MAIL_HOST=
|
MAIL_HOST=localhost
|
||||||
MAIL_PORT=25
|
MAIL_PORT=25
|
||||||
MAIL_USERNAME=null
|
MAIL_USERNAME=null
|
||||||
MAIL_PASSWORD=null
|
MAIL_PASSWORD=null
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
SOURCE_URL=https://github.com/CachetHQ/Cachet/archive/c7ad51e87645e5a717fb817616424276a8e5345b.tar.gz
|
SOURCE_URL=https://github.com/CachetHQ/Cachet/archive/cf86f65f1dabf283d001d0f5d380f26dd5cfb64c.tar.gz
|
||||||
SOURCE_SUM=7897744356bf81a2bcbc734f132eb5daafa889611c9c72fb2501afb3e9007cac
|
SOURCE_SUM=be48fdeacc093c9e688ecd9cef61e0304a856fcd6281066552bfecd8355fa35e
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
SOURCE_FILENAME=
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
||||||
|
|
|
@ -4,20 +4,19 @@ location __PATH__/ {
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __FINALPATH__/public/ ;
|
alias __FINALPATH__/public/ ;
|
||||||
|
|
||||||
|
index index.php;
|
||||||
|
|
||||||
more_set_headers "Strict-Transport-Security: max-age=15768000";
|
more_set_headers "Strict-Transport-Security: max-age=15768000";
|
||||||
|
|
||||||
index index.php;
|
try_files $uri __PATH__/index.php;
|
||||||
location __PATH__ {
|
|
||||||
try_files $uri __PATH__/index.php;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
include fastcgi_params;
|
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_index index.php;
|
||||||
fastcgi_index index.php;
|
include fastcgi_params;
|
||||||
fastcgi_keep_conn on;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
more_set_headers "Strict-Transport-Security: max-age=15768000";
|
fastcgi_keep_conn on;
|
||||||
|
more_set_headers "Strict-Transport-Security: max-age=15768000";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Open source status page system",
|
"en": "Open source status page system",
|
||||||
"fr": "Système de page de statut open source"
|
"fr": "Système de page de statut open source"
|
||||||
},
|
},
|
||||||
"version": "2.4.0~ynh4",
|
"version": "2.4.0~ynh5",
|
||||||
"url": "https://cachethq.io",
|
"url": "https://cachethq.io",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
"mysql"
|
"mysql"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain"
|
"type": "domain"
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
},
|
},
|
||||||
"choices": ["fr", "en"],
|
"choices": ["fr", "en"],
|
||||||
"default": "en"
|
"default": "en"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user"
|
"type": "user"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
YNH_PHP_VERSION="7.3"
|
YNH_PHP_VERSION="7.3"
|
||||||
|
|
||||||
extra_php_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-sqlite3"
|
pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-sqlite3"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
|
@ -14,6 +14,10 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -101,14 +101,22 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# SPECIFIC MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# UPDATE A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
|
|
||||||
|
ynh_backup_if_checksum_is_different --file="$final_path/.env"
|
||||||
|
ynh_backup_if_checksum_is_different --file="$final_path/bootstrap/cachet/production.php"
|
||||||
|
|
||||||
ynh_script_progression --message="Updating Cachet configuration..." --weight=1
|
|
||||||
# Replace domain in Cachet configuration files
|
# Replace domain in Cachet configuration files
|
||||||
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$final_path/.env"
|
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$final_path/.env"
|
||||||
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$final_path/bootstrap/cachet/production.php"
|
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$final_path/bootstrap/cachet/production.php"
|
||||||
|
|
||||||
|
ynh_store_file_checksum --file="$final_path/.env"
|
||||||
|
ynh_store_file_checksum --file="$final_path/bootstrap/cachet/production.php"
|
||||||
|
|
||||||
# Replace domain in Cachet database settings
|
# Replace domain in Cachet database settings
|
||||||
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_user" <<< "UPDATE settings SET value = 'https://$new_domain' WHERE name = 'app_domain'"
|
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" <<< "UPDATE settings SET value = 'https://$new_domain' WHERE name = 'app_domain'"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
|
|
@ -57,6 +57,13 @@ ynh_app_setting_set --app=$app --key=password --value=$password
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -102,7 +109,7 @@ ynh_add_nginx_config
|
||||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=8
|
ynh_script_progression --message="Configuring PHP-FPM..." --weight=8
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
ynh_add_fpm_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
|
|
@ -71,19 +71,23 @@ chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
chown -R $app: "${final_path}/.env" "${final_path}/storage/" "${final_path}/bootstrap/"
|
chown -R $app: "${final_path}/.env" "${final_path}/storage/" "${final_path}/bootstrap/"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reinstalling dependencies..."
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=6
|
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
|
||||||
|
|
||||||
# Restore the file first, so it can have a backup if different
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
|
|
||||||
|
|
||||||
# Recreate a dedicated PHP-FPM config
|
|
||||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC RESTORATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -71,7 +71,7 @@ fi
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -80,21 +80,9 @@ ynh_system_user_create --username=$app
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
# Backup essential configuration files
|
|
||||||
tmpdir=$(mktemp -d)
|
|
||||||
mv $final_path/.env $tmpdir
|
|
||||||
mv $final_path/bootstrap/cachet/production.php $tmpdir
|
|
||||||
|
|
||||||
# Remove every old application files
|
|
||||||
ynh_secure_remove --file="$final_path" # /bootstrap/cache/*
|
|
||||||
|
|
||||||
# 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 --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$final_path" --keep=".env bootstrap/cachet/production.php"
|
||||||
|
|
||||||
# Restore configuration files
|
|
||||||
mv $tmpdir/.env $final_path
|
|
||||||
mv $tmpdir/production.php $final_path/bootstrap/cachet/
|
|
||||||
ynh_secure_remove --file="$tmpdir"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
|
@ -110,13 +98,20 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..."
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
ynh_add_fpm_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
|
|
Loading…
Add table
Reference in a new issue