diff --git a/README.md b/README.md index d71d154..80b9b26 100644 --- a/README.md +++ b/README.md @@ -16,43 +16,22 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -The fastest wiki and knowledge base for growing teams. Beautiful, feature rich, and markdown compatible. +Outline is a wiki and knowledge base for growing teams. Beautiful, feature rich, and markdown compatible. ### Features - Fully working installation of Outline wiki -- Including a Dex server to connect to Yunohost's LDAP userbase using an OIDC auth flow +- Including a Dex server to connect to YunoHost's LDAP userbase using an OIDC auth flow - Using Yunohost's built-in SMTP server for notifications -**Shipped version:** 0.74.0~ynh2 +**Shipped version:** 0.75.0~ynh1 **Demo:** https://app.getoutline.com/create ## Screenshots -![Screenshot of Outline](./doc/screenshots/outline_screenshot.png) - -## Disclaimers / important information - -### Not totally free licence -Outline is a softwared licenced under [BUSL 1.1 licence](https://spdx.org/licenses/BUSL-1.1.html). -⚠️ That licence **is not totally free**. Please read it very carefully if you have any commercial use in mind. -The Outline version shipped with this package (v0.73.1) will be released under Apache-2.0 licence [after August 18th 2027](https://github.com/outline/outline/blob/ebeb201a9f48e2c6b619a0d152e051946849aa10/LICENSE). - -### Known limitations - -1. The app can now run in the CI server and reach level 8. However, it is still very young and not broadly tested. **Please use it with extreme care if it's on a prod server** -2. The app requires [Dex app](https://github.com/YunoHost-apps/dex_ynh) to be installed (Dex installation and setup is automatic, though) -3. The app is requiring two domains including one fully dedicated (one for Dex, one for Outline) -4. ARM architectures are not yet supported (But it should be achievable soon) -5. Because it's built from sources, the app requires an important amount of RAM, disk and time to install properly - - -### How to create an admin user - -The first user to login will automatically be granted admin rights -You can then change the user rights by default and/or change the admin user afterwards from the Outline settings page +![Screenshot of Outline](./doc/screenshots/screenshot.png) ## :red_circle: Antifeatures diff --git a/README_fr.md b/README_fr.md index a3d19c5..37a882a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,43 +16,21 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -The fastest wiki and knowledge base for growing teams. Beautiful, feature rich, and markdown compatible. +Outile est un wiki et la base de connaissances les plus rapides pour les équipes en pleine croissance. Beau, riche en fonctionnalités et compatible avec les démarques. -### Features +### Caractéristiques -- Fully working installation of Outline wiki -- Including a Dex server to connect to Yunohost's LDAP userbase using an OIDC auth flow -- Using Yunohost's built-in SMTP server for notifications +- Installation entièrement fonctionnelle du wiki Outline +- Y compris un serveur Dex pour se connecter à la base d'utilisateurs LDAP de YunoHost à l'aide d'un flux d'authentification OIDC +- Utilisation du serveur SMTP intégré de Yunohost pour les notifications - -**Version incluse :** 0.74.0~ynh2 +**Version incluse :** 0.75.0~ynh1 **Démo :** https://app.getoutline.com/create ## Captures d’écran -![Capture d’écran de Outline](./doc/screenshots/outline_screenshot.png) - -## Avertissements / informations importantes - -### Not totally free licence -Outline is a softwared licenced under [BUSL 1.1 licence](https://spdx.org/licenses/BUSL-1.1.html). -⚠️ That licence **is not totally free**. Please read it very carefully if you have any commercial use in mind. -The Outline version shipped with this package (v0.73.1) will be released under Apache-2.0 licence [after August 18th 2027](https://github.com/outline/outline/blob/ebeb201a9f48e2c6b619a0d152e051946849aa10/LICENSE). - -### Known limitations - -1. The app can now run in the CI server and reach level 8. However, it is still very young and not broadly tested. **Please use it with extreme care if it's on a prod server** -2. The app requires [Dex app](https://github.com/YunoHost-apps/dex_ynh) to be installed (Dex installation and setup is automatic, though) -3. The app is requiring two domains including one fully dedicated (one for Dex, one for Outline) -4. ARM architectures are not yet supported (But it should be achievable soon) -5. Because it's built from sources, the app requires an important amount of RAM, disk and time to install properly - - -### How to create an admin user - -The first user to login will automatically be granted admin rights -You can then change the user rights by default and/or change the admin user afterwards from the Outline settings page +![Capture d’écran de Outline](./doc/screenshots/screenshot.png) ## :red_circle: Fonctions indésirables diff --git a/check_process b/check_process deleted file mode 100644 index 2a8972b..0000000 --- a/check_process +++ /dev/null @@ -1,29 +0,0 @@ -;; Test complet - ; pre-install - sudo yunohost domain add dex.domain.tld - sudo yunohost domain add minio.domain.tld - ; Manifest - domain="domain.tld" - is_public=1 - language="fr" - dex_domain="dex.domain.tld" - dex_path="/example" - ; 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=f56cd7d - backup_restore=1 - multi_instance=0 - change_url=0 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=f56cd7d - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/conf/.env b/conf/.env index 00a44b7..a29b088 100644 --- a/conf/.env +++ b/conf/.env @@ -10,7 +10,7 @@ UTILS_SECRET=__UTILS_SECRET__ # For production point these at your databases, in development the default # should work out of the box. -DATABASE_URL=postgres://__DB_NAME__:__SECRET_KEY__@localhost:5432/__DB_NAME__ +DATABASE_URL=postgres://__DB_NAME__:__DB_PWD__@localhost:5432/__DB_NAME__ DATABASE_URL_TEST=postgres://user:pass@localhost:5532/outline-test # Uncomment this to disable SSL for connecting to Postgres PGSSLMODE=disable @@ -81,8 +81,8 @@ DEBUG=cache,presenters,events,emails,mailer,utils,http,server,processors # "you've been invited" you'll need to provide authentication for an SMTP server SMTP_HOST='localhost' SMTP_PORT='25' -SMTP_USERNAME='' -SMTP_PASSWORD='' +SMTP_USERNAME='__APP__' +SMTP_PASSWORD='__MAIL_PWD__' SMTP_FROM_EMAIL='__APP__@__DOMAIN__' SMTP_REPLY_EMAIL='webmaster@__DOMAIN__' SMTP_TLS_CIPHERS= @@ -93,4 +93,4 @@ SMTP_SECURE='false' # The default interface language. See translate.getoutline.com for a list of # available language codes and their rough percentage translated. -DEFAULT_LANGUAGE=__LANGUAGE_KEY__ \ No newline at end of file +DEFAULT_LANGUAGE=__LANGUAGE__ diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 9c1c5b7..0000000 --- a/conf/app.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/outline/outline/archive/e4d00783585f2a509da3565723227d2b5959a2e9.zip -SOURCE_SUM=f3394b676393e574c52aab14786b3553a58c1a87e215ae889d9c8e4d3dd6d962 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=zip -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index f9373a8..45b333f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,6 @@ -location / { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { + proxy_pass http://127.0.0.1:__PORT__; proxy_redirect off; proxy_set_header Host $host; diff --git a/conf/systemd.service b/conf/systemd.service index 787da88..e456da6 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=network.target postgresql.service redis-server.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ +WorkingDirectory=__INSTALL_DIR__/ Environment="NODE_ENV=production" Environment="__YNH_NODE_LOAD_PATH__" ExecStart=__YNH_NPM__ start diff --git a/doc/ADMIN.md b/doc/ADMIN.md new file mode 100644 index 0000000..08c5709 --- /dev/null +++ b/doc/ADMIN.md @@ -0,0 +1,4 @@ +### How to create an admin user + +The first user to login will automatically be granted admin rights +You can then change the user rights by default and/or change the admin user afterwards from the Outline settings page diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 436faaf..d6c1700 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,7 +1,7 @@ -The fastest wiki and knowledge base for growing teams. Beautiful, feature rich, and markdown compatible. +Outline is a wiki and knowledge base for growing teams. Beautiful, feature rich, and markdown compatible. ### Features - Fully working installation of Outline wiki -- Including a Dex server to connect to Yunohost's LDAP userbase using an OIDC auth flow +- Including a Dex server to connect to YunoHost's LDAP userbase using an OIDC auth flow - Using Yunohost's built-in SMTP server for notifications diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..17c049b --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1,7 @@ +Outile est un wiki et la base de connaissances les plus rapides pour les équipes en pleine croissance. Beau, riche en fonctionnalités et compatible avec les démarques. + +### Caractéristiques + +- Installation entièrement fonctionnelle du wiki Outline +- Y compris un serveur Dex pour se connecter à la base d'utilisateurs LDAP de YunoHost à l'aide d'un flux d'authentification OIDC +- Utilisation du serveur SMTP intégré de Yunohost pour les notifications \ No newline at end of file diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index 8508257..0000000 --- a/doc/DISCLAIMER.md +++ /dev/null @@ -1,18 +0,0 @@ -### Not totally free licence -Outline is a softwared licenced under [BUSL 1.1 licence](https://spdx.org/licenses/BUSL-1.1.html). -⚠️ That licence **is not totally free**. Please read it very carefully if you have any commercial use in mind. -The Outline version shipped with this package (v0.73.1) will be released under Apache-2.0 licence [after August 18th 2027](https://github.com/outline/outline/blob/ebeb201a9f48e2c6b619a0d152e051946849aa10/LICENSE). - -### Known limitations - -1. The app can now run in the CI server and reach level 8. However, it is still very young and not broadly tested. **Please use it with extreme care if it's on a prod server** -2. The app requires [Dex app](https://github.com/YunoHost-apps/dex_ynh) to be installed (Dex installation and setup is automatic, though) -3. The app is requiring two domains including one fully dedicated (one for Dex, one for Outline) -4. ARM architectures are not yet supported (But it should be achievable soon) -5. Because it's built from sources, the app requires an important amount of RAM, disk and time to install properly - - -### How to create an admin user - -The first user to login will automatically be granted admin rights -You can then change the user rights by default and/or change the admin user afterwards from the Outline settings page diff --git a/doc/PRE_INSTALL.md b/doc/PRE_INSTALL.md new file mode 100644 index 0000000..c4edf96 --- /dev/null +++ b/doc/PRE_INSTALL.md @@ -0,0 +1,6 @@ +### Known limitations + +1. This app is still young and not broadly tested. **Please use it with extreme care if it's on a prod server** +2. The app requires [Dex app](https://github.com/YunoHost-apps/dex_ynh) to be installed (Dex installation and setup is automatic, though) +3. The app is requiring two domains including one fully dedicated (one for Dex, one for Outline) +4. Because it's built from sources, the app requires an important amount of RAM, disk and time to install properly diff --git a/doc/PRE_INSTALL_fr.md b/doc/PRE_INSTALL_fr.md new file mode 100644 index 0000000..27aa8e6 --- /dev/null +++ b/doc/PRE_INSTALL_fr.md @@ -0,0 +1,6 @@ +### Limites connues + +1. Cette app est encore jeune et n'a pas été largement testée. **Veuillez l'utiliser avec une extrême prudence s'il est sur un serveur de production** +2. L'application nécessite l'installation de [l'application Dex](https://github.com/YunoHost-apps/dex_ynh) (l'installation et la configuration de Dex sont cependant automatiques) +3. L'application nécessite deux domaines dont un entièrement dédié (un pour Dex, un pour Outline) +4. Parce qu'elle est construite à partir de sources, l'application nécessite une quantité importante de RAM, de disque et de temps pour s'installer correctement. \ No newline at end of file diff --git a/doc/screenshots/outline_screenshot.png b/doc/screenshots/outline_screenshot.png deleted file mode 100644 index 9df4301..0000000 Binary files a/doc/screenshots/outline_screenshot.png and /dev/null differ diff --git a/doc/screenshots/screenshot.png b/doc/screenshots/screenshot.png new file mode 100644 index 0000000..19fbbed Binary files /dev/null and b/doc/screenshots/screenshot.png differ diff --git a/manifest.json b/manifest.json deleted file mode 100644 index d4821b6..0000000 --- a/manifest.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "Outline", - "id": "outline", - "packaging_format": 1, - "description": { - "en": "Wiki and knowledge base for teams", - "fr": "Wiki et base de connaissances pour les équipes" - }, - "version": "0.74.0~ynh2", - "url": "https://www.getoutline.com", - "upstream": { - "license": "BUSL-1.1", - "website": "https://www.getoutline.com", - "demo": "https://app.getoutline.com/create", - "admindoc": "https://www.getoutline.com/developers", - "userdoc": "https://www.getoutline.com/about", - "code": "https://github.com/outline/outline" - }, - "license": "BUSL-1.1", - "maintainer": { - "name": "Raoul de Limezy" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "is_public", - "type": "boolean", - "default": true - }, - { - "name": "language", - "type": "string", - "ask": { - "en": "Choose the application language", - "fr": "Choisissez la langue de l'application" - }, - "choices": ["fr", "en"], - "default": "en" - }, - { - "name": "dex_domain", - "type": "domain", - "ask": { - "en": "Domain for authentication. It can't be the same domain as above. Dex app will be installed and used for the authentication mechanism.", - "fr": "Domaine pour l'authentification. Il ne peut pas s'agir du même domaine que ci-dessus. L'application Dex sera installée et utilisée pour le mécanisme d'authentification." - } - }, - { - "name": "dex_path", - "type": "path", - "default": "/", - "ask": { - "en": "Path for authentication URL. Please don't use 'auth' as it will break NGINX configuration.", - "fr": "Chemin de l'URL d'authentification. Veuillez ne pas utiliser 'auth' car cela casserait la configuration NGINX." - } - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..694cb62 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,81 @@ +packaging_format = 2 + +id = "outline" +name = "Outline" +description.en = "Wiki and knowledge base for teams" +description.fr = "Wiki et base de connaissances pour les équipes" + +version = "0.75.0~ynh1" + +maintainers = ["Raoul de Limezy"] + +[upstream] +license = "BUSL-1.1" +website = "https://www.getoutline.com" +demo = "https://app.getoutline.com/create" +admindoc = "https://www.getoutline.com/developers" +userdoc = "https://www.getoutline.com/about" +code = "https://github.com/outline/outline" + +[integration] +yunohost = ">= 11.2" +architectures = "all" +multi_instance = false +ldap = false +sso = false +disk = "50M" +ram.build = "3G" +ram.runtime = "50M" + +[install] + [install.domain] + type = "domain" + + [install.init_main_permission] + type = "group" + default = "visitors" + + [install.language] + ask.en = "Choose the application language" + ask.fr = "Choisissez la langue de l'application" + type = "select" + choices = ["de_DE", "en_US", "es_ES", "fr_FR", "it_IT", "nl_NL", "pl_PL", "pt_PT"] + default = "fr_FR" + + [install.dex_domain] + ask.en = "Domain for authentication. It can't be the same domain as above. Dex app will be installed and used for the authentication mechanism." + ask.fr = "Domaine pour l'authentification. Il ne peut pas s'agir du même domaine que ci-dessus. L'application Dex sera installée et utilisée pour le mécanisme d'authentification." + type = "domain" + + [install.dex_path] + ask.en = "Path for authentication URL. Please don't use 'auth' as it will break NGINX configuration." + ask.fr = "Chemin de l'URL d'authentification. Veuillez ne pas utiliser 'auth' car cela casserait la configuration NGINX." + type = "path" + default = "/" + +[resources] + [resources.sources.main] + url = "https://github.com/outline/outline/archive/2c9b01391fa12ebfd65dc01ec33bbb4941ef23bf.zip" + sha256 = "1bf8ef7fdac470ed0faeefd9575ffbac1f12d623e89d9ee244b2f83788d92933" + + [resources.system_user] + allow_email = true + + [resources.install_dir] + + [resources.ports] + main.default = 2410 + + [resources.permissions] + main.url = "/" + main.auth_header = false + + [resources.apt] + packages = "postgresql gawk" + + 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 ca18ef8..3f31ef3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,10 +4,7 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="postgresql" - -NODEJS_VERSION=20 +NODEJS_VERSION=18 #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index c4eb4aa..54e1793 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,52 +10,11 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# 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) -path_url=$(ynh_app_setting_get --app=$app --key=path_url) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -language_key=$(ynh_app_setting_get --app=$app --key=language_key) -secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) -utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) -dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) -dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) -dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) -dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) -dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP LOCAL STORAGE #================================================= @@ -66,7 +25,7 @@ ynh_backup --src_path="/var/lib/outline" # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION @@ -112,9 +71,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= ynh_print_info --message="Backing up the PostgreSQL database..." -### (However, things like MySQL dumps *do* take some time to run, though the -### copy of the generated dump to the archive still happens later) - ynh_psql_dump_db --database="$db_name" > db.sql #================================================= diff --git a/scripts/change_url b/scripts/change_url index 9ba9960..41f7d60 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,75 +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) -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path_url) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -language_key=$(ynh_app_setting_get --app=$app --key=language_key) -secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) -utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) -dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) -dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) -dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) -dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) -dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app 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 - ynh_die "Outline has to be installed on the root of a domain" -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -85,45 +16,31 @@ 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 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 #================================================= # UPDATING A CONFIGURATION #================================================= - -domain=$new_domain - -ynh_secure_remove --file="$final_path/.env" ynh_script_progression --message="Updating the configuration file..." --weight=1 -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -chmod 400 "$final_path/.env" -chown $app:$app "$final_path/.env" +chmod 400 "$install_dir/.env" +chown $app:$app "$install_dir/.env" #================================================= # RUN DB MIGRATION #================================================= ynh_script_progression --message="Running DB initial migration..." --weight=3 -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate popd @@ -135,14 +52,7 @@ popd #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # SLACK WARNING diff --git a/scripts/install b/scripts/install index 5bac3b6..60133ad 100755 --- a/scripts/install +++ b/scripts/install @@ -9,47 +9,18 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# 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="/" -is_public=$YNH_APP_ARG_IS_PUBLIC - -language=$YNH_APP_ARG_LANGUAGE - -if [ $language == "fr" ]; then - language_key="fr_FR" - echo "French" -else - language_key="en_US" - echo "English" -fi - -secret_key=$(ynh_hex_32_random) utils_secret=$(ynh_hex_32_random) - -app=$YNH_APP_INSTANCE_NAME +secret_key=$(ynh_hex_32_random) #================================================= # INSTALL DEX APP FOR OAUTH2 / OIDC #================================================= ynh_script_progression --message="Installing Dex..." --weight=18 -dex_domain=$YNH_APP_ARG_DEX_DOMAIN -dex_path=$YNH_APP_ARG_DEX_PATH oidc_secret=$(ynh_hex_32_random) oidc_name="Outline" oidc_callback="$domain/auth/oidc.callback" @@ -74,31 +45,14 @@ else dex_user_uri="https://$dex_domain$dex_path/userinfo" fi -#=================================================== -# 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 - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= ynh_script_progression --message="Storing installation settings..." --weight=1 -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=language --value=$language -ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key ynh_app_setting_set --app=$app --key=utils_secret --value=$utils_secret -ynh_app_setting_set --app=$app --key=language_key --value=$language_key +ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key ynh_app_setting_set --app=$app --key=dex_app --value=$dex_app -ynh_app_setting_set --app=$app --key=dex_domain --value=$dex_domain -ynh_app_setting_set --app=$app --key=dex_path --value=$dex_path ynh_app_setting_set --app=$app --key=oidc_name --value=$oidc_name ynh_app_setting_set --app=$app --key=oidc_secret --value=$oidc_secret ynh_app_setting_set --app=$app --key=oidc_callback --value=$oidc_callback @@ -106,17 +60,6 @@ ynh_app_setting_set --app=$app --key=dex_auth_uri --value=$dex_auth_uri ynh_app_setting_set --app=$app --key=dex_token_uri --value=$dex_token_uri ynh_app_setting_set --app=$app --key=dex_user_uri --value=$dex_user_uri -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -port=$(ynh_find_port --port=2410) -ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # INSTALL DEPENDENCIES #================================================= @@ -125,29 +68,11 @@ ynh_script_progression --message="Installing dependencies..." --weight=1 # Install nodejs ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1 -ynh_install_app_dependencies $pkg_dependencies 2>&1 - -# 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" 2>&1 - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 - -# 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=1 -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 --db_pwd=$secret_key - ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name @@ -156,13 +81,11 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab #================================================= 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="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # SETUP LOCAL STORAGE @@ -179,18 +102,28 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate + +cron_path="/etc/cron.d/$app" +ynh_add_config --template="../conf/outline.cron" --destination="$cron_path" +chown root: "$cron_path" +chmod 644 "$cron_path" + +yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log" #================================================= # BUILD YARN DEPENDENCIES #================================================= +ynh_script_progression --message="Building $app. This can be very long, be patient !" --weight=18 -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs - ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --weight=18 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --frozen-lockfile --network-timeout 1000000000 2>&1 - ynh_script_progression --message="Building... This can be very long, be patient !" --weight=18 - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_OPTIONS="--max-old-space-size=3900" yarn build 2>&1 - ynh_script_progression --message="Cleaning cache... " --weight=3 + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_OPTIONS="--max-old-space-size=3200" yarn build 2>&1 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean 2>&1 popd @@ -199,81 +132,28 @@ popd #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -chmod 400 "$final_path/.env" -chown $app:$app "$final_path/.env" +chmod 400 "$install_dir/.env" +chown $app:$app "$install_dir/.env" #================================================= # RUN DB MIGRATION #================================================= ynh_script_progression --message="Running DB initial migration..." --weight=3 -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate popd -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - -#================================================= -# ADD A CRON JOB -#================================================= - -cron_path="/etc/cron.d/$app" -ynh_add_config --template="../conf/outline.cron" --destination="$cron_path" -chown root: "$cron_path" -chmod 644 "$cron_path" - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - ynh_permission_update --permission="main" --add="visitors" -fi - ynh_permission_url --permission="main" --auth_header=false - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index ca52fce..52efc70 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,31 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -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) -path_url=$(ynh_app_setting_get --app=$app --key=path_url) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -language_key=$(ynh_app_setting_get --app=$app --key=language_key) -secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) -utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) -dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) -dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) -dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) -dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) -dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) - #================================================= # STANDARD REMOVE #================================================= @@ -47,91 +22,26 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE THE POSTGRESQL DATABASE -#================================================= -ynh_script_progression --message="Removing the PostgreSQL database..." - -# Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user=$db_name --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 app main directory..." --weight=1 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - -#================================================= -# REMOVE DEX APP -#================================================= -ynh_script_progression --message="Removing Dex app used for Outline auth..." --weight=1 - yunohost app remove $dex_app -#================================================= -# REMOVE LOCAL STORAGE -#================================================= -ynh_script_progression --message="Removing Outline local storage..." --weight=1 ynh_secure_remove --file="/var/lib/outline" -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." --weight=1 - # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" -#================================================= -# 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="If you don't need it anymore, don't forget to remove the MinIO app !" ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index d52cc61..03e23ae 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,50 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -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) -path_url=$(ynh_app_setting_get --app=$app --key=path_url) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -language_key=$(ynh_app_setting_get --app=$app --key=language_key) -secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) -utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) -dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) -dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) -dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) -dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) -dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path" - #================================================= # CHECK IF DEX IS INSTALLED, IF NOT INSTALL IT #================================================= @@ -65,41 +21,22 @@ if ! yunohost app list | grep -q "id: $dex_app"; then if yunohost app list | grep -q "$dex_domain$dex_path"; then ynh_die "The domain provided for Dex is already used by another app. Please chose another one !" fi - yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "domain=$dex_domain&path=$dex_path&OIDC_name=$oidc_name&OIDC_secret=$oidc_secret&OIDC_callback=$oidc_callback" + yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "domain=$dex_domain&path=$dex_path&oidc_name=$oidc_name&oidc_secret=$oidc_secret&oidc_callback=$oidc_callback" fi -#================================================= -# 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 the app main directory..." --weight=1 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # RESTORE LOCAL STORAGE #================================================= - ynh_script_progression --message="Restoring the app local storage..." --weight=1 ynh_restore_file --origin_path="/var/lib/outline" @@ -107,6 +44,13 @@ ynh_restore_file --origin_path="/var/lib/outline" chmod -R o-rwx "/var/lib/outline" chown -R $app:www-data "/var/lib/outline" +#================================================= +# RESTORE THE POSTGRESQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6 + +ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name + #================================================= # SPECIFIC RESTORATION #================================================= @@ -117,84 +61,38 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Install nodejs ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1 -ynh_install_app_dependencies $pkg_dependencies 2>&1 - -# 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_name --db_name=$db_name --db_pwd=$secret_key -ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name - -#================================================= -# UPDATING A CONFIGURATION -#================================================= - -ynh_secure_remove --file="$final_path/.env" -ynh_script_progression --message="Updating the configuration file..." --weight=1 - -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" - -chmod 400 "$final_path/.env" -chown $app:$app "$final_path/.env" - -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --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 -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/logrotate.d/$app" -#================================================= -# RESTORE THE LOGS -#================================================= -ynh_script_progression --message="Restoring the logs..." --weight=1 - ynh_restore_file --origin_path="/var/log/$app/$app.log" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_restore_file --origin_path="/etc/cron.d/$app" yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log" +#================================================= +# UPDATING A CONFIGURATION +#================================================= +ynh_script_progression --message="Updating the configuration file..." --weight=1 + +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" + +chmod 400 "$install_dir/.env" +chown $app:$app "$install_dir/.env" + #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX AND PHP-FPM -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" ynh_systemd_action --service_name=nginx --action=reload -#================================================= -# RESTORE THE CRON FILE -#================================================= -ynh_script_progression --message="Restoring cron job..." --weight=1 - -ynh_restore_file --origin_path="/etc/cron.d/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 888269d..5db2220 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,54 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -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) -path_url=$(ynh_app_setting_get --app=$app --key=path_url) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -language_key=$(ynh_app_setting_get --app=$app --key=language_key) -secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) -utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) -dex_app=$(ynh_app_setting_get --app=$app --key=dex_app) -dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain) -dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) -oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) -oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) -oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) -dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) -dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) -dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) - #================================================= # CHECK VERSION #================================================= upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 - -# Ugly fix for an early mistake - to be removed with next upgrade -ynh_secure_remove --file="$final_path/outlinestorage" - -# 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 - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -64,15 +22,7 @@ ynh_abort_if_errors #================================================= 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" - -#================================================= -# 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" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -83,15 +33,11 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_secure_remove --file="$final_path" - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$install_dir" fi -ynh_script_progression --message="Done" --weight=1 - -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #======================================================= # MIGRATE MINIO BUCKET IF UPGRADING FROM AN OLD VERSION @@ -102,11 +48,6 @@ if ynh_compare_current_package_version --comparison le --version 0.69.2.2~ynh1 then ynh_script_progression --message="Migrating MinIO data to local directory" - minio_domain=$(ynh_app_setting_get --app=$app --key=minio_domain) - minio_admin=$(ynh_app_setting_get --app=$app --key=minio_admin) - minio_password=$(ynh_app_setting_get --app=$app --key=minio_password) - mc_path=$(ynh_app_setting_get --app=$app --key=mc_path) - mkdir -p "/var/lib/$app/data" chown -R minio:www-data "/var/lib/$app" ynh_exec_warn_less sudo -u minio $mc_path/mc mirror --preserve "minio/outlinestorage" "/var/lib/$app/data" @@ -130,31 +71,18 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=1 - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - # Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1 - -# 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" 2>&1 +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION #================================================= # UPGRADE YARN DEPENDENCIES #================================================= -ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=10 +ynh_script_progression --message="Building $app. This can be very long, be patient !" --weight=10 -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs - ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --weight=18 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --frozen-lockfile --network-timeout 1000000000 2>&1 - ynh_script_progression --message="Building... This can be very long, be patient !" --weight=18 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_OPTIONS="--max-old-space-size=3900" yarn build 2>&1 - ynh_script_progression --message="Cleaning cache... " --weight=3 ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean 2>&1 popd @@ -163,17 +91,17 @@ popd #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -chmod 400 "$final_path/.env" -chown $app:$app "$final_path/.env" +chmod 400 "$install_dir/.env" +chown $app:$app "$install_dir/.env" #================================================= # RUN DB MIGRATION #================================================= ynh_script_progression --message="Running DB initial migration..." -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production yarn db:migrate popd @@ -186,30 +114,14 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -#================================================= -# UPDATE THE CRON JOB -#================================================= - cron_path="/etc/cron.d/$app" ynh_add_config --template="../conf/outline.cron" --destination="$cron_path" chown root: "$cron_path" chmod 644 "$cron_path" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log" #================================================= @@ -217,14 +129,7 @@ yunohost service add $app --description="Outline server" --log="/var/log/$app/$a #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/sources/patches/diff.txt b/sources/patches/diff.txt new file mode 100644 index 0000000..f781b63 --- /dev/null +++ b/sources/patches/diff.txt @@ -0,0 +1,371 @@ +diff --git a/app/components/Icons/OutlineIcon.tsx b/app/components/Icons/OutlineIcon.tsx +index bb7f29ce7..70db50bcd 100644 +--- a/app/components/Icons/OutlineIcon.tsx ++++ b/app/components/Icons/OutlineIcon.tsx +@@ -22,7 +22,10 @@ export default function OutlineIcon({ + viewBox={cover ? "2 2 20 20" : "0 0 24 24"} + version="1.1" + > +- ++ + + ); + } +diff --git a/app/editor/menus/block.tsx b/app/editor/menus/block.tsx +index 301c2610d..1e6917bd8 100644 +--- a/app/editor/menus/block.tsx ++++ b/app/editor/menus/block.tsx +@@ -20,6 +20,7 @@ import { + MathIcon, + DoneIcon, + EmbedIcon, ++ BookmarkedIcon, + } from "outline-icons"; + import * as React from "react"; + import styled from "styled-components"; +@@ -195,6 +196,13 @@ export default function blockMenuItems(dictionary: Dictionary): MenuItem[] { + keywords: "notice card suggestion", + attrs: { style: "tip" }, + }, ++ { ++ name: "container_notice", ++ title: dictionary.bibleNotice, ++ icon: , ++ keywords: "notice card bible", ++ attrs: { style: "bible" }, ++ }, + { + name: "separator", + }, +diff --git a/app/hooks/useDictionary.ts b/app/hooks/useDictionary.ts +index 6a73e6750..15b74aa9e 100644 +--- a/app/hooks/useDictionary.ts ++++ b/app/hooks/useDictionary.ts +@@ -81,6 +81,8 @@ export default function useDictionary() { + warningNotice: t("Warning notice"), + success: t("Success"), + successNotice: t("Success notice"), ++ bible: t("Bible"), ++ bibleNotice: t("Bible quote"), + insertDate: t("Current date"), + insertTime: t("Current time"), + insertDateTime: t("Current date and time"), +diff --git a/app/scenes/Document/components/Document.tsx b/app/scenes/Document/components/Document.tsx +index a231a90ee..67684d36d 100644 +--- a/app/scenes/Document/components/Document.tsx ++++ b/app/scenes/Document/components/Document.tsx +@@ -532,11 +532,6 @@ class DocumentScene extends React.Component { + + + +- {isShare && +- !parseDomain(window.location.origin).custom && +- !auth.user && ( +- +- )} + + {!isShare && ( +