diff --git a/check_process.default b/check_process similarity index 66% rename from check_process.default rename to check_process index 62e1f83..41ad334 100755 --- a/check_process.default +++ b/check_process @@ -1,8 +1,3 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) @@ -16,9 +11,9 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=CommitHash + #upgrade=1 from_commit=CommitHash backup_restore=1 - multi_instance=1 + multi_instance=0 change_url=1 ;;; Options Email= @@ -27,4 +22,3 @@ Notification=none ; commit=CommitHash name=Name and date of the commit. manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& - diff --git a/conf/config.json b/conf/config.json index 598421d..68b2272 100644 --- a/conf/config.json +++ b/conf/config.json @@ -5,7 +5,7 @@ "dbconfig": "postgres://__DB_NAME__:__DB_PWD__@localhost/__DB_NAME__?sslmode=disable&connect_timeout=10", "useSSL": false, "webpath": "./pack", - "filespath": "./files", + "filespath": "/home/yunohost.app/__APP__/files", "telemetry": false, "session_expire_time": 2592000, "session_refresh_time": 18000, diff --git a/conf/nginx.conf b/conf/nginx.conf index d2aad6d..7af9fdd 100755 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,5 @@ -location / { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { # Force usage of https if ($scheme = http) { @@ -27,7 +28,7 @@ location / { more_clear_input_headers 'Accept-Encoding'; } -location /ws/ { +location __PATH__/ws/ { proxy_pass http://127.0.0.1:__PORT__/; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; @@ -47,3 +48,6 @@ location /ws/ { proxy_read_timeout 1d; } +location __PATH__/uploads/ { + alias __FILES_PATH__/uploads/ ; +} diff --git a/manifest.json b/manifest.json index 2e07aad..e01528e 100755 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "requirements": { "yunohost": ">= 4.1.7" }, - "multi_instance": true, + "multi_instance": false, "services": [ "nginx", "mysql" @@ -30,6 +30,10 @@ { "name": "is_public", "type": "boolean", + "help": { + "en": "If enabled, Focalboard will be accessible by people who do not have an account. This can be changed later via the webadmin.", + "fr": "Si cette case est cochée, Focalboard sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." + }, "default": true } ] diff --git a/scripts/change_url b/scripts/change_url index dca5b5b..40aad55 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,6 +28,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP diff --git a/scripts/install b/scripts/install index a64e968..4c0efc9 100755 --- a/scripts/install +++ b/scripts/install @@ -65,7 +65,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER @@ -73,7 +73,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." --weight=11 # Create a system user -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # CREATE A POSTGRESQL DATABASE @@ -94,13 +94,22 @@ 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" +#================================================= +# CREATE DIRECTORIES +#================================================= + +files_path=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=files_path --value=$files_path + +mkdir -p $files_path/files + #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_add_nginx_config "files_path" #================================================= # SETUP SYSTEMD @@ -124,7 +133,9 @@ ynh_add_config --template="../conf/config.json" --destination="$final_path/confi # Set permissions to app files chown -R $app:$app $final_path -chmod -R o-rwx "$final_path" +chown -R $app:$app $files_path +#chmod -R o-rwx $final_path +chmod -R 755 $files_path chmod 600 $final_path/config.json #================================================= @@ -132,7 +143,7 @@ chmod 600 $final_path/config.json #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=4 -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Self-hosted kanban board" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE @@ -140,7 +151,7 @@ yunohost service add $app --description="A short description of the app" --log=" ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 56f8b5c..1a56281 100755 --- a/scripts/remove +++ b/scripts/remove @@ -75,14 +75,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=2 - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index d01a311..46f856b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -66,7 +66,7 @@ ynh_restore_file --origin_path="$final_path" ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE USER RIGHTS @@ -74,7 +74,7 @@ ynh_system_user_create --username=$app # Restore permissions on app files chown -R $app:$app $final_path -chmod -R o-rwx "$final_path" +#chmod -R o-rwx $final_path chmod 600 $final_path/config.json #================================================= @@ -85,7 +85,7 @@ chmod 600 $final_path/config.json ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE POSTGRESQL DATABASE @@ -109,37 +109,22 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Self-hosted kanban board" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - -#================================================= -# RESTORE VARIOUS FILES -#================================================= - -ynh_restore_file --origin_path="/etc/cron.d/$app" - -ynh_restore_file --origin_path="/etc/$app/" - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" +ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2 +ynh_script_progression --message="Reloading NGINX web server..." --weight=2 -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 7b2d89a..2101585 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,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) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +files_path=$(ynh_app_setting_get --app=$app --key=files_path) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION @@ -60,7 +62,7 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -70,8 +72,23 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 + # Create a temporary directory + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -a "$final_path/config.json" "$tmpdir/config.json" + + # Remove the app directory securely + ynh_secure_remove --file="$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" #--keep="foo bar" to integrate when https://github.com/YunoHost/yunohost/pull/1200 is upstream + + # Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/config.json" "$final_path/config.json" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi #================================================= @@ -87,7 +104,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=2 -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER @@ -95,7 +112,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Making sure dedicated system user exists..." --weight=3 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # SETUP SYSTEMD @@ -105,12 +122,6 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# UPDATE A CONFIG FILE -#================================================= - -ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file" - #================================================= # GENERIC FINALIZATION #================================================= @@ -119,30 +130,24 @@ ynh_add_config --template="some_config_file" --destination="$final_path/some_con # Set permissions on app files chown -R $app:$app $final_path -chmod -R o-rwx "$final_path" +chown -R $app:$app $files_path +#chmod -R o-rwx "$final_path" +chmod -R 755 $files_path chmod 600 $final_path/config.json -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=2 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Self-hosted kanban board" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" #================================================= # RELOAD NGINX diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore deleted file mode 100755 index 783a4ae..0000000 --- a/sources/extra_files/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore deleted file mode 100755 index 783a4ae..0000000 --- a/sources/patches/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op]