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 branch 'testing' into version-2

This commit is contained in:
tituspijean 2023-04-10 19:22:01 +02:00
commit ec2cc1da12
No known key found for this signature in database
GPG key ID: EF3B0D7CC0A94720
13 changed files with 158 additions and 182 deletions

View file

@ -18,7 +18,11 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Synapse-admin is an Admin UI for Matrix Synapse homeserver.
<<<<<<< HEAD
**Shipped version:** 0.8.7~ynh1
=======
**Shipped version:** 0.8.7~ynh2
>>>>>>> testing
## Screenshots

View file

@ -18,7 +18,11 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
Synapse-admin is an Admin UI for Matrix Synapse homeserver.
<<<<<<< HEAD
**Version incluse :** 0.8.7~ynh1
=======
**Version incluse :** 0.8.7~ynh2
>>>>>>> testing
## Captures décran

28
check_process Normal file
View file

@ -0,0 +1,28 @@
;; Test complet
; pre-install
sudo yunohost tools update apps
sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/tree/823f98a8cbe108ad4cc0e38e280a83401dca2b9f -a "domain=sub.domain.tld&server_name=$server_name&is_free_registration=$is_free_registration&jitsi_server=$jitsi_server" --force
; Manifest
domain="domain.tld"
synapse_app="synapse"
synapse_domain="sub.domain.tld"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=4eaa242f11e8e9c6ed7afbb7cdf07fd95f8d04a1
backup_restore=1
multi_instance=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=4eaa242f11e8e9c6ed7afbb7cdf07fd95f8d04a1
name=Upgrade from 0.8.5~ynh5 and remove app build
manifest_arg=domain=DOMAIN&synapse_app=synapse&synapse_domain=sub.domain.tld&

View file

@ -1,8 +0,0 @@
# This setting allows to fix the homeserver.
# 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://__SYNAPSE_DOMAIN__
#Define the port to avoid collisions on port 3000
PORT=__PORT__

View file

@ -1,19 +1,10 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
alias __FINAL_PATH__/;
client_max_body_size 50M;
index index.html;
try_files $uri $uri/ /index.html;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;

56
manifest.json Normal file
View file

@ -0,0 +1,56 @@
{
"name": "Synapse Admin",
"id": "synapse-admin",
"packaging_format": 1,
"description": {
"en": "Admin UI for Synapse",
"fr": "Admin UI pour Synapse"
},
"version": "0.8.7~ynh2",
"url": "https://github.com/Awesome-Technologies/synapse-admin",
"upstream": {
"license": "Apache-2.0",
"code": "https://github.com/Awesome-Technologies/synapse-admin"
},
"license": "Apache-2.0",
"maintainer": {
"name": ""
},
"requirements": {
"yunohost": ">= 11.1.14"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "synapse_app",
"type": "string",
"ask": {
"en": "Input the Synapse app ID you wish to connect to.",
"fr": "Entrez l'ID de l'app Synapse à laquelle vous souhaitez vous connecter."
},
"help": {
"en": "Leave the default value if you have only one Synapse server installed.",
"fr": "Laissez la valeur par défaut si vous n'avez installé qu'un seul serveur Synapse."
},
"default": "synapse"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If enabled, Synapse Admin 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, Synapse Admin sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
},
"default": true
}
]
}
}

View file

@ -4,8 +4,11 @@
# COMMON VARIABLES
#=================================================
<<<<<<< HEAD
nodejs_version=16
=======
>>>>>>> testing
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -27,18 +27,6 @@ ynh_backup --src_path="$install_dir"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -11,13 +11,6 @@ source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=stop --log_path="systemd"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
@ -28,12 +21,11 @@ ynh_change_url_nginx_config
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT

View file

@ -24,13 +24,7 @@ ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain
ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=20
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
# STANDARD MODIFICATIONS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -56,55 +50,15 @@ ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d
#=================================================
# SPECIFIC SETUP
#==============================================
# INSTALL SYNAPSE-ADMIN
#==============================================
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less yarn install
ynh_exec_warn_less yarn build
popd
# SETUP SSOWAT
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression --message="Configuring permissions..." --weight=1
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
chown -R $app:www-data "$install_dir"
#=================================================
# 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
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "UI admin for Synapse" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #--line_match="HTTP Server listening"
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# END OF SCRIPT

View file

@ -9,6 +9,13 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain)
#=================================================
# STANDARD REMOVE
#=================================================
@ -23,27 +30,12 @@ then
fi
#=================================================
# STOP AND REMOVE SERVICE
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
ynh_script_progression --message="Removing app main directory..." --weight=6
# 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
#=================================================
# Remove metapackage and its dependencies
ynh_remove_nodejs
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION

View file

@ -30,6 +30,7 @@ chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
<<<<<<< HEAD
# SPECIFIC RESTORATION
#=================================================
@ -66,6 +67,8 @@ 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"
#=================================================
=======
>>>>>>> testing
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX

View file

@ -25,24 +25,49 @@ then
ynh_die --message="Upgrade from version 0.8.3 is not possible. You must uninstall and reinstall Synapse-admin package manually"
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
# If synapse_app doesn't exist, create it and assume it is `synapse`
if [ -z "$synapse_app" ]; then
synapse_app="synapse"
ynh_app_setting_set --app=$app --key=synapse_app --value=$synapse_app
fi
# Delete service and nodejs dependencies
if ynh_compare_current_package_version --comparison lt --version 0.8.7~ynh1
then
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
yunohost service remove $app
ynh_remove_nodejs
ynh_remove_logrotate
ynh_remove_app_dependencies
ynh_app_setting_delete --app=$app --key=synapse_port
ynh_app_setting_delete --app=$app --key=port
fi
# Reload and store Synapse's settings, in case of they changed
synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain)
synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port)
ynh_app_setting_set --app=$app --key=synapse_domain --value=$synapse_domain
ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=16
ynh_script_progression --message="Upgrading source files..." --weight=2
ynh_setup_source --dest_dir="$install_dir" --keep=".env"
ynh_setup_source --dest_dir="$final_path"
fi
chmod -R o-rwx "$install_dir"
@ -51,7 +76,7 @@ chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
@ -59,62 +84,6 @@ ynh_add_nginx_config
# Create NGINX config to access /_synapse/admin endpoint
ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=18
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# SPECIFIC UPGRADE
#==============================================
# INSTALL CODIMD
#==============================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20
pushd "$install_dir"
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="$install_dir/.env"
#chown -R $app:www-data "$install_dir"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
env_path="$PATH"
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "UI admin for Synapse" --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=systemd #--line_match="HTTP Server listening"
#=================================================
# END OF SCRIPT
#=================================================