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-10-09 12:14:47 +02:00 committed by Félix Piédallu
parent 621067d0be
commit fcfbd0a56c
10 changed files with 314 additions and 241 deletions

View file

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

View file

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

78
manifest.toml Normal file
View file

@ -0,0 +1,78 @@
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.74.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"
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"]
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, ...
[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"
default = "visitors"
[install.language]
ask.en = "Choose the application language"
ask.fr = "Choisissez la langue de l'application"
type = "string"
choices = ["fr", "en"]
default = "en"
[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/e4d00783585f2a509da3565723227d2b5959a2e9.zip"
sha256 = "f3394b676393e574c52aab14786b3553a58c1a87e215ae889d9c8e4d3dd6d962"
[resources.system_user]
[resources.install_dir]
[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"
[resources.database]
type = "postgresql"

View file

@ -5,7 +5,7 @@
#=================================================
# dependencies used by the app
pkg_dependencies="postgresql"
#REMOVEME? pkg_dependencies="postgresql"
NODEJS_VERSION=20

View file

@ -14,37 +14,37 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#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
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
#REMOVEME? ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? 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)
#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? 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
@ -66,7 +66,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

View file

@ -13,67 +13,67 @@ source /usr/share/yunohost/helpers
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
#REMOVEME? old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
#REMOVEME? new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? 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)
#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? 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
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
#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
ynh_backup_before_upgrade
ynh_clean_setup () {
#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.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
#REMOVEME? change_domain=0
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
#REMOVEME? change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
#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
@ -92,38 +92,40 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
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
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
#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
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# UPDATING A CONFIGURATION
#=================================================
#REMOVEME?
domain=$new_domain
ynh_secure_remove --file="$final_path/.env"
#REMOVEME? ynh_secure_remove --file="$install_dir/.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
@ -140,9 +142,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SLACK WARNING

View file

@ -13,22 +13,22 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#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
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
path="/"
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
#REMOVEME? language=$YNH_APP_ARG_LANGUAGE
if [ $language == "fr" ]; then
language_key="fr_FR"
@ -41,20 +41,20 @@ fi
secret_key=$(ynh_hex_32_random)
utils_secret=$(ynh_hex_32_random)
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# 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
#REMOVEME? dex_domain=$YNH_APP_ARG_DEX_DOMAIN
#REMOVEME? dex_path=$YNH_APP_ARG_DEX_PATH
oidc_secret=$(ynh_hex_32_random)
oidc_name="Outline"
oidc_callback="$domain/auth/oidc.callback"
if yunohost app list | grep -q "$YNH_APP_ARG_DEX_DOMAIN$YNH_APP_ARG_DEX_PATH"; then
#REMOVEME? if yunohost app list | grep -q "$YNH_APP_ARG_DEX_DOMAIN$YNH_APP_ARG_DEX_PATH"; then
ynh_die "The domain provided for Dex is already used by another app. Please chose another one !"
fi
@ -77,28 +77,28 @@ fi
#===================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#===================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
#REMOVEME? 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"
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
#REMOVEME? 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
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
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=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
#REMOVEME? ynh_app_setting_set --app=$app --key=dex_domain --value=$dex_domain
#REMOVEME? 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
@ -111,42 +111,42 @@ ynh_app_setting_set --app=$app --key=dex_user_uri --value=$dex_user_uri
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
#REMOVEME? 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
#REMOVEME? port=$(ynh_find_port --port=2410)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
#REMOVEME? 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
#REMOVEME? 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
#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
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
#REMOVEME? 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
#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_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 +156,13 @@ 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
#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="$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 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# SETUP LOCAL STORAGE
@ -184,9 +184,9 @@ ynh_add_nginx_config
# BUILD YARN DEPENDENCIES
#=================================================
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
#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=3900" yarn build 2>&1
@ -199,17 +199,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..." --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
@ -259,21 +259,21 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
#REMOVEME? if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
#REMOVEME? 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
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT

View file

@ -12,27 +12,27 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? 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)
#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? 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)
#=================================================
# STANDARD REMOVE
@ -66,27 +66,27 @@ ynh_remove_logrotate
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Removing the PostgreSQL database..."
#REMOVEME? 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
#REMOVEME? ynh_psql_remove_db --db_user=$db_name --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#REMOVEME? ynh_remove_app_dependencies
ynh_remove_nodejs
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#REMOVEME? ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE DEX APP
@ -124,10 +124,10 @@ ynh_secure_remove --file="/etc/cron.d/$app"
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#REMOVEME? ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT

View file

@ -14,45 +14,45 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#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
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? 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)
#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? 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)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path"
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir"
#=================================================
# CHECK IF DEX IS INSTALLED, IF NOT INSTALL IT
@ -80,21 +80,21 @@ 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
#REMOVEME? 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"
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# 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 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE LOCAL STORAGE
@ -112,36 +112,36 @@ chown -R $app:www-data "/var/lib/outline"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
#REMOVEME? 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
#REMOVEME? 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"
#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"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
#REMOVEME? 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
#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
#=================================================
# UPDATING A CONFIGURATION
#=================================================
ynh_secure_remove --file="$final_path/.env"
#REMOVEME? ynh_secure_remove --file="$install_dir/.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"
#=================================================
# RESTORE SYSTEMD

View file

@ -12,27 +12,27 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? 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)
#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? 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)
#=================================================
# CHECK VERSION
@ -43,19 +43,19 @@ 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
#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
ynh_secure_remove --file="$final_path/outlinestorage"
#REMOVEME? ynh_secure_remove --file="$install_dir/outlinestorage"
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
@ -69,10 +69,10 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
#REMOVEME? 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"
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -83,15 +83,15 @@ 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"
#REMOVEME? ynh_secure_remove --file="$install_dir"
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 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=======================================================
# MIGRATE MINIO BUCKET IF UPGRADING FROM AN OLD VERSION
@ -102,10 +102,10 @@ 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)
#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)
mkdir -p "/var/lib/$app/data"
chown -R minio:www-data "/var/lib/$app"
@ -133,24 +133,24 @@ ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#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
# 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
#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
#=================================================
# UPGRADE YARN DEPENDENCIES
#=================================================
ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=10
#REMOVEME? ynh_script_progression --message="Building Yarn dependencies... 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
#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=3900" yarn build 2>&1
@ -163,17 +163,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
@ -222,9 +222,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT