diff --git a/README.md b/README.md index 1366ca4..cc5282a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Admin UI for Synapse -**Shipped version:** 0.8.1~ynh1 +**Shipped version:** 0.8.3~ynh1 diff --git a/README_fr.md b/README_fr.md index 63209c8..ae2daa9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Admin UI pour Synapse -**Version incluse :** 0.8.1~ynh1 +**Version incluse :** 0.8.3~ynh1 diff --git a/conf/.env b/conf/.env index 3738711..8c774b2 100644 --- a/conf/.env +++ b/conf/.env @@ -2,7 +2,7 @@ # If you set this setting, the user will not be able to select # the server and have to use synapse-admin with this server. -#REACT_APP_SERVER=https:// +REACT_APP_SERVER=https://__DOMAIN__ #Define the port to avoid collisions on port 3000 PORT=__PORT__ diff --git a/conf/app.src b/conf/app.src index 489b389..d210988 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,5 @@ -SOURCE_URL=https://github.com/Awesome-Technologies/synapse-admin/archive/refs/tags/0.8.1.tar.gz -SOURCE_SUM=a939bc4f98246eac7c8cfb42f936129697bae2e9547541bcf6b4aafa816d6613 +SOURCE_URL=https://github.com/Awesome-Technologies/synapse-admin/archive/refs/tags/0.8.4.tar.gz +SOURCE_SUM=5c49b539587bb58ccddf0aa102215dfb963b848cab9e8078f1ad5d626ffda98f SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= +SOURCE_IN_SUBDIR=true \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index db0ec62..67627c3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,10 +1,5 @@ location / { - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - proxy_pass http://127.0.0.1:__PORT__; proxy_redirect off; proxy_set_header Host $host; @@ -20,3 +15,27 @@ location / { # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } + +location /.well-known/matrix/server { + return 200 '{ "m.server": "__DOMAIN__:443" }'; +} + +location /.well-known/matrix/client { + return 200 '{ "m.homeserver": { "base_url": "https://__DOMAIN__" } }'; +} + +location /_matrix { + proxy_pass http://localhost:8008; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $host; + proxy_read_timeout 600; + client_max_body_size 100M; +} + +location /_synapse/admin { + proxy_pass http://localhost:8008; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $host; + proxy_read_timeout 600; + client_max_body_size 100M; +} diff --git a/manifest.json b/manifest.json index 9611a67..2e95c53 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Admin UI for Synapse", "fr": "Admin UI pour Synapse" }, - "version": "0.8.1~ynh1", + "version": "0.8.3~ynh1", "url": "https://github.com/Awesome-Technologies/synapse-admin", "upstream": { "license": "Apache-2.0", @@ -18,7 +18,7 @@ "name": "" }, "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": false, "services": [ @@ -28,8 +28,7 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "domain.org" + "type": "domain" }, { "name": "is_public", diff --git a/scripts/_common.sh b/scripts/_common.sh index e70b795..4c705df 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -version_commit="40d0813898bccb30f00e585718176be8e4821bbe" +version_commit="abc9d5154eeee86b2cb23b349a7326483249ee0c" nodejs_version=12 diff --git a/scripts/backup b/scripts/backup index 3c0e9fa..d104a02 100644 --- a/scripts/backup +++ b/scripts/backup @@ -43,6 +43,12 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/install b/scripts/install index e39fc81..c3b0557 100644 --- a/scripts/install +++ b/scripts/install @@ -82,13 +82,13 @@ ynh_script_progression --message="Setting up source files..." --weight=2 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 +ynh_setup_source --dest_dir=$final_path -git clone --quiet https://github.com/Awesome-Technologies/synapse-admin.git -b master "$final_path" +#git clone --quiet https://github.com/Awesome-Technologies/synapse-admin.git -b master "$final_path" # Reset branch to the level of update we needed -pushd "$final_path" - git reset --hard --quiet $version_commit -popd +#pushd "$final_path" +# git reset --hard --quiet $version_commit +#popd chmod 750 "$final_path" chmod -R o-rwx "$final_path" @@ -119,19 +119,9 @@ ynh_script_progression --message="Building $app... (this will take some time and pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less yarn install + ynh_exec_warn_less yarn build popd -chown -R $app: $final_path - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" - -ynh_add_systemd_config - #================================================= # ADD A CONFIGURATION #================================================= @@ -139,15 +129,23 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/.env" --destination="$final_path/.env" -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." +chown -R $app:www-data "$final_path" -# Set permissions to app files -chown -R $app: $final_path +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." --weight=1 + +env_path="$PATH" +ynh_add_systemd_config + +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." --weight=1 + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/remove b/scripts/remove index ed9f121..09d8112 100644 --- a/scripts/remove +++ b/scripts/remove @@ -41,6 +41,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # REMOVE DEPENDENCIES #================================================= diff --git a/scripts/restore b/scripts/restore index 31fb592..e3da35e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -32,10 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_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 " +test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -86,6 +83,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 945183c..a186602 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,22 +24,9 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -54,6 +41,18 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -79,12 +78,14 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=160 - pushd "$final_path" - git fetch --quiet - git checkout master --quiet - git pull --quiet - git reset --hard $version_commit --quiet - popd + ynh_setup_source --dest_dir="$final_path" --keep="$final_path/.env" + + #pushd "$final_path" + # git fetch --quiet + # git checkout master --quiet + # git pull --quiet + # git reset --hard $version_commit --quiet + #popd fi chmod 750 "$final_path" @@ -122,16 +123,25 @@ then pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less yarn install + ynh_exec_warn_less yarn build popd fi +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="../conf/.env" --destination="$final_path/.env" + +chown -R $app:www-data "$final_path" + #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=2 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" - +env_path="$PATH" # Create a dedicated systemd config ynh_add_systemd_config @@ -147,7 +157,7 @@ yunohost service add $app --description "UI admin for Synapse" --log="/var/log/$ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="HTTP Server listening" #================================================= # RELOAD NGINX