1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse-admin_ynh.git synced 2024-09-03 20:26:34 +02:00

Merge pull request #4 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2022-02-05 23:08:17 +01:00 committed by GitHub
commit 6457bf763a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 110 additions and 67 deletions

View file

@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Admin UI for Synapse Admin UI for Synapse
**Shipped version:** 0.8.1~ynh1 **Shipped version:** 0.8.3~ynh1

View file

@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Admin UI pour Synapse Admin UI pour Synapse
**Version incluse :** 0.8.1~ynh1 **Version incluse :** 0.8.3~ynh1

View file

@ -2,7 +2,7 @@
# If you set this setting, the user will not be able to select # If you set this setting, the user will not be able to select
# the server and have to use synapse-admin with this server. # 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 #Define the port to avoid collisions on port 3000
PORT=__PORT__ PORT=__PORT__

View file

@ -1,6 +1,5 @@
SOURCE_URL=https://github.com/Awesome-Technologies/synapse-admin/archive/refs/tags/0.8.1.tar.gz SOURCE_URL=https://github.com/Awesome-Technologies/synapse-admin/archive/refs/tags/0.8.4.tar.gz
SOURCE_SUM=a939bc4f98246eac7c8cfb42f936129697bae2e9547541bcf6b4aafa816d6613 SOURCE_SUM=5c49b539587bb58ccddf0aa102215dfb963b848cab9e8078f1ad5d626ffda98f
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,10 +1,5 @@
location / { location / {
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect off; proxy_redirect off;
proxy_set_header Host $host; proxy_set_header Host $host;
@ -20,3 +15,27 @@ location / {
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; 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;
}

View file

@ -6,7 +6,7 @@
"en": "Admin UI for Synapse", "en": "Admin UI for Synapse",
"fr": "Admin UI pour Synapse" "fr": "Admin UI pour Synapse"
}, },
"version": "0.8.1~ynh1", "version": "0.8.3~ynh1",
"url": "https://github.com/Awesome-Technologies/synapse-admin", "url": "https://github.com/Awesome-Technologies/synapse-admin",
"upstream": { "upstream": {
"license": "Apache-2.0", "license": "Apache-2.0",
@ -18,7 +18,7 @@
"name": "" "name": ""
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.2.4" "yunohost": ">= 4.3.0"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
@ -28,8 +28,7 @@
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"example": "domain.org"
}, },
{ {
"name": "is_public", "name": "is_public",

View file

@ -4,7 +4,7 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
version_commit="40d0813898bccb30f00e585718176be8e4821bbe" version_commit="abc9d5154eeee86b2cb23b349a7326483249ee0c"
nodejs_version=12 nodejs_version=12

View file

@ -43,6 +43,12 @@ ynh_backup --src_path="$final_path"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================

View file

@ -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 ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # 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 # Reset branch to the level of update we needed
pushd "$final_path" #pushd "$final_path"
git reset --hard --quiet $version_commit # git reset --hard --quiet $version_commit
popd #popd
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$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" pushd "$final_path"
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less yarn install ynh_exec_warn_less yarn install
ynh_exec_warn_less yarn build
popd 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 # 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" ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
#================================================= chown -R $app:www-data "$final_path"
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# 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 # INTEGRATE SERVICE IN YUNOHOST

View file

@ -41,6 +41,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_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 # REMOVE DEPENDENCIES
#================================================= #=================================================

View file

@ -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_script_progression --message="Validating restoration parameters..." --weight=2
ynh_webpath_available --domain=$domain --path_url=$path_url \ test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|| 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 # 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" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet 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 # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================

View file

@ -24,22 +24,9 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) 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 # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -54,6 +41,18 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors 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 # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -79,12 +78,14 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." --weight=160 ynh_script_progression --message="Upgrading source files..." --weight=160
pushd "$final_path" ynh_setup_source --dest_dir="$final_path" --keep="$final_path/.env"
git fetch --quiet
git checkout master --quiet #pushd "$final_path"
git pull --quiet # git fetch --quiet
git reset --hard $version_commit --quiet # git checkout master --quiet
popd # git pull --quiet
# git reset --hard $version_commit --quiet
#popd
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
@ -122,16 +123,25 @@ then
pushd "$final_path" pushd "$final_path"
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less yarn install ynh_exec_warn_less yarn install
ynh_exec_warn_less yarn build
popd popd
fi 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 # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2 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 # Create a dedicated systemd config
ynh_add_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_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 # RELOAD NGINX