From 00e9ce94891379305fe1a9656cd5155c218afac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 10 Jan 2023 15:51:22 +0100 Subject: [PATCH] 3.0.0 --- conf/app.src | 4 ++-- conf/nginx.conf | 5 +++-- manifest.json | 2 +- scripts/install | 45 ++++++++++++++++++++------------------------- scripts/upgrade | 17 ++++++++++++++++- 5 files changed, 42 insertions(+), 31 deletions(-) diff --git a/conf/app.src b/conf/app.src index 3333aba..7f9ead3 100755 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://gitlab.com/soapbox-pub/soapbox-fe/-/jobs/1396593082/artifacts/download -SOURCE_SUM=7349194c32136d0876987eef1e8d235b87a17e58b68c769e3f18ac97be4564c3 +SOURCE_URL=https://gitlab.com/soapbox-pub/soapbox/-/archive/v3.0.0/soapbox-v3.0.0.zip +SOURCE_SUM=b53d80f9c6f1ff865aecbd2df8e4e007f3bdb4dad70c81c72294d83645631fc9 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 06a5032..1062391 100755 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,5 @@ -location / { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { # Path to source alias __FINALPATH__/static/; @@ -31,7 +32,7 @@ location / { proxy_pass $scheme://127.0.0.1$request_uri; # proxy_redirect $scheme://__DOMAIN__$request_uri $scheme://soapbox.g0v.moe$request_uri; - proxy_set_header Host example.com; + proxy_set_header Host __BACKEND__; proxy_set_header X-Real-IP $remote_addr; # doesn't work with some browsers diff --git a/manifest.json b/manifest.json index bf244e2..76d1560 100755 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ "name": "" }, "requirements": { - "yunohost": ">= 4.3.0" + "yunohost": ">= 11.0.9" }, "multi_instance": false, "services": [ diff --git a/scripts/install b/scripts/install index a1163b9..e035fff 100755 --- a/scripts/install +++ b/scripts/install @@ -20,11 +20,11 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN +path_url="/" backend=$YNH_APP_ARG_BACKEND -app=$YNH_APP_INSTANCE_NAME is_public=$YNH_APP_ARG_IS_PUBLIC -final_path=/var/www/$app -path_url=/ + +app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -44,17 +44,31 @@ 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 + +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=1 + +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # STANDARD MODIFICATIONS #================================================= # 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 + +ynh_setup_source --dest_dir="$final_path" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" -ynh_setup_source --dest_dir="$final_path/static" #================================================= # NGINX CONFIGURATION #================================================= @@ -64,25 +78,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 48b47fb..8034523 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -77,13 +77,28 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path/static" --keep="$$final_path/static/instance/" + ynh_setup_source --dest_dir="$final_path" --keep="static/instance/" fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 + +# Create a dedicated NGINX config +ynh_add_nginx_config + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + #================================================= # END OF SCRIPT #=================================================