1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/soapbox_ynh.git synced 2024-09-03 20:26:11 +02:00
This commit is contained in:
ericgaspar 2022-10-14 09:56:49 +02:00
parent 6c1a02239b
commit 795f1f86d8
9 changed files with 57 additions and 49 deletions

View file

@ -1,9 +1,9 @@
;; Test complet
; Manifest
domain="sub.domain.tld" (DOMAIN)
path="/" (PATH)
domain="sub.domain.tld"
path="/"
backend="domain.tld"
is_public=1 (true|false)
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=0

View file

@ -1,5 +1,6 @@
SOURCE_URL=https://gitlab.com/soapbox-pub/soapbox-fe/-/jobs/1396593082/artifacts/download
SOURCE_SUM=7349194c32136d0876987eef1e8d235b87a17e58b68c769e3f18ac97be4564c3
SOURCE_URL=https://gitlab.com/soapbox-pub/soapbox-fe/-/jobs/3170505527/artifacts/download
SOURCE_SUM=991b0bb6ec52b486c249a222ad664fa738197d67b9ebb9114cb3309e18f96331
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_EXTRACT=true
3170505529

View file

@ -37,7 +37,6 @@ location / {
# doesn't work with some browsers
# return 308 $scheme://__DOMAIN__$request_uri;
}
}

View file

@ -3,8 +3,8 @@
"id": "soapbox",
"packaging_format": 1,
"description": {
"en": "Alternative frontend for pleroma",
"fr": "Alternative frontend for pleroma"
"en": "Alternative frontend for Pleroma",
"fr": "Frontend alternatif pour Pleroma"
},
"version": "1.3.0~ynh1",
"url": "https://soapbox.pub/",
@ -19,7 +19,7 @@
"name": ""
},
"requirements": {
"yunohost": ">= 4.3.0"
"yunohost": ">= 11.0.9"
},
"multi_instance": false,
"services": [

View file

@ -22,6 +22,7 @@ ynh_abort_if_errors
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)

View file

@ -20,11 +20,11 @@ ynh_abort_if_errors
#=================================================
domain=$YNH_APP_ARG_DOMAIN
backend=$YNH_APP_ARG_BACKEND
app=$YNH_APP_INSTANCE_NAME
is_public=$YNH_APP_ARG_IS_PUBLIC
final_path=/var/www/$app
path_url=/
backend=$YNH_APP_ARG_BACKEND
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -45,16 +45,29 @@ ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=backend --value=$backend
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# SETUP SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --time --weight=1
ynh_script_progression --message="Setting up source files..." --weight=1
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/static"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -62,46 +75,31 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_replace_string --match_string="example.com" --replace_string="$backend" --target_file="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# SPECIFIC SETUP
#=================================================
# MODIFY CONFIG FILE
#=================================================
mkdir -p "$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..."
ynh_script_progression --message="Configuring permissions..." --weight=1
# 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
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -24,7 +24,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..."
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -42,7 +42,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app

View file

@ -31,19 +31,11 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=2
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
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
#=================================================
@ -54,7 +46,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path"
@ -63,12 +55,21 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server"
ynh_script_progression --message="Reloading NGINX web server" --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================

View file

@ -72,9 +72,10 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
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/static" --keep="static/instance"
@ -84,6 +85,13 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================