From 23819b78d5407cc609161fa4231cec05a3d582a2 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 20 Jun 2021 23:33:46 +0200 Subject: [PATCH 01/13] Initial work on HedgeDoc v2 - Project split into backend and frontend - Relevant services and configuration files created Status: - can be cleanly installed and removed. - services start but the frontend gets caught in the SSO somewhere --- conf/{systemd.service => backend.service} | 6 +-- conf/config.json.example | 51 --------------------- conf/env_backend | 28 ++++++++++++ conf/frontend.service | 27 +++++++++++ conf/nginx.conf | 2 +- scripts/install | 55 ++++++++++++++++------- scripts/remove | 17 ++++--- 7 files changed, 109 insertions(+), 77 deletions(-) rename conf/{systemd.service => backend.service} (76%) delete mode 100644 conf/config.json.example create mode 100644 conf/env_backend create mode 100644 conf/frontend.service diff --git a/conf/systemd.service b/conf/backend.service similarity index 76% rename from conf/systemd.service rename to conf/backend.service index 839ebca..400de95 100644 --- a/conf/systemd.service +++ b/conf/backend.service @@ -1,5 +1,5 @@ [Unit] -Description=HedgeDoc: collaborative Markdown notes +Description=HedgeDoc: collaborative Markdown notes backend Documentation=https://github.com/hedgedoc/hedgedoc After=network.target postgresql.service @@ -7,10 +7,10 @@ After=network.target postgresql.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__ +WorkingDirectory=__FINALPATH__/backend Environment="PATH=__ENV_PATH__" Environment="NODE_ENV=production" -ExecStart=__YNH_NPM__ start --production +ExecStart=__YNH_NPM__ start Restart=always PrivateTmp=true PrivateDevices=true diff --git a/conf/config.json.example b/conf/config.json.example deleted file mode 100644 index 5f6ec2b..0000000 --- a/conf/config.json.example +++ /dev/null @@ -1,51 +0,0 @@ -{ - "production": { - "protocolUseSSL": true, - "domain": "__DOMAIN__", - "port": "__PORT__", - "urlPath": "__PATH__", - "loglevel": "info", - "useCDN": false, - "allowGravatar": false, - "allowFreeURL": false, - "allowAnonymousEdits": true, - "defaultPermission": "locked", - "email": true, - "allowEmailRegister": true, - "imageUploadType": "filesystem", - "tooBusyLag": 1000, - "hsts": { - "enable": true, - "maxAgeSeconds": 31536000, - "includeSubdomains": true, - "preload": true - }, - "csp": { - "enable": true, - "directives": { - }, - "upgradeInsecureRequests": "auto", - "addDefaults": true, - "addDisqus": true, - "addGoogleAnalytics": false - }, - "db": { - "username": "__DB_NAME__", - "password": "__DB_PWD__", - "database": "__DB_NAME__", - "host": "localhost", - "port": "5432", - "dialect": "postgres" - }, - "ldap": { - "url": "ldap://127.0.0.1:389", - "bindDn": null, - "bindCredentials": null, - "searchBase": "ou=users,dc=yunohost,dc=org", - "searchFilter": "(&(|(objectclass=posixAccount))(uid={{username}})(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))", - "usernameField": "cn", - "useridField": "uid", - "providerName": "YunoHost" - } - } -} diff --git a/conf/env_backend b/conf/env_backend new file mode 100644 index 0000000..2fef918 --- /dev/null +++ b/conf/env_backend @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) +# +# SPDX-License-Identifier: CC0-1.0 + +HD_DOMAIN="https://__DOMAIN____PATH__" +PORT=__PORT_BACKEND__ +HD_MEDIA_BACKEND="filesystem" +HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH="uploads/" + +HD_DATABASE_NAME="__DB_NAME__" +HD_DATABASE_USER="__DB_NAME__" +HD_DATABASE_PASS="__DB_PWD__" +HD_DATABASE_HOST="localhost" +HD_DATABASE_PORT="5432" +HD_DATABASE_DIALECT="postgres" + +HD_AUTH_LDAPS="YUNOHOST" +HD_AUTH_LDAP_YUNOHOST_PROVIDER_NAME="YunoHost" +HD_AUTH_LDAP_YUNOHOST_URL="ldap://127.0.0.1:389" +#HD_AUTH_LDAP_YUNOHOST_BIND_DN=null +#HD_AUTH_LDAP_YUNOHOST_BIND_CREDENTIALS=null +HD_AUTH_LDAP_YUNOHOST_SEARCH_BASE="ou=users,dc=yunohost,dc=org" +HD_AUTH_LDAP_YUNOHOST_SEARCH_FILTER="(&(|(objectclass=posixAccount))(uid={{username}})(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))" +#HD_AUTH_LDAP_YUNOHOST_SEARCH_ATTRIBUTES= +HD_AUTH_LDAP_YUNOHOST_USERNAME_FIELD="cn" +HD_AUTH_LDAP_YUNOHOST_USERID_FIELD="uid" +#HD_AUTH_LDAP_YUNOHOST_TLS_CA= + diff --git a/conf/frontend.service b/conf/frontend.service new file mode 100644 index 0000000..762bfbc --- /dev/null +++ b/conf/frontend.service @@ -0,0 +1,27 @@ +[Unit] +Description=HedgeDoc: collaborative Markdown notes frontend +Documentation=https://github.com/hedgedoc/hedgedoc +After=network.target postgresql.service __APP___backend.service + +[Service] +Type=simple +User=__APP__ +Group=__APP__ +WorkingDirectory=__FINALPATH__/frontend +Environment="PATH=__ENV_PATH__" +Environment="NODE_ENV=production" +Environment="PORT=__PORT_FRONTEND__" +Environment="REACT_APP_BACKEND_BASE_URL=http://localhost:__PORT_BACKEND__/" +ExecStart=__FINALPATH__/frontend/node_modules/.bin/cross-env PORT=__PORT_FRONTEND__ REACT_APP_BACKEND_BASE_URL=http://localhost:__PORT_BACKEND__/ __FINAL_PATH__/frontend/node_modules/.bin/craco start +Restart=always +PrivateTmp=true +PrivateDevices=true + +ProtectControlGroups=true +ProtectHome=true +ProtectKernelTunables=true +ProtectSystem=full +RestrictSUIDSGID=true + +[Install] +WantedBy=multi-user.target diff --git a/conf/nginx.conf b/conf/nginx.conf index a0fc0ae..ce4e4fc 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,7 +5,7 @@ location ^~ __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } - proxy_pass http://127.0.0.1:__PORT__/; + proxy_pass http://127.0.0.1:__PORT_FRONTEND__/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; diff --git a/scripts/install b/scripts/install index 7c328f7..0c986bf 100644 --- a/scripts/install +++ b/scripts/install @@ -53,11 +53,15 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=2 +ynh_script_progression --message="Finding available ports..." --weight=2 -# Find an available port -port=$(ynh_find_port --port=3000) -ynh_app_setting_set --app=$app --key=port --value=$port +# Find an available port for the backend +port_backend=$(ynh_find_port --port=3000) +ynh_app_setting_set --app=$app --key=port_backend --value=$port_backend + +# Find an available port for the frontend +port_frontend=$(ynh_find_port --port=$(($port_backend+1))) +ynh_app_setting_set --app=$app --key=port_frontend --value=$port_frontend #================================================= # INSTALL DEPENDENCIES @@ -97,7 +101,11 @@ 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 +mkdir -p $final_path/backend +mkdir -p $final_path/frontend +git clone --depth 1 https://github.com/hedgedoc/hedgedoc -b develop $final_path/backend +git clone --depth 1 https://github.com/hedgedoc/react-client $final_path/frontend #================================================= # NGINX CONFIGURATION @@ -112,11 +120,22 @@ ynh_add_nginx_config #============================================== # INSTALL HEDGEDOC #============================================== -ynh_script_progression --message="Building HedgeDoc... (this will take some time and resources!)" --weight=20 +ynh_use_nodejs -pushd "$final_path" || ynh_die - ynh_use_nodejs - bin/setup +ynh_script_progression --message="Building HedgeDoc backend... (this will take some time and resources!)" --weight=20 + +pushd "$final_path/backend" || ynh_die + ynh_exec_warn_less yarn install +popd || ynh_die + +ynh_script_progression --message="Building HedgeDoc frontend... (this will take some time and resources!)" --weight=20 + +pushd "$final_path/frontend" || ynh_die + ynh_exec_warn_less yarn install + # TODO: Fails out of memory in my tests + # Production build + # Not sure if PORT is necessary here + # PORT=$port_frontend REACT_APP_BACKEND_BASE_URL=http://localhost:$port_backend/ yarn build:production popd || ynh_die #================================================= @@ -124,18 +143,19 @@ popd || ynh_die #================================================= 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_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/backend.service" +ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/frontend.service" -ynh_add_systemd_config +ynh_add_systemd_config --service="${app}_backend" --template="../conf/backend.service" +ynh_add_systemd_config --service="${app}_frontend" --template="../conf/frontend.service" #================================================= # MODIFY A CONFIG FILE #================================================= ynh_script_progression --message="Modifying a config file..." --weight=1 -path=${path_url:1} - -ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" +#path=${path_url:1} +ynh_add_config --template="../conf/env_backend" --destination="$final_path/backend/.env" #================================================= # GENERIC FINALIZATION @@ -147,14 +167,14 @@ ynh_script_progression --message="Securing files and directories..." --weight=1 # Set permissions to app files chown -R $app:$app $final_path chmod o-rwx $final_path -chmod 600 $final_path/config.json #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 -yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log" +yunohost service add "${app}_backend" --description="Collaborative Markdown editor's backend" --log="/var/log/$app/$app.log" +yunohost service add "${app}_frontend" --description="Collaborative Markdown editor's frontend" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE @@ -162,7 +182,8 @@ yunohost service add $app --description="Collaborative Markdown editor" --log="/ 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" +ynh_systemd_action --service_name="${app}_backend" --action=start --log_path=systemd +ynh_systemd_action --service_name="${app}_frontend" --action=start --log_path=systemd #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 60d5336..e89de26 100644 --- a/scripts/remove +++ b/scripts/remove @@ -28,19 +28,26 @@ db_user=$db_name #================================================= # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null +if ynh_exec_warn_less yunohost service status ${app}_backend >/dev/null then - ynh_script_progression --message="Removing $app service..." --weight=1 - yunohost service remove $app + ynh_script_progression --message="Removing ${app}_backend service..." --weight=1 + yunohost service remove ${app}_backend +fi + +if ynh_exec_warn_less yunohost service status ${app}_frontend >/dev/null +then + ynh_script_progression --message="Removing ${app}_frontend service..." --weight=1 + yunohost service remove ${app}_frontend fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 +ynh_script_progression --message="Stopping and removing the systemd services..." --weight=1 # Remove the dedicated systemd config -ynh_remove_systemd_config +ynh_remove_systemd_config --service=${app}_backend +ynh_remove_systemd_config --service=${app}_frontend #================================================= # REMOVE THE POSTGRESQL DATABASE From eb9e98c4218e3bd3fd3d0afe696d1165bdb41444 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 20 Jun 2021 23:38:50 +0200 Subject: [PATCH 02/13] Bump package version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 6e5e730..de4883f 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Collaborative editor to work on notes written in Markdown", "fr": "Éditeur collaboratif pour travailler sur des notes en Markdown" }, - "version": "1.8.2~ynh2", + "version": "2.0.0~ynh1", "url": "https://hedgedoc.org", "upstream": { "license": "free", From 9e198b450ff48c8ff63640f13d6fc19bc54133f0 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 20 Jun 2021 21:39:09 +0000 Subject: [PATCH 03/13] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bece005..10a7d74 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 Collaborative editor to work on notes written in Markdown -**Shipped version:** 1.8.2~ynh2 +**Shipped version:** 2.0.0~ynh1 **Demo:** https://demo.hedgedoc.org/ diff --git a/README_fr.md b/README_fr.md index 8d24147..1ed9dd6 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 Éditeur collaboratif pour travailler sur des notes en Markdown -**Version incluse :** 1.8.2~ynh2 +**Version incluse :** 2.0.0~ynh1 **Démo :** https://demo.hedgedoc.org/ From 1d8821b9be4f054b0bd60f9957c0869e995ef631 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 28 May 2024 21:26:26 +0000 Subject: [PATCH 04/13] Auto-update READMEs --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bde54da..7b28129 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ It shall NOT be edited by hand. HedgeDoc (formerly known as CodiMD) is an open-source, web-based, self-hosted, collaborative markdown editor. You can use it to easily collaborate on notes, graphs and even presentations in real-time. All you need to do is to share your note-link to your co-workers and they’re ready to go. -**Shipped version:** 2.0.0~ynh1 +### Features - Real-time collaboration - Graphs & diagrams diff --git a/README_fr.md b/README_fr.md index f094223..4dea3b7 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Il NE doit PAS être modifié à la main. HedgeDoc (anciennement connu sous le nom de CodiMD) est un éditeur open source, basé sur le Web, auto-hébergé et collaboratif. Vous pouvez l'utiliser pour collaborer facilement sur des notes, des graphiques et même des présentations en temps réel. Tout ce que vous avez à faire est de partager votre lien de note avec vos collègues et ils sont prêts à partir. -**Version incluse :** 2.0.0~ynh1 +### Caractéristiques - Collaboration en temps réel - Graphiques et diagrammes From c412fb04cdbbf579dee6ae3801a01a4a084d2099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 May 2024 23:31:51 +0200 Subject: [PATCH 05/13] fix --- conf/frontend.service | 6 +++--- manifest.toml | 2 ++ scripts/change_url | 2 +- scripts/install | 19 ------------------- scripts/remove | 5 ----- 5 files changed, 6 insertions(+), 28 deletions(-) diff --git a/conf/frontend.service b/conf/frontend.service index 762bfbc..82896c1 100644 --- a/conf/frontend.service +++ b/conf/frontend.service @@ -7,12 +7,12 @@ After=network.target postgresql.service __APP___backend.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/frontend -Environment="PATH=__ENV_PATH__" +WorkingDirectory=__INSTALL_DIR__/frontend +Environment="__YNH_NODE_LOAD_PATH__" Environment="NODE_ENV=production" Environment="PORT=__PORT_FRONTEND__" Environment="REACT_APP_BACKEND_BASE_URL=http://localhost:__PORT_BACKEND__/" -ExecStart=__FINALPATH__/frontend/node_modules/.bin/cross-env PORT=__PORT_FRONTEND__ REACT_APP_BACKEND_BASE_URL=http://localhost:__PORT_BACKEND__/ __FINAL_PATH__/frontend/node_modules/.bin/craco start +ExecStart=__INSTALL_DIR__/frontend/node_modules/.bin/cross-env PORT=__PORT_FRONTEND__ REACT_APP_BACKEND_BASE_URL=http://localhost:__PORT_BACKEND__/ __INSTALL_DIR__/frontend/node_modules/.bin/craco start Restart=always PrivateTmp=true PrivateDevices=true diff --git a/manifest.toml b/manifest.toml index f1a94c0..f07105d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -53,6 +53,8 @@ ram.runtime = "50M" autoupdate.strategy = "latest_github_tag" [resources.ports] + frontend.default = 3001 + backend.default = 3000 [resources.system_user] diff --git a/scripts/change_url b/scripts/change_url index 85e7e6c..5360056 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -36,7 +36,7 @@ ynh_backup_if_checksum_is_different --file="$install_dir/config.json" domain=$new_domain url_path=${new_path#/} -ynh_add_config --template="../conf/config.json.example" --destination="$install_dir/config.json" +ynh_add_config --template="config.json.example" --destination="$install_dir/config.json" chmod 400 "$install_dir/config.json" chown $app:$app "$install_dir/config.json" diff --git a/scripts/install b/scripts/install index 6872d2b..6ef75d7 100644 --- a/scripts/install +++ b/scripts/install @@ -26,21 +26,6 @@ require_free_url_authentication=false ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding available ports..." --weight=2 - -# Find an available port for the backend -port_backend=$(ynh_find_port --port=3000) -ynh_app_setting_set --app=$app --key=port_backend --value=$port_backend - -# Find an available port for the frontend -port_frontend=$(ynh_find_port --port=$(($port_backend+1))) -ynh_app_setting_set --app=$app --key=port_frontend --value=$port_frontend - #================================================= # INSTALL DEPENDENCIES #================================================= @@ -78,7 +63,6 @@ yunohost service add $app --description="Collaborative Markdown editor" --log="/ #============================================== # INSTALL HEDGEDOC #============================================== - ynh_script_progression --message="Building HedgeDoc backend... (this will take some time and resources!)" --weight=20 pushd "$install_dir/backend" @@ -100,9 +84,6 @@ popd #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/backend.service" -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/frontend.service" - ynh_add_systemd_config --service="${app}_backend" --template="../conf/backend.service" ynh_add_systemd_config --service="${app}_frontend" --template="../conf/frontend.service" diff --git a/scripts/remove b/scripts/remove index 11cded3..9921cdd 100644 --- a/scripts/remove +++ b/scripts/remove @@ -29,11 +29,6 @@ then yunohost service remove ${app}_frontend fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd services..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config --service=${app}_backend ynh_remove_systemd_config --service=${app}_frontend From a70adc8e53195c096d221e035ad7c0614ea6ec3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 May 2024 23:36:01 +0200 Subject: [PATCH 06/13] Update manifest.toml --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index f07105d..b42fe13 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "HedgeDoc" description.en = "Collaborative editor to work on notes written in Markdown" description.fr = "Éditeur collaboratif pour travailler sur des notes en Markdown" -version = "1.9.9~ynh3" +version = "2.0.0~ynh1" maintainers = [] @@ -48,7 +48,7 @@ ram.runtime = "50M" [resources.sources] [resources.sources.main] - url = "https://github.com/hedgedoc/hedgedoc/releases/download/1.9.9/hedgedoc-1.9.9.tar.gz" + url = "https://github.com/hedgedoc/hedgedoc/archive/refs/tags/v2.0.0-alpha.2.tar.gz" sha256 = "1769d30e60458040475a6d74f53952101962c40c390765e19e6ff6f3fe70c008" autoupdate.strategy = "latest_github_tag" From 6b2989914f94949c7a1b0cbad4ffe06156c63e9e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 28 May 2024 21:36:06 +0000 Subject: [PATCH 07/13] Auto-update READMEs --- README.md | 2 +- README_es.md | 2 +- README_eu.md | 2 +- README_fr.md | 2 +- README_gl.md | 2 +- README_zh_Hans.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7b28129..8ec84a7 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Low system requirements -**Shipped version:** 1.9.9~ynh3 +**Shipped version:** 2.0.0~ynh1 **Demo:** diff --git a/README_es.md b/README_es.md index 5a3d137..20bd0cf 100644 --- a/README_es.md +++ b/README_es.md @@ -29,7 +29,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Low system requirements -**Versión actual:** 1.9.9~ynh3 +**Versión actual:** 2.0.0~ynh1 **Demo:** diff --git a/README_eu.md b/README_eu.md index 589c529..c0459df 100644 --- a/README_eu.md +++ b/README_eu.md @@ -29,7 +29,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Low system requirements -**Paketatutako bertsioa:** 1.9.9~ynh3 +**Paketatutako bertsioa:** 2.0.0~ynh1 **Demoa:** diff --git a/README_fr.md b/README_fr.md index 4dea3b7..f8dac27 100644 --- a/README_fr.md +++ b/README_fr.md @@ -29,7 +29,7 @@ Vous pouvez l'utiliser pour collaborer facilement sur des notes, des graphiques - Faible configuration système requise -**Version incluse :** 1.9.9~ynh3 +**Version incluse :** 2.0.0~ynh1 **Démo :** diff --git a/README_gl.md b/README_gl.md index 0f27824..d625360 100644 --- a/README_gl.md +++ b/README_gl.md @@ -29,7 +29,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Low system requirements -**Versión proporcionada:** 1.9.9~ynh3 +**Versión proporcionada:** 2.0.0~ynh1 **Demo:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 8b2602e..de69689 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -29,7 +29,7 @@ You can use it to easily collaborate on notes, graphs and even presentations in - Low system requirements -**分发版本:** 1.9.9~ynh3 +**分发版本:** 2.0.0~ynh1 **演示:** From 8fc87ce9799715c86766d02af1b9ba9a0a595ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 May 2024 23:37:06 +0200 Subject: [PATCH 08/13] Update install --- scripts/install | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 6ef75d7..873553d 100644 --- a/scripts/install +++ b/scripts/install @@ -63,14 +63,12 @@ yunohost service add $app --description="Collaborative Markdown editor" --log="/ #============================================== # INSTALL HEDGEDOC #============================================== -ynh_script_progression --message="Building HedgeDoc backend... (this will take some time and resources!)" --weight=20 +ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20 pushd "$install_dir/backend" ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install popd -ynh_script_progression --message="Building HedgeDoc frontend... (this will take some time and resources!)" --weight=20 - pushd "$install_dir/frontend" ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install # TODO: Fails out of memory in my tests From 78938b266b14f520a4ed8b79c65cda3fd58332b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 May 2024 23:43:54 +0200 Subject: [PATCH 09/13] fix --- scripts/install | 34 ++++++++++------------------------ scripts/upgrade | 19 +++++++++++++------ 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/scripts/install b/scripts/install index 873553d..aa10705 100644 --- a/scripts/install +++ b/scripts/install @@ -38,14 +38,12 @@ ynh_use_nodejs #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=2 +ynh_script_progression --message="Setting up source files..." --weight=1 -# Download, check integrity, uncompress and patch the source from app.src -#ynh_setup_source --dest_dir=$install_dir -mkdir -p $install_dir/backend -mkdir -p $install_dir/frontend -git clone --depth 1 https://github.com/hedgedoc/hedgedoc -b develop $install_dir/backend -git clone --depth 1 https://github.com/hedgedoc/react-client $install_dir/frontend +# Download, check integrity, uncompress and patch the source from manifest.toml +ynh_setup_source --dest_dir="$install_dir" + +chown -R "$app:www-data" "$install_dir" #================================================= # SYSTEM CONFIGURATION @@ -56,7 +54,11 @@ ynh_add_nginx_config ynh_add_systemd_config -yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log" +ynh_add_systemd_config --service="${app}_backend" --template="../conf/backend.service" +ynh_add_systemd_config --service="${app}_frontend" --template="../conf/frontend.service" + +yunohost service add "${app}_backend" --description="Collaborative Markdown editor's backend" --log="/var/log/$app/$app.log" +yunohost service add "${app}_frontend" --description="Collaborative Markdown editor's frontend" --log="/var/log/$app/$app.log" #================================================= # SPECIFIC SETUP @@ -77,14 +79,6 @@ pushd "$install_dir/frontend" # PORT=$port_frontend REACT_APP_BACKEND_BASE_URL=http://localhost:$port_backend/ yarn build:production popd -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -ynh_add_systemd_config --service="${app}_backend" --template="../conf/backend.service" -ynh_add_systemd_config --service="${app}_frontend" --template="../conf/frontend.service" - #================================================= # MODIFY A CONFIG FILE #================================================= @@ -104,14 +98,6 @@ ynh_script_progression --message="Securing files and directories..." --weight=1 chown -R $app:$app $install_dir chmod o-rwx $install_dir -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 - -yunohost service add "${app}_backend" --description="Collaborative Markdown editor's backend" --log="/var/log/$app/$app.log" -yunohost service add "${app}_frontend" --description="Collaborative Markdown editor's frontend" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 275c1d4..8044523 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -77,11 +77,16 @@ yunohost service add $app --description="Collaborative Markdown editor" --log="/ #============================================== ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=10 -pushd "$install_dir" - ynh_secure_remove /usr/local/share/.cache/yarn - ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn workspaces focus --production - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean +pushd "$install_dir/backend" + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install +popd + +pushd "$install_dir/frontend" + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install + # TODO: Fails out of memory in my tests + # Production build + # Not sure if PORT is necessary here + # PORT=$port_frontend REACT_APP_BACKEND_BASE_URL=http://localhost:$port_backend/ yarn build:production popd #================================================= @@ -100,7 +105,9 @@ chown $app:$app "$install_dir/config.json" #================================================= 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" +# Start a systemd service +ynh_systemd_action --service_name="${app}_backend" --action=start --log_path=systemd +ynh_systemd_action --service_name="${app}_frontend" --action=start --log_path=systemd #================================================= # END OF SCRIPT From c732241ac51ea58a2fd3fa2388fe4b53c948a5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 May 2024 23:44:52 +0200 Subject: [PATCH 10/13] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index b42fe13..812f772 100644 --- a/manifest.toml +++ b/manifest.toml @@ -49,7 +49,7 @@ ram.runtime = "50M" [resources.sources.main] url = "https://github.com/hedgedoc/hedgedoc/archive/refs/tags/v2.0.0-alpha.2.tar.gz" - sha256 = "1769d30e60458040475a6d74f53952101962c40c390765e19e6ff6f3fe70c008" + sha256 = "626bdb721b7ec13b4103bfc8b043cca6bc5037c87cbf73b5aace2e44758a0c2a" autoupdate.strategy = "latest_github_tag" [resources.ports] From 3f568fe745b0da2643cc711affc9ca3587388729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 May 2024 23:50:11 +0200 Subject: [PATCH 11/13] Update nginx.conf --- conf/nginx.conf | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 9357598..65cfb35 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,26 +1,27 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - proxy_pass http://127.0.0.1:__PORT_FRONTEND__/; - 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 Connection "upgrade"; - proxy_set_header Upgrade $http_upgrade; - - # setup for image upload - client_max_body_size 256M; - proxy_max_temp_file_size 1024M; - - proxy_read_timeout 300; - proxy_connect_timeout 300; - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; - more_clear_input_headers 'Accept-Encoding'; + proxy_pass http://127.0.0.1:__PORT_FRONTEND__; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; +} + +location ~ ^__PATH__/(api|public|uploads|apidoc)/ { + proxy_pass http://127.0.0.1:__PORT_BACKEND__; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; +} + +location __PATH__/realtime { + proxy_pass http://127.0.0.1:__PORT_BACKEND__; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; } From 780bbf092ae715146c4df6e4418b39881b4b3bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 May 2024 23:50:55 +0200 Subject: [PATCH 12/13] Update install --- scripts/install | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/install b/scripts/install index aa10705..c9b8069 100644 --- a/scripts/install +++ b/scripts/install @@ -52,8 +52,6 @@ ynh_script_progression --message="Adding system configurations related to $app.. ynh_add_nginx_config -ynh_add_systemd_config - ynh_add_systemd_config --service="${app}_backend" --template="../conf/backend.service" ynh_add_systemd_config --service="${app}_frontend" --template="../conf/frontend.service" From b8ca88d3e10d430c835b28b75f1c97ed0d675379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 May 2024 23:52:48 +0200 Subject: [PATCH 13/13] Update restore --- scripts/restore | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/restore b/scripts/restore index f41173e..d675310 100644 --- a/scripts/restore +++ b/scripts/restore @@ -43,17 +43,18 @@ ynh_script_progression --message="Restoring system configurations related to $ap ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +ynh_restore_file --origin_path="/etc/systemd/system/${app}_backend.service" +ynh_restore_file --origin_path="/etc/systemd/system/${app}_frontend.service" systemctl enable $app.service --quiet -yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log" - #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" +# Start a systemd service +ynh_systemd_action --service_name="${app}_backend" --action=start --log_path=systemd +ynh_systemd_action --service_name="${app}_frontend" --action=start --log_path=systemd ynh_systemd_action --service_name=nginx --action=reload