1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minio_ynh.git synced 2024-09-03 19:46:18 +02:00

Adding mc client inside Minio app instead of Outline app

This commit is contained in:
Limezy 2021-11-11 14:43:03 +07:00
parent 5df1ac1895
commit dd309d0412
4 changed files with 38 additions and 0 deletions

7
conf/mc.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://dl.min.io/client/mc/release/linux-amd64/archive/mc.RELEASE.2021-11-05T10-05-06Z
SOURCE_SUM=9f5ad72fd93678f9f756c6da34a8d4d1e61f7356a96ee327c652ad765975d2b2
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=mc
SOURCE_EXTRACT=false

View file

@ -32,6 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
mc_path=$(ynh_app_setting_get --app=$app --key=mc_path)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP

View file

@ -62,6 +62,8 @@ ynh_script_progression --message="Validating installation parameters..." --time
final_path=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
mc_path=$final_path/mc
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -78,6 +80,8 @@ 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=minio_id --value=$minio_id
ynh_app_setting_set --app=$app --key=minio_key --value=$minio_key
ynh_app_setting_set --app=$app --key=mc_path --value=$mc_path
#=================================================
# STANDARD MODIFICATIONS
@ -154,6 +158,30 @@ chmod -R 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK MINIO CLIENT
#=================================================
ynh_script_progression --message="Setting up MinIO client..." --time --weight=1
ynh_setup_source --dest_dir="$mc_path" --source_id=mc
# FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions
# such that the appropriate users (e.g. maybe www-data) can access
# files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue.
chmod -R 750 "$mc_path"
chmod -R o-rwx "$mc_path"
chown -R $app:www-data "$mc_path"
#=================================================
# SETUP MINIO CLIENT
#=================================================
ynh_script_progression --message="Setting up MinIO bucket for Outline..." --time --weight=1
$mc_path/mc alias set minio "https://$domain" $minio_id $minio_key
#=================================================
# NGINX CONFIGURATION
#=================================================

View file

@ -32,6 +32,8 @@ 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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
mc_path=$(ynh_app_setting_get --app=$app --key=mc_path)
#=================================================
# CHECK IF THE APP CAN BE RESTORED