mirror of
https://github.com/YunoHost-Apps/lychee_ynh.git
synced 2024-09-03 19:36:36 +02:00
Use yunohost.app directory for picture storage
This commit is contained in:
parent
c42da3460d
commit
cbf56a468c
7 changed files with 41 additions and 16 deletions
|
@ -33,7 +33,7 @@ TIMEZONE=UTC
|
|||
|
||||
# folders in which the files will be stored
|
||||
#LYCHEE_DIST="/var/www/__APP__/public/dist/"
|
||||
#LYCHEE_UPLOADS="/var/www/__APP__/public/uploads/"
|
||||
LYCHEE_UPLOADS="/home/yunohost.__APP__/uploads/"
|
||||
|
||||
# url to access those files
|
||||
# LYCHEE_DIST_URL="dist/"
|
||||
|
|
|
@ -30,6 +30,10 @@ location ^~ __PATH__/ {
|
|||
|
||||
}
|
||||
|
||||
location /lychee/uploads/ {
|
||||
alias __PUBLIC_PATH__/uploads/ ;
|
||||
}
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ ynh_print_info --message="Backing up Lychee..."
|
|||
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)
|
||||
|
@ -38,7 +39,7 @@ ynh_backup --src_path="$final_path"
|
|||
# BACKUP MEDIA FOLDER
|
||||
#=================================================
|
||||
|
||||
#ynh_backup --src_path="/home/yunohost.$app" --is_big
|
||||
ynh_backup --src_path="$public_path" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
|
@ -33,6 +33,9 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
|
|||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
public_path=/home/yunohost.app/$app
|
||||
test ! -e "${public_path}" || ynh_die --message="${public_path} already exists"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
|
@ -64,13 +67,21 @@ 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"
|
||||
|
||||
#=================================================
|
||||
# CREATE DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
ynh_app_setting_set --app=$app --key=public_path --value=$public_path
|
||||
mkdir -p ${public_path}/uploads
|
||||
mkdir -p ${public_path}/uploads/{big,medium,small,thumb,import}
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_add_nginx_config "public_path"
|
||||
|
||||
#=================================================
|
||||
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||
|
@ -130,21 +141,14 @@ ynh_script_progression --message="Storing the config file checksum..."
|
|||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# CREATE DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
#mkdir -p /home/yunohost.${app}/uploads
|
||||
#mkdir -p /home/yunohost.${app}/uploads/{big,medium,small,thumb,import}
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R $app: $final_path
|
||||
#chown -R $app: /home/yunohost.${app}
|
||||
#chmod -R 750 /home/yunohost.${app}
|
||||
chown -R $app: ${public_path}
|
||||
chmod -R 755 ${public_path}
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -18,6 +18,7 @@ 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
|
||||
|
||||
|
@ -30,6 +31,7 @@ ynh_script_progression --message="Removing Lychee main directory..." --weight=3
|
|||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
ynh_secure_remove --file="$public_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
|
|
|
@ -25,6 +25,7 @@ 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)
|
||||
|
@ -65,10 +66,10 @@ ynh_system_user_create --username=$app
|
|||
#=================================================
|
||||
# RESTORE DATA
|
||||
#=================================================
|
||||
#ynh_script_progression --message="Restoring Lychee data..."
|
||||
ynh_script_progression --message="Restoring Lychee data..."
|
||||
|
||||
# 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="/home/yunohost.$app" --not_mandatory
|
||||
ynh_restore_file --origin_path="$public_path" --not_mandatory
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
|
@ -76,7 +77,8 @@ ynh_system_user_create --username=$app
|
|||
|
||||
# Restore permissions on app files
|
||||
chown -R $app: $final_path
|
||||
#chmod -R 750 /home/yunohost.$app/{uploads,data}
|
||||
chown -R $app: $public_path
|
||||
chmod -R 750 $public_path
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
|
|
|
@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
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)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
|
@ -56,6 +57,16 @@ 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
|
||||
ynh_app_setting_set --app=$app --key=public_path --value=$public_path
|
||||
fi
|
||||
|
||||
if [ ! -d "$public_path/uploads" ]; then
|
||||
mkdir -p $public_path/uploads
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
@ -138,7 +149,8 @@ ynh_store_file_checksum --file="$final_path/.env"
|
|||
|
||||
# Set permissions on app files
|
||||
chown -R $app: $final_path
|
||||
#chmod -R 750 /home/yunohost.$app/{uploads,data}
|
||||
chown -R $app: $public_path
|
||||
chmod -R 750 $public_path
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Add table
Reference in a new issue