mirror of
https://github.com/YunoHost-Apps/lychee_ynh.git
synced 2024-09-03 19:36:36 +02:00
Storage (#5)
- Set the media storage to /home.yunohost.app/lychee Co-authored-by: tituspijean <tituspijean@outlook.com>
This commit is contained in:
parent
c42da3460d
commit
00c1e09f1b
10 changed files with 93 additions and 73 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/__APP__/uploads/"
|
||||
|
||||
# url to access those files
|
||||
# LYCHEE_DIST_URL="dist/"
|
||||
|
|
|
@ -30,6 +30,10 @@ location ^~ __PATH__/ {
|
|||
|
||||
}
|
||||
|
||||
location __PATH__/uploads/ {
|
||||
alias __PUBLIC_PATH__/uploads/ ;
|
||||
}
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
|
|
@ -426,5 +426,5 @@ php_admin_value[post_max_size] = 512M
|
|||
; Other common parameters
|
||||
php_admin_value[max_execution_time] = 200
|
||||
; php_admin_value[max_input_time] = 300
|
||||
; php_admin_value[memory_limit] = 256M
|
||||
php_admin_value[memory_limit] = 256M
|
||||
; php_admin_flag[short_open_tag] = On
|
||||
|
|
14
conf/user.css.example
Normal file
14
conf/user.css.example
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* Disable the 'zoom' animation while browsing pictures */
|
||||
#imageview #image {
|
||||
transition: none !important;
|
||||
animation-name: none !important;
|
||||
animation-duration: 0 !important;
|
||||
}
|
||||
|
||||
/* Hide smart albums */
|
||||
/*
|
||||
[data-id="0"] { display:none; }
|
||||
[data-id="s"] { display:none; }
|
||||
[data-id="f"] { display:none; }
|
||||
[data-id="r"] { display:none; }
|
||||
*/
|
|
@ -8,6 +8,9 @@ YNH_PHP_VERSION=7.3
|
|||
|
||||
extra_php_dependencies="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}-json php${YNH_PHP_VERSION}-zip"
|
||||
|
||||
# needed for raw upload and video playback
|
||||
pkg_dependencies="ufraw-batch ffmpeg"
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
@ -71,48 +74,3 @@ ynh_install_composer () {
|
|||
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|
||||
|| ynh_die "Unable to update core dependencies with Composer."
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Install or update the main directory yunohost.multimedia
|
||||
#
|
||||
# usage: ynh_multimedia_build_main_dir
|
||||
ynh_multimedia_build_main_dir () {
|
||||
local ynh_media_release="v1.2"
|
||||
local checksum="806a827ba1902d6911095602a9221181"
|
||||
|
||||
# Download yunohost.multimedia scripts
|
||||
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz
|
||||
|
||||
# Check the control sum
|
||||
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|
||||
|| ynh_die "Corrupt source"
|
||||
|
||||
# Check if the package acl is installed. Or install it.
|
||||
ynh_package_is_installed 'acl' \
|
||||
|| ynh_package_install acl
|
||||
|
||||
# Extract
|
||||
mkdir yunohost.multimedia-master
|
||||
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
|
||||
./yunohost.multimedia-master/script/ynh_media_build.sh
|
||||
}
|
||||
|
||||
# Add a directory in yunohost.multimedia
|
||||
# This "directory" will be a symbolic link to a existing directory.
|
||||
#
|
||||
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
|
||||
#
|
||||
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
|
||||
# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
|
||||
ynh_multimedia_addfolder () {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
|
||||
local source_dir
|
||||
local dest_dir
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -45,6 +48,13 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
|
|||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=3
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -62,7 +72,18 @@ ynh_script_progression --message="Setting up source files..." --weight=3
|
|||
|
||||
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"
|
||||
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,import,medium,raw,small,thumb}
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config "public_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -70,14 +91,7 @@ ynh_setup_source --dest_dir="$final_path"
|
|||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||
#=================================================
|
||||
#ynh_script_progression --message="Adding multimedia directories..." --weight=2
|
||||
|
||||
#ynh_multimedia_build_main_dir
|
||||
ynh_add_nginx_config "public_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -102,7 +116,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
ynh_script_progression --message="Installing Lychee with Composer..." --weight=15
|
||||
|
||||
# Install composer
|
||||
ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" --install_args="--prefer-source --no-dev"
|
||||
ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_args="--prefer-source --no-dev"
|
||||
|
||||
#=================================================
|
||||
# BUILDING
|
||||
|
@ -122,6 +136,9 @@ cd $final_path && php$phpversion artisan migrate -n --force
|
|||
cd $final_path && php$phpversion artisan config:clear -n
|
||||
cd $final_path && php$phpversion artisan config:cache -n
|
||||
|
||||
# Setup custum user.css file
|
||||
#cp ../conf/user.css.example $final_path/public/dist/user.css
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
@ -130,21 +147,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
|
||||
|
@ -39,6 +41,14 @@ 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 DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
|
|
@ -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,16 @@ 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
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
@ -71,10 +82,11 @@ ynh_clean_setup () {
|
|||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=3
|
||||
|
||||
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -138,7 +150,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…
Reference in a new issue