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 #35 from YunoHost-Apps/testing

Testing
This commit is contained in:
tituspijean 2023-04-11 18:11:30 +02:00 committed by GitHub
commit 2c7fad7cc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 39 additions and 290 deletions

View file

@ -79,11 +79,11 @@ checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
#if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
#else
#extension=${filename##*.}
#fi
# Rewrite source file
cat <<EOT > conf/$src.src
@ -92,7 +92,6 @@ SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
EOT
echo "... conf/$src.src updated"

View file

@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
@ -33,13 +33,14 @@ jobs:
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'

View file

@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Admin UI for Synapse
**Shipped version:** 0.8.5~ynh5
**Shipped version:** 0.8.7~ynh2
## Screenshots

View file

@ -18,7 +18,7 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
Admin UI pour Synapse
**Version incluse :** 0.8.5~ynh5
**Version incluse :** 0.8.7~ynh2
## Captures décran

View file

@ -15,9 +15,14 @@
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,5 +1,5 @@
SOURCE_URL=https://github.com/Awesome-Technologies/synapse-admin/archive/refs/tags/0.8.5.tar.gz
SOURCE_SUM=9d3a3fd8f110e937061e37ebf2298f824f171020df8933a229f2ec40684394a8
SOURCE_URL=https://github.com/Awesome-Technologies/synapse-admin/releases/download/0.8.7/synapse-admin-0.8.7-dirty.tar.gz
SOURCE_SUM=3f74cbfec0a3b14b5684d1bded4816a7946d2e9b88b7186767189c14811224e9
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

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;
alias __FINAL_PATH__/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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;

View file

@ -1,16 +0,0 @@
[Unit]
Description=Synapse Admin
After=network.target
[Service]
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__
Environment="PATH=__ENV_PATH__"
Environment="NODE_ENV=production"
ExecStart=/usr/bin/yarn start -p __PORT__
Restart=always
[Install]
WantedBy=multi-user.target

View file

@ -6,7 +6,7 @@
"en": "Admin UI for Synapse",
"fr": "Admin UI pour Synapse"
},
"version": "0.8.5~ynh5",
"version": "0.8.7~ynh2",
"url": "https://github.com/Awesome-Technologies/synapse-admin",
"upstream": {
"license": "Apache-2.0",
@ -17,14 +17,14 @@
"name": ""
},
"requirements": {
"yunohost": ">= 11.0.9"
"yunohost": ">= 11.1.14"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"

View file

@ -4,10 +4,6 @@
# COMMON VARIABLES
#=================================================
version_commit="abc9d5154eeee86b2cb23b349a7326483249ee0c"
nodejs_version=12
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -46,18 +46,6 @@ 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/${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

@ -28,7 +28,6 @@ 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
@ -65,13 +64,6 @@ fi
#=================================================
# 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
#=================================================
@ -103,14 +95,6 @@ fi
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -53,26 +53,6 @@ ynh_app_setting_set --app=$app --key=synapse_port --value=$synapse_port
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=2
# Find an available port
port=$(ynh_find_port --port=9090)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=20
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -108,57 +88,6 @@ 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=40
pushd "$final_path"
ynh_use_nodejs
ynh_exec_warn_less yarn install
ynh_exec_warn_less yarn build
popd
#=================================================
# 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=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"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1

View file

@ -17,7 +17,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
synapse_app=$(ynh_app_setting_get --app=$app --key=synapse_app)
synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain)
@ -35,30 +34,6 @@ then
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# 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
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_nodejs
#=================================================
# REMOVE APP MAIN DIR
#=================================================

View file

@ -64,48 +64,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=5
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
#=================================================
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"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -31,7 +31,7 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=20
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=5
# Backup the current version of the app
ynh_backup_before_upgrade
@ -64,6 +64,19 @@ if [ -z "$synapse_app" ]; then
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)
@ -72,13 +85,6 @@ 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"
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -93,9 +99,9 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=160
ynh_script_progression --message="Upgrading source files..." --weight=2
ynh_setup_source --dest_dir="$final_path" --keep=".env"
ynh_setup_source --dest_dir="$final_path"
fi
chmod 750 "$final_path"
@ -105,7 +111,7 @@ chown -R $app:www-data "$final_path"
#=================================================
# 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
@ -113,65 +119,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
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=18
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#=================================================
# SPECIFIC UPGRADE
#==============================================
# INSTALL CODIMD
#==============================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=60
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
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"
#=================================================
# RELOAD NGINX
#=================================================