diff --git a/ALL_README.md b/ALL_README.md new file mode 100644 index 0000000..152f2e7 --- /dev/null +++ b/ALL_README.md @@ -0,0 +1,8 @@ +# All available README files by language + +- [Read the README in English](README.md) +- [Lea el README en español](README_es.md) +- [Irakurri README euskaraz](README_eu.md) +- [Lire le README en français](README_fr.md) +- [Le o README en galego](README_gl.md) +- [阅读中文(简体)的 README](README_zh_Hans.md) diff --git a/README.md b/README.md index 10a7d74..bde54da 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,60 @@ # HedgeDoc for YunoHost -[![Integration level](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Working status](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) + [![Install HedgeDoc with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) -*[Lire ce readme en français.](./README_fr.md)* +*[Read this README in other languages.](./ALL_README.md)* -> *This package allows you to install HedgeDoc quickly and simply on a YunoHost server. -If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* +> *This package allows you to install HedgeDoc quickly and simply on a YunoHost server.* +> *If you don't have YunoHost, please consult [the guide](https://yunohost.org/install) to learn how to install it.* ## Overview -Collaborative editor to work on notes written in Markdown +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 -**Demo:** https://demo.hedgedoc.org/ +- Real-time collaboration +- Graphs & diagrams +- Revisions +- Presentation mode +- Easy to use permission system +- Low system requirements + + +**Shipped version:** 1.9.9~ynh3 + +**Demo:** ## Screenshots -![](./doc/screenshots/screenshot.png) - -## Disclaimers / important information - -## Configuration - -You can configure HedgeDoc by editing this file `/var/www/hedgedoc/config.json` using the [documentation](https://github.com/hedgedoc/hedgedoc/blob/master/docs/configuration.md) -When you finished editing the configuration, for your changes to take effect, you will have to run: `sudo systemctl restart hedgedoc`. +![Screenshot of HedgeDoc](./doc/screenshots/screenshot.png) ## Documentation and resources -* Official app website: https://hedgedoc.org -* Official user documentation: https://yunohost.org/en/app_hedgedoc -* Official admin documentation: https://docs.hedgedoc.org/ -* Upstream app code repository: https://github.com/hedgedoc/hedgedoc -* YunoHost documentation for this app: https://yunohost.org/app_hedgedoc -* Report a bug: https://github.com/YunoHost-Apps/hedgedoc_ynh/issues +- Official app website: +- Official admin documentation: +- Upstream app code repository: +- YunoHost Store: +- Report a bug: ## Developer info -Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing). +Please send your pull request to the [`testing` branch](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing). -To try the testing branch, please proceed like that. -``` +To try the `testing` branch, please proceed like that: + +```bash sudo yunohost app install https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug or sudo yunohost app upgrade hedgedoc -u https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_es.md b/README_es.md new file mode 100644 index 0000000..5a3d137 --- /dev/null +++ b/README_es.md @@ -0,0 +1,60 @@ + + +# HedgeDoc para Yunohost + +[![Nivel de integración](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) + +[![Instalar HedgeDoc con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) + +*[Leer este README en otros idiomas.](./ALL_README.md)* + +> *Este paquete le permite instalarHedgeDoc rapidamente y simplement en un servidor YunoHost.* +> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.* + +## Descripción general + +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. + +### Features + +- Real-time collaboration +- Graphs & diagrams +- Revisions +- Presentation mode +- Easy to use permission system +- Low system requirements + + +**Versión actual:** 1.9.9~ynh3 + +**Demo:** + +## Capturas + +![Captura de HedgeDoc](./doc/screenshots/screenshot.png) + +## Documentaciones y recursos + +- Sitio web oficial: +- Documentación administrador oficial: +- Repositorio del código fuente oficial de la aplicación : +- Catálogo YunoHost: +- Reportar un error: + +## Información para desarrolladores + +Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing + +Para probar la rama `testing`, sigue asÍ: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +o +sudo yunohost app upgrade hedgedoc -u https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +``` + +**Mas informaciones sobre el empaquetado de aplicaciones:** diff --git a/README_eu.md b/README_eu.md new file mode 100644 index 0000000..589c529 --- /dev/null +++ b/README_eu.md @@ -0,0 +1,60 @@ + + +# HedgeDoc YunoHost-erako + +[![Integrazio maila](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) + +[![Instalatu HedgeDoc YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) + +*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)* + +> *Pakete honek HedgeDoc YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.* +> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.* + +## Aurreikuspena + +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. + +### Features + +- Real-time collaboration +- Graphs & diagrams +- Revisions +- Presentation mode +- Easy to use permission system +- Low system requirements + + +**Paketatutako bertsioa:** 1.9.9~ynh3 + +**Demoa:** + +## Pantaila-argazkiak + +![HedgeDoc(r)en pantaila-argazkia](./doc/screenshots/screenshot.png) + +## Dokumentazioa eta baliabideak + +- Aplikazioaren webgune ofiziala: +- Administratzaileen dokumentazio ofiziala: +- Jatorrizko aplikazioaren kode-gordailua: +- YunoHost Denda: +- Eman errore baten berri: + +## Garatzaileentzako informazioa + +Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing). + +`testing` abarra probatzeko, ondorengoa egin: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +edo +sudo yunohost app upgrade hedgedoc -u https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +``` + +**Informazio gehiago aplikazioaren paketatzeari buruz:** diff --git a/README_fr.md b/README_fr.md index 1ed9dd6..f094223 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,51 +1,60 @@ + + # HedgeDoc pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) + [![Installer HedgeDoc avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) -*[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* +*[Lire le README dans d'autres langues.](./ALL_README.md)* -> *Ce package vous permet d'installer HedgeDoc rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* +> *Ce package vous permet d’installer HedgeDoc rapidement et simplement sur un serveur YunoHost.* +> *Si vous n’avez pas YunoHost, consultez [ce guide](https://yunohost.org/install) pour savoir comment l’installer et en profiter.* -## Vue d'ensemble +## Vue d’ensemble -Éditeur collaboratif pour travailler sur des notes en Markdown +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 -**Démo :** https://demo.hedgedoc.org/ +- Collaboration en temps réel +- Graphiques et diagrammes +- Révisions +- Mode présentation +- Système d'autorisation facile à utiliser +- Faible configuration système requise -## Captures d'écran -![](./doc/screenshots/screenshot.png) +**Version incluse :** 1.9.9~ynh3 -## Avertissements / informations importantes +**Démo :** -## Configuration +## Captures d’écran -Vous pouvez configurer HedgeDoc en modifiant le fichier `/var/www/hedgedoc/config.json` et en vous aidant de la [documentation](https://github.com/hedgedoc/hedgedoc/blob/master/docs/configuration.md) -Lorsque vous avez terminé de modifier la configuration, pour que vos modifications prennent effet, vous devrez exécuter : `sudo systemctl restart hedgedoc`. +![Capture d’écran de HedgeDoc](./doc/screenshots/screenshot.png) ## Documentations et ressources -* Site officiel de l'app : https://hedgedoc.org -* Documentation officielle utilisateur : https://yunohost.org/en/app_hedgedoc -* Documentation officielle de l'admin : https://docs.hedgedoc.org/ -* Dépôt de code officiel de l'app : https://github.com/hedgedoc/hedgedoc -* Documentation YunoHost pour cette app : https://yunohost.org/app_hedgedoc -* Signaler un bug : https://github.com/YunoHost-Apps/hedgedoc_ynh/issues +- Site officiel de l’app : +- Documentation officielle de l’admin : +- Dépôt de code officiel de l’app : +- YunoHost Store : +- Signaler un bug : ## Informations pour les développeurs -Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing). +Merci de faire vos pull request sur la [branche `testing`](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing). -Pour essayer la branche testing, procédez comme suit. -``` +Pour essayer la branche `testing`, procédez comme suit : + +```bash sudo yunohost app install https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug ou sudo yunohost app upgrade hedgedoc -u https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d’infos sur le packaging d’applications :** diff --git a/README_gl.md b/README_gl.md new file mode 100644 index 0000000..0f27824 --- /dev/null +++ b/README_gl.md @@ -0,0 +1,60 @@ + + +# HedgeDoc para YunoHost + +[![Nivel de integración](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) + +[![Instalar HedgeDoc con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) + +*[Le este README en outros idiomas.](./ALL_README.md)* + +> *Este paquete permíteche instalar HedgeDoc de xeito rápido e doado nun servidor YunoHost.* +> *Se non usas YunoHost, le a [documentación](https://yunohost.org/install) para saber como instalalo.* + +## Vista xeral + +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. + +### Features + +- Real-time collaboration +- Graphs & diagrams +- Revisions +- Presentation mode +- Easy to use permission system +- Low system requirements + + +**Versión proporcionada:** 1.9.9~ynh3 + +**Demo:** + +## Capturas de pantalla + +![Captura de pantalla de HedgeDoc](./doc/screenshots/screenshot.png) + +## Documentación e recursos + +- Web oficial da app: +- Documentación oficial para admin: +- Repositorio de orixe do código: +- Tenda YunoHost: +- Informar dun problema: + +## Info de desenvolvemento + +Envía a túa colaboración á [rama `testing`](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing). + +Para probar a rama `testing`, procede deste xeito: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +ou +sudo yunohost app upgrade hedgedoc -u https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +``` + +**Máis info sobre o empaquetado da app:** diff --git a/README_it.md b/README_it.md new file mode 100644 index 0000000..84694bd --- /dev/null +++ b/README_it.md @@ -0,0 +1,60 @@ + + +# HedgeDoc per YunoHost + +[![Livello di integrazione](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![Stato di funzionamento](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![Stato di manutenzione](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) + +[![Installa HedgeDoc con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) + +*[Leggi questo README in altre lingue.](./ALL_README.md)* + +> *Questo pacchetto ti permette di installare HedgeDoc su un server YunoHost in modo semplice e veloce.* +> *Se non hai YunoHost, consulta [la guida](https://yunohost.org/install) per imparare a installarlo.* + +## Panoramica + +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. + +### Features + +- Real-time collaboration +- Graphs & diagrams +- Revisions +- Presentation mode +- Easy to use permission system +- Low system requirements + + +**Versione pubblicata:** 1.9.9~ynh2 + +**Prova:** + +## Screenshot + +![Screenshot di HedgeDoc](./doc/screenshots/screenshot.png) + +## Documentazione e risorse + +- Sito web ufficiale dell’app: +- Documentazione ufficiale per gli amministratori: +- Repository upstream del codice dell’app: +- Store di YunoHost: +- Segnala un problema: + +## Informazioni per sviluppatori + +Si prega di inviare la tua pull request alla [branch di `testing`](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing). + +Per provare la branch di `testing`, si prega di procedere in questo modo: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +o +sudo yunohost app upgrade hedgedoc -u https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +``` + +**Maggiori informazioni riguardo il pacchetto di quest’app:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md new file mode 100644 index 0000000..8b2602e --- /dev/null +++ b/README_zh_Hans.md @@ -0,0 +1,60 @@ + + +# YunoHost 上的 HedgeDoc + +[![集成程度](https://dash.yunohost.org/integration/hedgedoc.svg)](https://dash.yunohost.org/appci/app/hedgedoc) ![工作状态](https://ci-apps.yunohost.org/ci/badges/hedgedoc.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/hedgedoc.maintain.svg) + +[![使用 YunoHost 安装 HedgeDoc](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=hedgedoc) + +*[阅读此 README 的其它语言版本。](./ALL_README.md)* + +> *通过此软件包,您可以在 YunoHost 服务器上快速、简单地安装 HedgeDoc。* +> *如果您还没有 YunoHost,请参阅[指南](https://yunohost.org/install)了解如何安装它。* + +## 概况 + +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. + +### Features + +- Real-time collaboration +- Graphs & diagrams +- Revisions +- Presentation mode +- Easy to use permission system +- Low system requirements + + +**分发版本:** 1.9.9~ynh3 + +**演示:** + +## 截图 + +![HedgeDoc 的截图](./doc/screenshots/screenshot.png) + +## 文档与资源 + +- 官方应用网站: +- 官方管理文档: +- 上游应用代码库: +- YunoHost 商店: +- 报告 bug: + +## 开发者信息 + +请向 [`testing` 分支](https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing) 发送拉取请求。 + +如要尝试 `testing` 分支,请这样操作: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +或 +sudo yunohost app upgrade hedgedoc -u https://github.com/YunoHost-Apps/hedgedoc_ynh/tree/testing --debug +``` + +**有关应用打包的更多信息:** diff --git a/check_process b/check_process deleted file mode 100644 index 85e5f61..0000000 --- a/check_process +++ /dev/null @@ -1,26 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - admin="john" - is_public=1 - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - upgrade=1 from_commit=2a6ed9db5f7f0644eab251b2495c190811735832 - backup_restore=1 - multi_instance=1 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=2a6ed9db5f7f0644eab251b2495c190811735832 - name=Testing (#13) - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& - diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index d2932ef..0000000 --- a/conf/app.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/hedgedoc/hedgedoc/releases/download/1.8.2/hedgedoc-1.8.2.tar.gz -SOURCE_SUM=e325d433aba6f5e9de91162dd97a605e29ebc5e740750cd47054abfdc1f8fd42 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/conf/backend.service b/conf/backend.service index 400de95..4b8b4f5 100644 --- a/conf/backend.service +++ b/conf/backend.service @@ -7,19 +7,41 @@ After=network.target postgresql.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/backend -Environment="PATH=__ENV_PATH__" +WorkingDirectory=__INSTALL_DIR__/backend +Environment="__YNH_NODE_LOAD_PATH__" Environment="NODE_ENV=production" ExecStart=__YNH_NPM__ start Restart=always -PrivateTmp=true -PrivateDevices=true -ProtectControlGroups=true -ProtectHome=true -ProtectKernelTunables=true +# Sandboxing options to harden security +# Depending on specificities of your service/app, you may need to tweak these +# .. but this should be a good baseline +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed ProtectSystem=full -RestrictSUIDSGID=true +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG [Install] WantedBy=multi-user.target diff --git a/conf/nginx.conf b/conf/nginx.conf index ce4e4fc..9357598 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,9 +1,5 @@ -location ^~ __PATH__/ { - - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { proxy_pass http://127.0.0.1:__PORT_FRONTEND__/; proxy_redirect off; diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..535c889 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,52 @@ +version = "1.0" + +[main] +name = "HedgeDoc configuration" +services = ["__APP__"] + + [main.config] + name = "Configuration Options" + + [main.config.allow_anonymous] + ask = "Allow anonymous usage" + type = "boolean" + yes = "true" + no = "false" + help = "Set to allow anonymous usage (default is true)." + bind = "allowAnonymous:__INSTALL_DIR__/config.json" + + [main.config.allow_anonymous_edits] + ask = "Allow anonymous edits" + type = "boolean" + yes = "true" + no = "false" + help = "Allow users to select freely permission, allowing guests to edit existing notes." + bind = "allowAnonymousEdits:__INSTALL_DIR__/config.json" + + + [main.config.allow_email_registration] + ask = "Allow email registration" + type = "boolean" + yes = "true" + no = "false" + help = "Set to allow registration of new accounts using an email address. If set to false, you can still create accounts using the command line." + bind = "allowEmailRegister:__INSTALL_DIR__/config.json" + + [main.config.allow_free_url] + ask = "Allow new note creation" + type = "boolean" + yes = "true" + no = "false" + help = "Set to allow new note creation by accessing a nonexistent note URL. This is the behavior familiar from Etherpad." + bind = "allowFreeURL:__INSTALL_DIR__/config.json" + + [main.config.require_free_url_authentication] + ask = "Require FreeURL authentication" + type = "boolean" + yes = "true" + no = "false" + help = "Set to require authentication for FreeURL mode style note creation." + bind = "requireFreeURLAuthentication:__INSTALL_DIR__/config.json" + + + diff --git a/doc/ADMIN.md b/doc/ADMIN.md new file mode 100644 index 0000000..7ae98e7 --- /dev/null +++ b/doc/ADMIN.md @@ -0,0 +1,4 @@ +## Configuration + +You can configure HedgeDoc by editing this file `__INSTALL_DIR__/config.json` using the [documentation](https://github.com/hedgedoc/hedgedoc/blob/master/docs/configuration.md) +When you finished editing the configuration, for your changes to take effect, you will have to run: `sudo systemctl restart hedgedoc`. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md new file mode 100644 index 0000000..331dbd2 --- /dev/null +++ b/doc/ADMIN_fr.md @@ -0,0 +1,4 @@ +## Configuration + +Vous pouvez configurer HedgeDoc en modifiant le fichier `__INSTALL_DIR__/config.json` et en vous aidant de la [documentation](https://github.com/hedgedoc/hedgedoc/blob/master/docs/configuration.md) +Lorsque vous avez terminé de modifier la configuration, pour que vos modifications prennent effet, vous devrez exécuter : `sudo systemctl restart hedgedoc`. diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..f90c88a --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1,11 @@ +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. + +### Features + +- Real-time collaboration +- Graphs & diagrams +- Revisions +- Presentation mode +- Easy to use permission system +- Low system requirements diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..974588d --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1,11 @@ +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. + +### Caractéristiques + +- Collaboration en temps réel +- Graphiques et diagrammes +- Révisions +- Mode présentation +- Système d'autorisation facile à utiliser +- Faible configuration système requise diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index 2314b9b..0000000 --- a/doc/DISCLAIMER.md +++ /dev/null @@ -1,4 +0,0 @@ -## Configuration - -You can configure HedgeDoc by editing this file `/var/www/hedgedoc/config.json` using the [documentation](https://github.com/hedgedoc/hedgedoc/blob/master/docs/configuration.md) -When you finished editing the configuration, for your changes to take effect, you will have to run: `sudo systemctl restart hedgedoc`. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md deleted file mode 100644 index aefa446..0000000 --- a/doc/DISCLAIMER_fr.md +++ /dev/null @@ -1,4 +0,0 @@ -## Configuration - -Vous pouvez configurer HedgeDoc en modifiant le fichier `/var/www/hedgedoc/config.json` et en vous aidant de la [documentation](https://github.com/hedgedoc/hedgedoc/blob/master/docs/configuration.md) -Lorsque vous avez terminé de modifier la configuration, pour que vos modifications prennent effet, vous devrez exécuter : `sudo systemctl restart hedgedoc`. diff --git a/manifest.json b/manifest.json deleted file mode 100644 index de4883f..0000000 --- a/manifest.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "HedgeDoc", - "id": "hedgedoc", - "packaging_format": 1, - "description": { - "en": "Collaborative editor to work on notes written in Markdown", - "fr": "Éditeur collaboratif pour travailler sur des notes en Markdown" - }, - "version": "2.0.0~ynh1", - "url": "https://hedgedoc.org", - "upstream": { - "license": "free", - "website": "https://hedgedoc.org", - "demo": "https://demo.hedgedoc.org/", - "admindoc": "https://docs.hedgedoc.org/", - "userdoc": "https://yunohost.org/en/app_hedgedoc", - "code": "https://github.com/hedgedoc/hedgedoc" - }, - "license": "AGPL-3.0-only", - "maintainer": { - "name": "eric_G" - }, - "requirements": { - "yunohost": ">= 4.2.4" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain", - "example": "domain.org" - }, - { - "name": "path", - "type": "path", - "example": "/hedgedoc", - "default": "/hedgedoc" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If enabled, HedgeDoc 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, HedgeDoc sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." - }, - "default": true - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..f1a94c0 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,72 @@ +packaging_format = 2 + +id = "hedgedoc" +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" + +maintainers = [] + +[upstream] +license = "AGPL-3.0-only" +website = "https://hedgedoc.org" +demo = "https://demo.hedgedoc.org/" +admindoc = "https://docs.hedgedoc.org/" +code = "https://github.com/hedgedoc/hedgedoc" + +[integration] +yunohost = ">= 11.2" +architectures = "all" +multi_instance = true + +ldap = true + +sso = true + +disk = "50M" +ram.build = "900M" +ram.runtime = "50M" + +[install] + [install.domain] + type = "domain" + + [install.path] + type = "path" + default = "/hedgedoc" + + [install.init_main_permission] + help.en = "Set to visitors, HedgeDoc will be accessible by people who do not have an account. This can be changed later via the webadmin." + help.fr = "Défini sur visiteurs, HedgeDoc sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." + type = "group" + default = "visitors" + +[resources] + + [resources.sources] + + [resources.sources.main] + url = "https://github.com/hedgedoc/hedgedoc/releases/download/1.9.9/hedgedoc-1.9.9.tar.gz" + sha256 = "1769d30e60458040475a6d74f53952101962c40c390765e19e6ff6f3fe70c008" + autoupdate.strategy = "latest_github_tag" + + [resources.ports] + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.apt] + packages = "postgresql" + + extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" + extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + extras.yarn.packages = "yarn" + + [resources.database] + type = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 3e0b194..44277c5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,10 +4,7 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="postgresql apt-transport-https" - -nodejs_version=14 +nodejs_version=20 #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 3115b5b..c711f03 100644 --- a/scripts/backup +++ b/scripts/backup @@ -9,27 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_print_info --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -39,20 +18,14 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= @@ -66,4 +39,4 @@ ynh_psql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for HedgeDoc. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index d903e72..85e7e6c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,63 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up HedgeDoc before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -73,36 +16,14 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=stop --log_path=systemd #================================================= # MODIFY URL IN NGINX CONF #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Change the path in the NGINX config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated NGINX config - ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi +ynh_change_url_nginx_config #================================================= # SPECIFIC MODIFICATIONS @@ -110,12 +31,15 @@ fi # CONFIGURE HEDGEDOC #================================================= -ynh_backup_if_checksum_is_different --file="$final_path/config.json" +ynh_backup_if_checksum_is_different --file="$install_dir/config.json" domain=$new_domain -path=${new_path:1} +url_path=${new_path#/} -ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" +ynh_add_config --template="../conf/config.json.example" --destination="$install_dir/config.json" + +chmod 400 "$install_dir/config.json" +chown $app:$app "$install_dir/config.json" #================================================= # GENERIC FINALISATION @@ -127,15 +51,8 @@ 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 -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for HedgeDoc" --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 0c986bf..6872d2b 100644 --- a/scripts/install +++ b/scripts/install @@ -9,41 +9,19 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -is_public=$YNH_APP_ARG_IS_PUBLIC - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +allow_anonymous=false +allow_anonymous_edits=false +allow_email_registration=false +allow_free_url=false +require_free_url_authentication=false #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -68,75 +46,54 @@ ynh_app_setting_set --app=$app --key=port_frontend --value=$port_frontend #================================================= ynh_script_progression --message="Installing dependencies..." --weight=20 -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - # 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 -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=2 - -# Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path - -#================================================= -# CREATE A POSTGRESQL DATABASE -#================================================= -ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 - -db_name=$(ynh_sanitize_dbid --db_name=$app) -ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_name --db_name=$db_name +ynh_use_nodejs #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= 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 -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 +#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 #================================================= -# NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 -# Create a dedicated NGINX config ynh_add_nginx_config +ynh_add_systemd_config + +yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log" + #================================================= # SPECIFIC SETUP #============================================== # INSTALL HEDGEDOC #============================================== -ynh_use_nodejs 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 +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 "$final_path/frontend" || ynh_die - ynh_exec_warn_less yarn install +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 || ynh_die +popd #================================================= # SETUP SYSTEMD @@ -155,7 +112,7 @@ ynh_add_systemd_config --service="${app}_frontend" --template="../conf/frontend. ynh_script_progression --message="Modifying a config file..." --weight=1 #path=${path_url:1} -ynh_add_config --template="../conf/env_backend" --destination="$final_path/backend/.env" +ynh_add_config --template="env_backend" --destination="$install_dir/backend/.env" #================================================= # GENERIC FINALIZATION @@ -165,8 +122,8 @@ ynh_add_config --template="../conf/env_backend" --destination="$final_path/backe 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 +chown -R $app:$app $install_dir +chmod o-rwx $install_dir #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -185,26 +142,8 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 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 -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary or protect it -if [ $is_public -eq 1 ] -then - ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of HedgeDoc completed" --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index e89de26..11cded3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,22 +10,11 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# LOAD SETTINGS +# REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name - -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEMD SERVICE #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # 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}_backend >/dev/null @@ -49,52 +38,12 @@ ynh_script_progression --message="Stopping and removing the systemd services..." ynh_remove_systemd_config --service=${app}_backend ynh_remove_systemd_config --service=${app}_frontend -#================================================= -# REMOVE THE POSTGRESQL DATABASE -#================================================= -ynh_script_progression --message="Removing the PostgreSQL database..." --weight=2 - -# Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user=$db_user --db_name=$db_name - -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - ynh_remove_nodejs -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing HedgeDoc main directory..." --weight=6 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5 - -# Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of HedgeDoc completed" --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 47778fb..f41173e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,73 +9,15 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -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 " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring HedgeDoc main directory..." --weight=10 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." --weight=2 - -# Restore permissions on app files -chown -R $app:$app $final_path -chmod o-rwx $final_path -chmod 600 $final_path/config.json +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # SPECIFIC RESTORATION @@ -84,57 +26,39 @@ chmod 600 $final_path/config.json #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=6 -# Define and install dependencies -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - # 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 THE POSTGRESQL DATABASE #================================================= ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6 -ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=5 +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# 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" #================================================= -# START SYSTEMD SERVICE +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +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" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for HedgeDoc" --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index a70d5f3..275c1d4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,53 +9,35 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) - -#================================================= -# CHECK VERSION -#================================================= -ynh_script_progression --message="Checking version..." --weight=2 - -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 +if [ -z "${allow_anonymous:-}" ]; then + allow_anonymous="false" + ynh_app_setting_set --app=$app --key=allow_anonymous --value=$allow_anonymous fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up HedgeDoc before upgrading (may take a while)..." --weight=10 +if [ -z "${allow_anonymous_edits:-}" ]; then + allow_anonymous_edits="false" + ynh_app_setting_set --app=$app --key=allow_anonymous_edits --value=$allow_anonymous_edits +fi -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +if [ -z "${allow_email_registration:-}" ]; then + allow_email_registration="false" + ynh_app_setting_set --app=$app --key=allow_email_registration --value=$allow_email_registration +fi + +if [ -z "${allow_free_url:-}" ]; then + allow_free_url="false" + ynh_app_setting_set --app=$app --key=allow_free_url --value=$allow_free_url +fi + +if [ -z "${require_free_url_authentication:-}" ]; then + require_free_url_authentication="false" + ynh_app_setting_set --app=$app --key=require_free_url_authentication --value=$require_free_url_authentication +fi #================================================= # STANDARD UPGRADE STEPS @@ -66,90 +48,52 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=stop --log_path=systemd -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=10 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=10 +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir=$install_dir --keep="config.json" - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir=$final_path --keep="$final_path/config.json" -fi +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 -# Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=10 - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - -# 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" +ynh_add_systemd_config + +yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log" -#================================================= -# SPECIFIC UPGRADE #============================================== # INSTALL HEDGEDOC #============================================== -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Building HedgeDoc... (this will take some time and resources!)" --weight=20 +ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=10 - pushd "$final_path" || ynh_die - ynh_use_nodejs - bin/setup - popd || ynh_die -fi +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 +popd #================================================= -# SETUP SYSTEMD +# MODIFY A CONFIG FILE #================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=2 +ynh_script_progression --message="Modifying a config file..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" +url_path=${path#/} +ynh_add_config --template="config.json.example" --destination="$install_dir/config.json" -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." --weight=1 - -# Set permissions on 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" +chmod 600 "$install_dir/config.json" +chown $app:$app "$install_dir/config.json" #================================================= # START SYSTEMD SERVICE @@ -158,15 +102,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" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of HedgeDoc completed" --last +ynh_script_progression --message="Upgrade of $app completed" --last diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..f0b0313 --- /dev/null +++ b/tests.toml @@ -0,0 +1,9 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.f601a56a.name = "Upgrade from 1.9.7~ynh2"