mirror of
https://github.com/YunoHost-Apps/lychee_ynh.git
synced 2024-09-03 19:36:36 +02:00
Apply example_ynh (#43)
* Auto-update README * Apply example_ynh * Auto-update README * fix missing datadir * Fix missing phpversion * Update upgrade * Update check_process Co-authored-by: yunohost-bot <yunohost@yunohost.org>
This commit is contained in:
parent
0b6ab9de6c
commit
577b9b0635
14 changed files with 153 additions and 136 deletions
|
@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
Lychee is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely.
|
||||
|
||||
**Shipped version:** 4.4~ynh3
|
||||
**Shipped version:** 4.4.0~ynh4
|
||||
|
||||
**Demo:** https://lycheeorg.github.io/demo/
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
|
||||
Lychee is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely.
|
||||
|
||||
**Version incluse :** 4.4~ynh3
|
||||
**Version incluse :** 4.4.0~ynh4
|
||||
|
||||
**Démo :** https://lycheeorg.github.io/demo/
|
||||
|
||||
|
|
|
@ -11,17 +11,12 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=2a2fd5b9a9e81ff8e157cf1747418fd11f4211a2
|
||||
upgrade=1 from_commit=1fa062d50aaa810deeba6426405fbe2e2671492a
|
||||
# 4.4~ynh3
|
||||
upgrade=1 from_commit=a87e16f7ca7e6645610745970bc7c3daa263b2b7
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=2a2fd5b9a9e81ff8e157cf1747418fd11f4211a2
|
||||
name= Fix linter (#13) 11 Dec 2020
|
||||
; commit=1fa062d50aaa810deeba6426405fbe2e2671492a
|
||||
name= Merge branch 'testing' (#26)
|
||||
manifest_arg=domain=DOMAIN&path=PATH&is_public=1&
|
||||
|
|
|
@ -33,7 +33,7 @@ TIMEZONE=UTC
|
|||
|
||||
# folders in which the files will be stored
|
||||
LYCHEE_DIST="__FINALPATH__/public/dist/"
|
||||
LYCHEE_UPLOADS="__PUBLIC_PATH__/uploads/"
|
||||
LYCHEE_UPLOADS="__DATADIR__/uploads/"
|
||||
|
||||
# url to access those files
|
||||
# LYCHEE_DIST_URL="dist/"
|
||||
|
|
|
@ -3,3 +3,5 @@ SOURCE_SUM=2d451033e392e6c3287f8962524e9b4f5581d8e3dfcc9040690d2dc190274c26
|
|||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
||||
|
|
|
@ -6,27 +6,27 @@ location ^~ __PATH__/ {
|
|||
|
||||
index index.php;
|
||||
|
||||
# setup for image upload
|
||||
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
||||
client_max_body_size 512M;
|
||||
|
||||
try_files $uri $uri/ __PATH__/__PATH__/index.php?$query_string;
|
||||
|
||||
location ~ \.php$ {
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^__PATH__/?(.*)$ __PATH__/index.php?/$1 last;
|
||||
break;
|
||||
}
|
||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^__PATH__/?(.*)$ __PATH__/index.php?/$1 last;
|
||||
break;
|
||||
}
|
||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
}
|
||||
|
||||
location __PATH__/uploads/ {
|
||||
alias __PUBLIC_PATH__/uploads/ ;
|
||||
alias __DATADIR__/uploads/ ;
|
||||
}
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Photo-management-system to manage and share photos",
|
||||
"fr": "Système de gestion de photos pour gérer et partager des photos"
|
||||
},
|
||||
"version": "4.4~ynh3",
|
||||
"version": "4.4.0~ynh4",
|
||||
"url": "https://lycheeorg.github.io/",
|
||||
"upstream": {
|
||||
"license": "MIT",
|
||||
|
@ -30,20 +30,20 @@
|
|||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"example": "/lychee",
|
||||
"default": "/lychee"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"help": {
|
||||
"en": "If enabled, Lychee will be accessible by people who do not have an account. This can be changed later via the webadmin.",
|
||||
"fr": "Si cette case est cochée, Lychee sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
|
||||
|
|
|
@ -9,6 +9,7 @@ YNH_PHP_VERSION="8.0"
|
|||
# Composer version
|
||||
YNH_COMPOSER_VERSION="2.3.5"
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="ffmpeg php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-exif php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mysqli php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-intl"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -24,10 +25,10 @@ ynh_print_info --message="Loading installation settings..."
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
public_path=$(ynh_app_setting_get --app=$app --key=public_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
@ -41,10 +42,10 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
ynh_backup --src_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP MEDIA FOLDER
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$public_path" --is_big
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Stop script if errors
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
@ -31,12 +28,14 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
public_path=$(ynh_app_setting_get --app=$app --key=public_path)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up Lychee before changing its URL..." --weight=2
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=2
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -44,7 +43,7 @@ ynh_clean_setup () {
|
|||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# restore it if the upgrade fails
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
|
|
@ -22,7 +22,6 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -31,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
|
||||
datadir=/home/yunohost.app/$app
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
|
@ -85,19 +85,13 @@ chmod -R o-rwx "$final_path"
|
|||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||
|
||||
public_path=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=public_path --value=$public_path
|
||||
|
||||
mkdir -p $public_path/uploads
|
||||
mkdir -p $public_path/uploads/{big,import,medium,raw,small,thumb}
|
||||
|
||||
chmod 750 "$public_path"
|
||||
chmod -R o-rwx "$public_path"
|
||||
chown -R $app:www-data "$public_path"
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -108,17 +102,35 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
||||
mkdir -p $datadir/uploads
|
||||
mkdir -p $datadir/uploads/{big,import,medium,raw,small,thumb}
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# INSTALL LYCHEE WITH COMPOSER
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing $app with Composer..." --weight=15
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
|
||||
|
||||
chmod 400 "$final_path/.env"
|
||||
chown $app:$app "$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# INSTALL APP WITH COMPOSER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing app with Composer..." --weight=15
|
||||
|
||||
ynh_install_composer --install_args="--ignore-platform-reqs"
|
||||
|
||||
|
@ -127,10 +139,6 @@ ynh_install_composer --install_args="--ignore-platform-reqs"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Building..." --weight=10
|
||||
|
||||
# Setup application config
|
||||
ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
|
||||
|
||||
# Setup application config
|
||||
pushd $final_path
|
||||
php$phpversion artisan key:generate -n --force --env
|
||||
php$phpversion artisan migrate -n --force
|
||||
|
@ -142,19 +150,23 @@ popd
|
|||
# Setup custom user.css file
|
||||
ynh_add_config --template="../conf/user.css.example" --destination="$final_path/public/dist/user.css"
|
||||
|
||||
ynh_replace_string --match_string="\$ffmpeg = FFMpeg::create();" --replace_string="\$ffmpeg = FFMpeg::create(array(\
|
||||
'ffmpeg.binaries' => '/usr/bin/ffmpeg',\
|
||||
'ffprobe.binaries' => '/usr/bin/ffprobe',\
|
||||
));" --target_file="$final_path/app/Actions/Photo/Extensions/VideoEditing.php"
|
||||
ynh_replace_string \
|
||||
--match_string="\$ffmpeg = FFMpeg::create();" \
|
||||
--replace_string="\$ffmpeg = FFMpeg::create(array('ffmpeg.binaries' => '/usr/bin/ffmpeg','ffprobe.binaries' => '/usr/bin/ffprobe',));" \
|
||||
--target_file="$final_path/app/Actions/Photo/Extensions/VideoEditing.php"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public if necessary or protect it
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
|
|
|
@ -17,13 +17,21 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
public_path=$(ynh_app_setting_get --app=$app --key=public_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..." --weight=2
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -36,21 +44,13 @@ ynh_secure_remove --file="$final_path"
|
|||
# REMOVE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# Remove the app data directory with the command `yunohost app remove lychee --purge`
|
||||
if [ "$YNH_APP_PURGE" == true ]
|
||||
# Remove the data directory if --purge option is used
|
||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Removing $app data directory..." --weight=2
|
||||
ynh_secure_remove --file="$public_path"
|
||||
ynh_script_progression --message="Removing app data directory..."
|
||||
ynh_secure_remove --file="$datadir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..." --weight=2
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -13,6 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
|
@ -25,26 +27,21 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
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)
|
||||
public_path=$(ynh_app_setting_get --app=$app --key=public_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -66,18 +63,17 @@ chmod -R o-rwx "$final_path"
|
|||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE DATA
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..."
|
||||
|
||||
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
|
||||
ynh_restore_file --origin_path="$public_path" --not_mandatory
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
|
||||
mkdir -p $public_path
|
||||
mkdir -p $datadir
|
||||
|
||||
chmod 755 "$public_path"
|
||||
chmod -R o-rwx "$public_path"
|
||||
chown -R $app:www-data "$public_path"
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
|
@ -90,13 +86,16 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring PHP-FPM configuration..."
|
||||
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"
|
||||
|
||||
# Recreate a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
|
|
|
@ -19,31 +19,35 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
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)
|
||||
public_path=$(ynh_app_setting_get --app=$app --key=public_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up Lychee before upgrading..." --weight=3
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -61,23 +65,23 @@ if [ -z "$final_path" ]; then
|
|||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
# If public_path doesn't exist, create it
|
||||
if [ -z "$public_path" ]; then
|
||||
public_path=/home/yunohost.app/$app
|
||||
mkdir -p $public_path
|
||||
chmod 755 $public_path
|
||||
chown -R $app:www-data $public_path
|
||||
ynh_app_setting_set --app=$app --key=public_path --value=$public_path
|
||||
# If datadir doesn't exist, create it
|
||||
if [ -z "$datadir" ]; then
|
||||
datadir=/home/yunohost.app/$app
|
||||
mkdir -p $datadir
|
||||
chmod 755 $datadir
|
||||
chown -R $app:www-data $datadir
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
fi
|
||||
|
||||
# If new "/home/yunohost.app/$app" doesn't exist, create it
|
||||
if [ -z "/home/yunohost.app/$app" ]; then
|
||||
public_path=/home/yunohost.app/$app
|
||||
mkdir -p $public_path
|
||||
chmod 755 $public_path
|
||||
chown -R $app:www-data $public_path
|
||||
ynh_app_setting_set --app=$app --key=public_path --value=$public_path
|
||||
cp -a "$final_path/public/uploads" "$public_path/uploads"
|
||||
datadir=/home/yunohost.app/$app
|
||||
mkdir -p $datadir
|
||||
chmod 755 $datadir
|
||||
chown -R $app:www-data $datadir
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
cp -a "$final_path/public/uploads" "$datadir/uploads"
|
||||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
|
@ -104,7 +108,7 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=4
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/.env $final_path/public/dist/user.css"
|
||||
ynh_setup_source --dest_dir="$final_path" --keep=".env public/dist/user.css"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
|
@ -126,6 +130,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
|||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -136,40 +141,43 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Composer..." --weight=1
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
|
||||
|
||||
chmod 400 "$final_path/.env"
|
||||
chown $app:$app "$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# INSTALL APP WITH COMPOSER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing app with Composer..." --weight=1
|
||||
|
||||
ynh_install_composer --install_args="--ignore-platform-reqs"
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION CONFIG
|
||||
# BUILDING
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting $app config..."
|
||||
|
||||
# Setup application config
|
||||
#ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
|
||||
|
||||
ynh_replace_string --match_string="\$ffmpeg = FFMpeg::create();" --replace_string="\$ffmpeg = FFMpeg::create(array(\
|
||||
'ffmpeg.binaries' => '/usr/bin/ffmpeg',\
|
||||
'ffprobe.binaries' => '/usr/bin/ffprobe',\
|
||||
));" --target_file="$final_path/app/Actions/Photo/Extensions/VideoEditing.php"
|
||||
|
||||
#=================================================
|
||||
# INSTALL AND INITIALIZE COMPOSER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading $app source files..." --weight=4
|
||||
ynh_script_progression --message="Building..." --weight=4
|
||||
|
||||
ynh_exec_warn_less ynh_composer_exec --commands="dump-autoload"
|
||||
|
||||
pushd $final_path
|
||||
#php$phpversion artisan key:generate
|
||||
php$phpversion artisan migrate -n --force
|
||||
php$phpversion artisan config:clear -n
|
||||
php$phpversion artisan config:cache -n
|
||||
php$phpversion artisan view:clear
|
||||
popd
|
||||
|
||||
ynh_replace_string \
|
||||
--match_string="\$ffmpeg = FFMpeg::create();" \
|
||||
--replace_string="\$ffmpeg = FFMpeg::create(array('ffmpeg.binaries' => '/usr/bin/ffmpeg','ffprobe.binaries' => '/usr/bin/ffprobe',));" \
|
||||
--target_file="$final_path/app/Actions/Photo/Extensions/VideoEditing.php"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod 750 "$final_path/bootstrap/cache"
|
||||
chmod -R o-rwx "$final_path"
|
||||
|
|
Loading…
Add table
Reference in a new issue