1
0
Fork 0
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:
yalh76 2022-05-31 03:20:11 +02:00
parent 6fcddf8128
commit 98edecb0a6
11 changed files with 66 additions and 46 deletions

View file

@ -17,6 +17,8 @@
upgrade=1 from_commit=7497ea8b6915b725358db0d4a1210f999961cfee
# 2.4.0~ynh3
upgrade=1 from_commit=1a0fd240d86ffaf5bcee61c176a22a7d075688a6
# 2.4.0~ynh4
upgrade=1 from_commit=6fcddf81286fb845735978ed832c9273c3b783ce
backup_restore=1
multi_instance=1
port_already_use=0

View file

@ -23,7 +23,7 @@ CACHET_EMOJI=false
CACHET_AUTO_TWITTER=true
MAIL_DRIVER=sendmail
MAIL_HOST=
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null

View file

@ -1,6 +1,7 @@
SOURCE_URL=https://github.com/CachetHQ/Cachet/archive/c7ad51e87645e5a717fb817616424276a8e5345b.tar.gz
SOURCE_SUM=7897744356bf81a2bcbc734f132eb5daafa889611c9c72fb2501afb3e9007cac
SOURCE_URL=https://github.com/CachetHQ/Cachet/archive/cf86f65f1dabf283d001d0f5d380f26dd5cfb64c.tar.gz
SOURCE_SUM=be48fdeacc093c9e688ecd9cef61e0304a856fcd6281066552bfecd8355fa35e
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -4,18 +4,17 @@ location __PATH__/ {
# Path to source
alias __FINALPATH__/public/ ;
index index.php;
more_set_headers "Strict-Transport-Security: max-age=15768000";
index index.php;
location __PATH__ {
try_files $uri __PATH__/index.php;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_keep_conn on;
more_set_headers "Strict-Transport-Security: max-age=15768000";
}

View file

@ -6,7 +6,7 @@
"en": "Open source status page system",
"fr": "Système de page de statut open source"
},
"version": "2.4.0~ynh4",
"version": "2.4.0~ynh5",
"url": "https://cachethq.io",
"upstream": {
"license": "BSD-3-Clause",

View file

@ -6,7 +6,7 @@
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

View file

@ -14,6 +14,10 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================

View file

@ -101,14 +101,22 @@ fi
#=================================================
# 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
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_store_file_checksum --file="$final_path/.env"
ynh_store_file_checksum --file="$final_path/bootstrap/cachet/production.php"
# 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

View file

@ -57,6 +57,13 @@ ynh_app_setting_set --app=$app --key=password --value=$password
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -102,7 +109,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring PHP-FPM..." --weight=8
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
ynh_add_fpm_config
#=================================================
# SPECIFIC SETUP

View file

@ -71,19 +71,23 @@ chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
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
#=================================================
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/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/php/$phpversion/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
#=================================================

View file

@ -71,7 +71,7 @@ fi
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# 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
@ -80,21 +80,9 @@ ynh_system_user_create --username=$app
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
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
ynh_setup_source --dest_dir="$final_path"
# Restore configuration files
mv $tmpdir/.env $final_path
mv $tmpdir/production.php $final_path/bootstrap/cachet/
ynh_secure_remove --file="$tmpdir"
ynh_setup_source --dest_dir="$final_path" --keep=".env bootstrap/cachet/production.php"
fi
chmod 750 "$final_path"
@ -110,13 +98,20 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
ynh_add_fpm_config
#=================================================
# SPECIFIC UPGRADE