1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/outline_ynh.git synced 2024-09-03 19:56:12 +02:00
This commit is contained in:
Éric Gaspar 2023-09-29 18:45:59 +02:00
parent 28baf231ea
commit 54aa1dbc4a
13 changed files with 88 additions and 567 deletions

View file

@ -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;

1
doc/POST_INSTALL.md Normal file
View file

@ -0,0 +1 @@
Don't forget to add a new redirction URL in your Slack app settings!

View file

@ -1,94 +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.69.2.2~ynh1",
"url": "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."
}
},
{
"name": "minio_domain",
"type": "domain",
"ask": {
"en": "Domain for MinIO app, used for images and attachments storage. If not yet installed, it will automatically be. MinIO has to be installed at the root.",
"fr": "Domaine pour l'application MinIO, utilisé pour le stockage des images et des pièces jointes. S'il n'est pas encore installé, il le sera automatiquement. MinIO doit être installé à la racine."
}
},
{
"name": "minio_admin",
"type": "user",
"ask": {
"en": "Administrator for MinIO app, used for images and attachments storage. Please note that if MinIO is already installed, that setting won't be used.",
"fr": "Administrateur pour l'application MinIO, utilisée pour le stockage des images et des pièces jointes. Veuillez noter que si MinIO est déjà installé, ce paramètre ne sera pas utilisé."
}
},
{
"name": "minio_password",
"type": "password",
"ask": {
"en": "Password for MinIO administrator",
"fr": "Mot de passe pour l'administrateur MinIO"
}
}
]
}
}

View file

@ -16,24 +16,20 @@ demo = "https://app.getoutline.com/create"
admindoc = "https://www.getoutline.com/developers"
userdoc = "https://www.getoutline.com/about"
code = "https://github.com/outline/outline"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 11.0.9"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
yunohost = ">= 11.2"
architectures = "all"
multi_instance = false
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ldap = false
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
full_domain = true
[install.init_main_permission]
type = "group"
@ -42,7 +38,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[install.language]
ask.en = "Choose the application language"
ask.fr = "Choisissez la langue de l'application"
type = "string"
type = "select"
choices = ["fr", "en"]
default = "en"
@ -76,7 +72,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[resources.sources.main]
url = "https://github.com/outline/outline/archive/25e8c32b8403042b6813e2a6861f4cd16586ed69.zip"
sha256 = "8bb592ae014e653752311eb0664cc7741faaeb14b7101b06c5b55d878b616658"
autoupdate.strategy = "latest_github_tag"
[resources.system_user]
@ -84,10 +80,16 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[resources.permissions]
main.url = "/"
[[resources.apt.extras]]
repo = "deb https://dl.yarnpkg.com/debian/ stable main"
key = "https://dl.yarnpkg.com/debian/pubkey.gpg 2>&1"
packages = "yarn"
main.auth_header = false
[resources.ports]
[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"

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
#REMOVEME? pkg_dependencies="postgresql"
NODEJS_VERSION=18
#=================================================

View file

@ -10,56 +10,11 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? 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
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_print_info --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key)
#REMOVEME? secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
#REMOVEME? utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret)
#REMOVEME? minio_domain=$(ynh_app_setting_get --app=$app --key=minio_domain)
#REMOVEME? minio_admin=$(ynh_app_setting_get --app=$app --key=minio_admin)
#REMOVEME? minio_password=$(ynh_app_setting_get --app=$app --key=minio_password)
#REMOVEME? mc_path=$(ynh_app_setting_get --app=$app --key=mc_path)
#REMOVEME? dex_app=$(ynh_app_setting_get --app=$app --key=dex_app)
#REMOVEME? dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain)
#REMOVEME? dex_path=$(ynh_app_setting_get --app=$app --key=dex_path)
#REMOVEME? oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret)
#REMOVEME? oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name)
#REMOVEME? oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback)
#REMOVEME? dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri)
#REMOVEME? dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri)
#REMOVEME? 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 MINIO
#=================================================
@ -118,9 +73,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
#=================================================

View file

@ -9,79 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
#REMOVEME? old_path=$YNH_APP_OLD_PATH
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
#REMOVEME? new_path=$YNH_APP_NEW_PATH
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? # Needed for helper "ynh_add_nginx_config"
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? language_key=$(ynh_app_setting_get --app=$app --key=language_key)
#REMOVEME? secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
#REMOVEME? utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret)
#REMOVEME? minio_domain=$(ynh_app_setting_get --app=$app --key=minio_domain)
#REMOVEME? minio_admin=$(ynh_app_setting_get --app=$app --key=minio_admin)
#REMOVEME? minio_password=$(ynh_app_setting_get --app=$app --key=minio_password)
#REMOVEME? mc_path=$(ynh_app_setting_get --app=$app --key=mc_path)
#REMOVEME? dex_app=$(ynh_app_setting_get --app=$app --key=dex_app)
#REMOVEME? dex_domain=$(ynh_app_setting_get --app=$app --key=dex_domain)
#REMOVEME? dex_path=$(ynh_app_setting_get --app=$app --key=dex_path)
#REMOVEME? oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret)
#REMOVEME? oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name)
#REMOVEME? oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback)
#REMOVEME? dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri)
#REMOVEME? dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri)
#REMOVEME? dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
#REMOVEME? 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
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
#REMOVEME? change_domain=0
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
then
#REMOVEME? change_domain=1
fi
#REMOVEME? change_path=0
#REMOVEME? if [ "$old_path" != "$new_path" ]
then
ynh_die "Outline has to be installed on the root of a domain"
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -89,7 +16,7 @@ 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
@ -98,25 +25,12 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
ynh_change_url_nginx_config
#REMOVEME? 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
#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# UPDATING A CONFIGURATION
#=================================================
#REMOVEME?
domain=$new_domain
#REMOVEME? ynh_secure_remove --file="$install_dir/.env"
#domain=$new_domain
ynh_script_progression --message="Updating the configuration file..." --weight=1
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
@ -141,20 +55,12 @@ 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
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# SLACK WARNING
#=================================================
ynh_print_info --message="Don't forget to add a new redirction url in your Slack app settings !"
ynh_print_info --message="Don't forget to add a new redirction URL in your Slack app settings!"
#=================================================
# END OF SCRIPT

View file

@ -9,27 +9,10 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? 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
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
path="/"
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
#REMOVEME? language=$YNH_APP_ARG_LANGUAGE
if [ $language == "fr" ]; then
language_key="fr_FR"
echo "French"
@ -41,8 +24,6 @@ fi
secret_key=$(ynh_hex_32_random)
utils_secret=$(ynh_hex_32_random)
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF MINIO IS INSTALLED, IF NOT INSTALL IT
#=================================================
@ -131,47 +112,18 @@ 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
#=================================================
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
#REMOVEME? port=$(ynh_find_port --port=2410)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_script_progression --message="Installing dependencies..." --weight=1
# Install nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies 2>&1
# Install Yarn
#REMOVEME? 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
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app)
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#REMOVEME? ynh_psql_test_if_first_run
#REMOVEME? ynh_psql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$secret_key
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
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
@ -181,11 +133,9 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=2
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -210,20 +160,13 @@ 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
#=================================================
# BUILD YARN DEPENDENCIES
#=================================================
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
pushd "$install_dir"
ynh_use_nodejs
#REMOVEME? 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=3000" 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
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
#=================================================
# ADD A CONFIGURATION
@ -236,40 +179,20 @@ chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#=================================================
# RUN DB MIGRATION
# BUILD YARN DEPENDENCIES
#=================================================
ynh_script_progression --message="Running DB initial migration..." --weight=3
ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --weight=18
pushd "$install_dir"
ynh_use_nodejs
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=3000" 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
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
#=================================================
# 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
#=================================================
@ -278,25 +201,6 @@ 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
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
#REMOVEME? if [ $is_public -eq 1 ]
then
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
fi
ynh_permission_url --permission="main" --auth_header=false
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -51,47 +51,17 @@ 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 dedicated NGINX config
ynh_remove_nginx_config
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..."
# Remove a database if it exists, along with the associated user
#REMOVEME? ynh_psql_remove_db --db_user=$db_name --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
ynh_remove_nodejs
#=================================================
# REMOVE APP MAIN DIR
#=================================================
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
#REMOVEME? ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE DEX APP
#=================================================
@ -107,29 +77,12 @@ ynh_script_progression --message="Removing Outline MinIO bucket..." --weight=1
pushd "$mc_path"
ynh_exec_warn_less sudo -u minio ./mc rb minio/outlinestorage --force
popd
ynh_secure_remove --file="$mc_path/outlinestorage"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
#REMOVEME? 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="If you don't need it anymore, don't forget to remove the MinIO app!"
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -50,14 +50,6 @@ source /usr/share/yunohost/helpers
#REMOVEME? dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri)
#REMOVEME? dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir"
#=================================================
# CHECK IF DEX IS INSTALLED, IF NOT INSTALL IT
#=================================================
@ -88,23 +80,6 @@ if ! yunohost app list | grep -q "id: minio"; then
yunohost app install https://github.com/YunoHost-Apps/minio_ynh --force --args "domain=$minio_domain&is_$public=true&admin=$minio_admin&password=$minio_password"
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
#=================================================
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -112,7 +87,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -138,23 +112,16 @@ ynh_secure_remove --file="$mc_path/outlinestorage"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Install nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies 2>&1
# Install Yarn
#REMOVEME? 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_install_nodejs --nodejs_version=$NODEJS_VERSION
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
#REMOVEME? ynh_psql_test_if_first_run
#REMOVEME? 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
#=================================================
@ -174,28 +141,15 @@ chown $app:$app "$install_dir/.env"
#=================================================
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
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
#=================================================
@ -205,13 +159,6 @@ 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=nginx --action=reload
#=================================================

View file

@ -44,24 +44,6 @@ source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? 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
#REMOVEME? ynh_secure_remove --file="$install_dir/outlinestorage"
ynh_secure_remove --file="$mc_path/outlinestorage"
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -69,15 +51,7 @@ ynh_secure_remove --file="$mc_path/outlinestorage"
#=================================================
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
#=================================================
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -91,7 +65,6 @@ then
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
fi
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -115,33 +88,16 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1
#REMOVEME? 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
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
# Install Yarn
#REMOVEME? 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 a dedicated systemd config
ynh_add_systemd_config
#=================================================
# UPGRADE YARN DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=10
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
pushd "$install_dir"
ynh_use_nodejs
#REMOVEME? 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=3000" 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
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
#=================================================
# UPDATE A CONFIG FILE
@ -154,53 +110,24 @@ chmod 400 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
#=================================================
# RUN DB MIGRATION
# UPGRADE YARN DEPENDENCIES
#=================================================
ynh_script_progression --message="Running DB initial migration..."
ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient!" --weight=10
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --frozen-lockfile --network-timeout 1000000000
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_OPTIONS="--max-old-space-size=3000" yarn build
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate
popd
#=================================================
# SETUP SYSTEMD
#=================================================
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
#=================================================
# 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
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT

24
tests.toml Normal file
View file

@ -0,0 +1,24 @@
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------
exclude = ["install.multi"]
preinstall = """
sudo yunohost domain add dex.domain.tld
sudo yunohost domain add minio.domain.tld
"""
# -------------------------------
# Default args to use for install
# -------------------------------
args.dex_domain = "dex.domain.tld"
args.dex_path = "/example"
args.minio_domain = "minio.domain.tld"
args.minio_admin = "package_checker"
args.minio_password = "1Strong-Password"