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:
Éric Gaspar 2023-01-10 15:51:22 +01:00
parent 81bbb127a0
commit 00e9ce9489
5 changed files with 42 additions and 31 deletions

View file

@ -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

View file

@ -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

View file

@ -19,7 +19,7 @@
"name": ""
},
"requirements": {
"yunohost": ">= 4.3.0"
"yunohost": ">= 11.0.9"
},
"multi_instance": false,
"services": [

View file

@ -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
#=================================================

View file

@ -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
#=================================================