mirror of
https://github.com/YunoHost-Apps/outline_ynh.git
synced 2024-09-03 19:56:12 +02:00
commit
efcb9a3228
17 changed files with 306 additions and 137 deletions
|
@ -1,5 +1,8 @@
|
||||||
|
|
||||||
# Outline wiki for Yunohost
|
# Outline wiki for Yunohost
|
||||||
|
[](https://dash.yunohost.org/appci/app/outline)
|
||||||
|
|
||||||
|
|
||||||
<img width="1640" alt="110356468-26374600-7fef-11eb-9f6a-f2cc2c8c6590" src="https://user-images.githubusercontent.com/24638389/134176351-8a7ecaf8-628e-49af-99b4-493287b36a77.png">
|
<img width="1640" alt="110356468-26374600-7fef-11eb-9f6a-f2cc2c8c6590" src="https://user-images.githubusercontent.com/24638389/134176351-8a7ecaf8-628e-49af-99b4-493287b36a77.png">
|
||||||
|
|
||||||
# Important points to read before installation
|
# Important points to read before installation
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# Example app pour YunoHost
|
# Example app pour YunoHost
|
||||||
|
[](https://dash.yunohost.org/appci/app/outline)
|
||||||
|
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/example)  
|
[](https://dash.yunohost.org/appci/app/example)  
|
||||||
[](https://install-app.yunohost.org/?app=example)
|
[](https://install-app.yunohost.org/?app=example)
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld"
|
domain="domain.tld"
|
||||||
path="/path"
|
path="/"
|
||||||
admin="john"
|
|
||||||
language="fr"
|
language="fr"
|
||||||
is_public=1
|
is_public=1
|
||||||
password="1Strong-Password"
|
password="1Strong-Password"
|
||||||
port="666"
|
port="666"
|
||||||
|
slack_key="slack"
|
||||||
|
slack_secret="secret"
|
||||||
|
minio_domain="sub.domain.tld"
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=1
|
||||||
|
@ -14,11 +16,11 @@
|
||||||
setup_nourl=0
|
setup_nourl=0
|
||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=0
|
||||||
#upgrade=1 from_commit=CommitHash
|
#upgrade=1 from_commit=CommitHash
|
||||||
backup_restore=1
|
backup_restore=0
|
||||||
multi_instance=1
|
multi_instance=0
|
||||||
change_url=1
|
change_url=0
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=none
|
Notification=none
|
||||||
|
|
25
conf/.env
25
conf/.env
|
@ -18,7 +18,8 @@ UTILS_SECRET=__UTILS_SECRET__
|
||||||
|
|
||||||
# For production point these at your databases, in development the default
|
# For production point these at your databases, in development the default
|
||||||
# should work out of the box.
|
# should work out of the box.
|
||||||
DATABASE_URL=postgres://__DB_NAME__:__DB_PWD__@localhost:5432/__DB_NAME__
|
DATABASE_URL=postgres://__DB_NAME__:__SECRET_KEY__@localhost:5432/__DB_NAME__
|
||||||
|
DATABASE_URL_TEST=postgres://user:pass@localhost:5532/outline-test
|
||||||
# Uncomment this to disable SSL for connecting to Postgres
|
# Uncomment this to disable SSL for connecting to Postgres
|
||||||
PGSSLMODE=disable
|
PGSSLMODE=disable
|
||||||
REDIS_URL=redis://localhost:6379
|
REDIS_URL=redis://localhost:6379
|
||||||
|
@ -28,6 +29,10 @@ REDIS_URL=redis://localhost:6379
|
||||||
URL=https://__DOMAIN__
|
URL=https://__DOMAIN__
|
||||||
PORT=__PORT__
|
PORT=__PORT__
|
||||||
|
|
||||||
|
# See [documentation](docs/SERVICES.md) on running a separate collaboration
|
||||||
|
# server, for normal operation this does not need to be set.
|
||||||
|
COLLABORATION_URL=
|
||||||
|
|
||||||
# To support uploading of images for avatars and document attachments an
|
# To support uploading of images for avatars and document attachments an
|
||||||
# s3-compatible storage must be provided. AWS S3 is recommended for redundency
|
# s3-compatible storage must be provided. AWS S3 is recommended for redundency
|
||||||
# however if you want to keep all file storage local an alternative such as
|
# however if you want to keep all file storage local an alternative such as
|
||||||
|
@ -84,11 +89,15 @@ OIDC_AUTH_URI=
|
||||||
OIDC_TOKEN_URI=
|
OIDC_TOKEN_URI=
|
||||||
OIDC_USERINFO_URI=
|
OIDC_USERINFO_URI=
|
||||||
|
|
||||||
|
# Specify which claims to derive user information from
|
||||||
|
# Supports any valid JSON path with the JWT payload
|
||||||
|
OIDC_USERNAME_CLAIM=preferred_username
|
||||||
|
|
||||||
# Display name for OIDC authentication
|
# Display name for OIDC authentication
|
||||||
OIDC_DISPLAY_NAME=OpenID Connect
|
OIDC_DISPLAY_NAME=OpenID
|
||||||
|
|
||||||
# Space separated auth scopes.
|
# Space separated auth scopes.
|
||||||
OIDC_SCOPES=openid profile email
|
OIDC_SCOPES="openid profile email"
|
||||||
|
|
||||||
|
|
||||||
# –––––––––––––––– OPTIONAL ––––––––––––––––
|
# –––––––––––––––– OPTIONAL ––––––––––––––––
|
||||||
|
@ -115,8 +124,8 @@ WEB_CONCURRENCY=1
|
||||||
# especially large Word documents with embedded imagery
|
# especially large Word documents with embedded imagery
|
||||||
MAXIMUM_IMPORT_SIZE=5120000
|
MAXIMUM_IMPORT_SIZE=5120000
|
||||||
|
|
||||||
# You may enable or disable debugging categories to increase the noisiness of
|
# You can remove this line if your reverse proxy already logs incoming http
|
||||||
# logs. The default is a good balance
|
# requests and this ends up being duplicative
|
||||||
DEBUG=cache,presenters,events,emails,mailer,utils,http,server,processors
|
DEBUG=cache,presenters,events,emails,mailer,utils,http,server,processors
|
||||||
|
|
||||||
# Comma separated list of domains to be allowed to signin to the wiki. If not
|
# Comma separated list of domains to be allowed to signin to the wiki. If not
|
||||||
|
@ -145,12 +154,12 @@ SMTP_USERNAME=''
|
||||||
SMTP_PASSWORD=''
|
SMTP_PASSWORD=''
|
||||||
SMTP_FROM_EMAIL='__APP__@__DOMAIN__'
|
SMTP_FROM_EMAIL='__APP__@__DOMAIN__'
|
||||||
SMTP_REPLY_EMAIL='webmaster@__DOMAIN__'
|
SMTP_REPLY_EMAIL='webmaster@__DOMAIN__'
|
||||||
SMTP_TLS_CIPHERS=''
|
SMTP_TLS_CIPHERS=
|
||||||
SMTP_SECURE='true'
|
SMTP_SECURE='false'
|
||||||
|
|
||||||
# Custom logo that displays on the authentication screen, scaled to height: 60px
|
# Custom logo that displays on the authentication screen, scaled to height: 60px
|
||||||
# TEAM_LOGO=https://example.com/images/logo.png
|
# TEAM_LOGO=https://example.com/images/logo.png
|
||||||
|
|
||||||
# The default interface language. See translate.getoutline.com for a list of
|
# The default interface language. See translate.getoutline.com for a list of
|
||||||
# available language codes and their rough percentage translated.
|
# available language codes and their rough percentage translated.
|
||||||
DEFAULT_LANGUAGE=__LANGUAGE_KEY__
|
DEFAULT_LANGUAGE=__LANGUAGE_KEY__
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_URL=https://github.com/outline/outline/archive/refs/tags/v0.59.0.tar.gz
|
SOURCE_URL=https://github.com/outline/outline/archive/refs/tags/v0.60.1.tar.gz
|
||||||
SOURCE_SUM=6a3caea9e5ec8dc9c2594cf4d1b43be305097604112c698b6bacad0883ba38f3
|
SOURCE_SUM=f47cb5ab67aff07382cd3470a94397855e12ff965732870af3665a0bc436c1c7
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "An open, extensible, wiki for your team built using React and Node.js.",
|
"en": "An open, extensible, wiki for your team built using React and Node.js.",
|
||||||
"fr": "Un wiki open source et évolutif pour votre équipe, conçu avec React et Node.js"
|
"fr": "Un wiki open source et évolutif pour votre équipe, conçu avec React et Node.js"
|
||||||
},
|
},
|
||||||
"version": "59.0~ynh1",
|
"version": "0.60.1~ynh1",
|
||||||
"url": "www.getoutline.com",
|
"url": "www.getoutline.com",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "BSL 1.1",
|
"license": "BSL 1.1",
|
||||||
|
|
|
@ -13,6 +13,10 @@ NODEJS_VERSION=14
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_hex_32_random() {
|
||||||
|
echo "$(openssl rand -hex 32)"
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -30,9 +30,18 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
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)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
language_key=$(ynh_app_setting_get --app=$app --key=language_key)
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
slack_key=$(ynh_app_setting_get --app=$app --key=slack_key)
|
||||||
|
slack_secret=$(ynh_app_setting_get --app=$app --key=slack_secret)
|
||||||
|
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
||||||
|
utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret)
|
||||||
|
minio_domain=$(ynh_app_setting_get --app="minio" --key=domain)
|
||||||
|
minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id)
|
||||||
|
minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key)
|
||||||
|
mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
@ -44,30 +53,30 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
### creates and fill the archive with the files happens in the core after this
|
### 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.
|
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP MINIO
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
pushd "$mc_path"
|
||||||
|
ynh_exec_warn_less sudo -u minio mkdir outlinestorage
|
||||||
|
ynh_exec_warn_less sudo -u minio ./mc mirror --a minio/outlinestorage ./outlinestorage/
|
||||||
|
popd
|
||||||
|
|
||||||
|
mv "$mc_path/outlinestorage" "$final_path/outlinestorage"
|
||||||
|
chown -R outline:www-data "$final_path/outlinestorage"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE DATA DIR
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP FAIL2BAN CONFIGURATION
|
# BACKUP FAIL2BAN CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -90,22 +99,14 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP VARIOUS FILES
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||||
ynh_backup --src_path="/etc/cron.d/$app"
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/$app/"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE MYSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Backing up the MySQL database..."
|
|
||||||
|
|
||||||
### (However, things like MySQL dumps *do* take some time to run, though the
|
### (However, things like MySQL dumps *do* take some time to run, though the
|
||||||
### copy of the generated dump to the archive still happens later)
|
### copy of the generated dump to the archive still happens later)
|
||||||
|
|
||||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -28,7 +28,19 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
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)
|
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)
|
||||||
|
slack_key=$(ynh_app_setting_get --app=$app --key=slack_key)
|
||||||
|
slack_secret=$(ynh_app_setting_get --app=$app --key=slack_secret)
|
||||||
|
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
||||||
|
utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret)
|
||||||
|
minio_domain=$(ynh_app_setting_get --app="minio" --key=domain)
|
||||||
|
minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id)
|
||||||
|
minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key)
|
||||||
|
mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
|
@ -60,7 +72,7 @@ fi
|
||||||
change_path=0
|
change_path=0
|
||||||
if [ "$old_path" != "$new_path" ]
|
if [ "$old_path" != "$new_path" ]
|
||||||
then
|
then
|
||||||
change_path=1
|
ynh_die "Outline has to be installed on the root of a domain"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -79,18 +91,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
# Change the path in the NGINX config file
|
|
||||||
if [ $change_path -eq 1 ]
|
|
||||||
then
|
|
||||||
# Make a backup of the original NGINX config file if modified
|
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
|
||||||
# Set global variables for NGINX helper
|
|
||||||
domain="$old_domain"
|
|
||||||
path_url="$new_path"
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change the domain for NGINX
|
# Change the domain for NGINX
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
|
@ -102,10 +102,28 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# UPDATING A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# ...
|
|
||||||
|
domain=$new_domain
|
||||||
|
|
||||||
|
ynh_secure_remove --file="$final_path/.env"
|
||||||
|
ynh_script_progression --message="Updating the configuration file..." --time --weight=1
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
|
||||||
|
|
||||||
|
chmod 400 "$final_path/.env"
|
||||||
|
chown $app:$app "$final_path/.env"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# RUN DB MIGRATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Running DB initial migration..." --weight=3
|
||||||
|
|
||||||
|
pushd "$final_path"
|
||||||
|
ynh_use_nodejs
|
||||||
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
@ -123,6 +141,12 @@ ynh_script_progression --message="Reloading NGINX web server..." --time --weight
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SLACK WARNING
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Don't forget to add a new redirction url in your Slack app settings !"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -25,7 +25,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url="/" #$YNH_APP_ARG_PATH
|
path_url="/"
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
|
||||||
language=$YNH_APP_ARG_LANGUAGE
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
|
@ -38,8 +38,8 @@ else
|
||||||
echo "English"
|
echo "English"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
secret_key=`openssl rand -hex 32`
|
secret_key=$(ynh_hex_32_random)
|
||||||
utils_secret=`openssl rand -hex 32`
|
utils_secret=$(ynh_hex_32_random)
|
||||||
|
|
||||||
slack_key=$YNH_APP_ARG_SLACK_KEY
|
slack_key=$YNH_APP_ARG_SLACK_KEY
|
||||||
slack_secret=$YNH_APP_ARG_SLACK_SECRET
|
slack_secret=$YNH_APP_ARG_SLACK_SECRET
|
||||||
|
@ -49,7 +49,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF MINIO IS INSTALLED, IF NOT INSTALL IT
|
# CHECK IF MINIO IS INSTALLED, IF NOT INSTALL IT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing MinIO if needed..." --time --weight=1
|
ynh_script_progression --message="Installing MinIO if needed..." --weight=18
|
||||||
|
|
||||||
if ! yunohost app list | grep -q "id: minio"; then
|
if ! yunohost app list | grep -q "id: minio"; then
|
||||||
echo "MinIO is not installed. Installing... "
|
echo "MinIO is not installed. Installing... "
|
||||||
|
@ -63,37 +63,40 @@ fi
|
||||||
minio_domain=$(ynh_app_setting_get --app="minio" --key=domain)
|
minio_domain=$(ynh_app_setting_get --app="minio" --key=domain)
|
||||||
minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id)
|
minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id)
|
||||||
minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key)
|
minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key)
|
||||||
|
mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
final_path=/opt/yunohost/$app
|
final_path=/opt/yunohost/$app
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
mc_path=$final_path/mc
|
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --time --weight=1
|
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=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
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=language --value=$language
|
||||||
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
|
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=utils_secret --value=$utils_secret
|
||||||
|
ynh_app_setting_set --app=$app --key=slack_key --value=$slack_key
|
||||||
|
ynh_app_setting_set --app=$app --key=slack_secret --value=$slack_secret
|
||||||
|
ynh_app_setting_set --app=$app --key=language_key --value=$language_key
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Finding an available port..." --time --weight=1
|
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=2410)
|
port=$(ynh_find_port --port=2410)
|
||||||
|
@ -102,14 +105,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||||
|
|
||||||
### SHOULD HAVE A CHECK FOR MINIO + INSTALLATION HERE
|
|
||||||
#if ! ynh_package_is_installed --package="minio"
|
|
||||||
#then
|
|
||||||
# yunohost tools update
|
|
||||||
# yunohost app install minio --force
|
|
||||||
#fi
|
|
||||||
|
|
||||||
# Install nodejs
|
# Install nodejs
|
||||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||||
|
@ -122,7 +118,7 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring system user..." --time --weight=1
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
@ -130,12 +126,12 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A POSTGRESQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a PostgreSQL database..." --time --weight=1
|
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
|
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 unaccent;" --database=$db_name
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
||||||
|
@ -143,7 +139,7 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --time --weight=1
|
ynh_script_progression --message="Setting up source files..." --weight=2
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
@ -153,36 +149,20 @@ chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# DOWNLOAD, CHECK AND UNPACK MINIO CLIENT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Setting up MinIO client..." --time --weight=1
|
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$mc_path" --source_id=mc
|
|
||||||
|
|
||||||
# FIXME: this should be managed by the core in the future
|
|
||||||
# Here, as a packager, you may have to tweak the ownerhsip/permissions
|
|
||||||
# such that the appropriate users (e.g. maybe www-data) can access
|
|
||||||
# files in some cases.
|
|
||||||
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
|
|
||||||
# this will be treated as a security issue.
|
|
||||||
chmod -R 750 "$mc_path"
|
|
||||||
chmod -R o-rwx "$mc_path"
|
|
||||||
chown -R $app:www-data "$mc_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP MINIO BUCKET
|
# SETUP MINIO BUCKET
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up MinIO bucket for Outline..." --time --weight=1
|
ynh_script_progression --message="Setting up MinIO bucket for Outline..." --weight=1
|
||||||
|
|
||||||
$mc_path/mc alias set minio "https://$minio_domain" $minio_id $minio_key
|
pushd "$mc_path"
|
||||||
$mc_path/mc mb minio/outlinestorage --region "fr-ynh-1"
|
ynh_exec_warn_less sudo -u minio ./mc mb minio/outlinestorage --region "fr-ynh-1"
|
||||||
$mc_path/mc policy set public minio/outlinestorage
|
ynh_exec_warn_less sudo -u minio ./mc policy set public minio/outlinestorage
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -191,26 +171,25 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILD YARN DEPENDENCIES
|
# BUILD YARN DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --time --weight=10
|
|
||||||
|
|
||||||
pushd "$final_path"
|
pushd "$final_path"
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
ynh_script_progression --message="Fetching Yarn dev dependencies... This can be very long, be patient !" --time --weight=5
|
ynh_script_progression --message="Fetching Yarn dev dependencies... This can be very long, be patient !" --weight=18
|
||||||
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --no-optional --frozen-lockfile
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --no-optional --frozen-lockfile
|
||||||
ynh_script_progression --message="Cleaning cache... " --time --weight=1
|
ynh_script_progression --message="Cleaning cache... " --weight=3
|
||||||
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 cache clean
|
||||||
ynh_script_progression --message="Building Yarn dev dependencies... This can be very long, be patient !" --time --weight=5
|
ynh_script_progression --message="Building Yarn dev dependencies... This can be very long, be patient !" --weight=18
|
||||||
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn build
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn build
|
||||||
ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --time --weight=5
|
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 --production=true --frozen-lockfile
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production=true --frozen-lockfile
|
||||||
ynh_script_progression --message="Cleaning cache... " --time --weight=1
|
ynh_script_progression --message="Cleaning cache... " --weight=3
|
||||||
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 cache clean
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --time --weight=1
|
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="$final_path/.env"
|
||||||
|
|
||||||
|
@ -220,7 +199,7 @@ chown $app:$app "$final_path/.env"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RUN DB MIGRATION
|
# RUN DB MIGRATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Running DB initial migration..."
|
ynh_script_progression --message="Running DB initial migration..." --weight=3
|
||||||
|
|
||||||
pushd "$final_path"
|
pushd "$final_path"
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
|
@ -230,7 +209,7 @@ popd
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --time --weight=1
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||||
|
|
||||||
|
@ -242,7 +221,7 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring log rotation..." --time --weight=1
|
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
@ -250,14 +229,14 @@ ynh_use_logrotate
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
@ -265,7 +244,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring permissions..." --time --weight=1
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
|
@ -276,7 +255,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
@ -284,4 +263,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --time --last
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -16,11 +16,21 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
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)
|
||||||
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
language_key=$(ynh_app_setting_get --app=$app --key=language_key)
|
||||||
|
slack_key=$(ynh_app_setting_get --app=$app --key=slack_key)
|
||||||
|
slack_secret=$(ynh_app_setting_get --app=$app --key=slack_secret)
|
||||||
|
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
||||||
|
utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret)
|
||||||
|
|
||||||
|
|
||||||
|
minio_domain=$(ynh_app_setting_get --app="minio" --key=domain)
|
||||||
|
minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id)
|
||||||
|
minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key)
|
||||||
|
mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -57,7 +67,7 @@ ynh_remove_logrotate
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..."
|
ynh_script_progression --message="Removing the PostgreSQL database..."
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
ynh_psql_remove_db --db_user=$db_name --db_name=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
|
@ -76,6 +86,15 @@ ynh_script_progression --message="Removing app main directory..." --time --weigh
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE MINIO BUCKET
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing Outline MinIO bucket..." --time --weight=1
|
||||||
|
|
||||||
|
pushd "$mc_path"
|
||||||
|
ynh_exec_warn_less sudo -u minio ./mc rb minio/outlinestorage --force
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -21,6 +21,15 @@ ynh_clean_setup () {
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK IF MINIO IS INSTALLED, IF NOT WARN USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Checking if MinIO is installed..." --time --weight=1
|
||||||
|
|
||||||
|
if ! yunohost app list | grep -q "id: minio"; then
|
||||||
|
ynh_die --message="We can't restore because MinIO is not installed ! Please install MinIO first"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -28,11 +37,20 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
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)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
language_key=$(ynh_app_setting_get --app=$app --key=language_key)
|
||||||
|
slack_key=$(ynh_app_setting_get --app=$app --key=slack_key)
|
||||||
|
slack_secret=$(ynh_app_setting_get --app=$app --key=slack_secret)
|
||||||
|
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
||||||
|
utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret)
|
||||||
|
minio_domain=$(ynh_app_setting_get --app="minio" --key=domain)
|
||||||
|
minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id)
|
||||||
|
minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key)
|
||||||
|
mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -40,7 +58,7 @@ db_user=$db_name
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
|
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
|
||||||
|
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
|
@ -70,6 +88,19 @@ chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE MINIO
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
mv "$final_path/outlinestorage" "$mc_path/outlinestorage"
|
||||||
|
chown -R minio:www-data "$mc_path/outlinestorage"
|
||||||
|
pushd "$mc_path"
|
||||||
|
ynh_exec_warn_less sudo -u minio ./mc mb minio/outlinestorage --region "fr-ynh-1"
|
||||||
|
ynh_exec_warn_less sudo -u minio ./mc policy set public minio/outlinestorage
|
||||||
|
ynh_exec_warn_less sudo -u minio ./mc mirror --a ./outlinestorage/ minio/outlinestorage
|
||||||
|
popd
|
||||||
|
ynh_secure_remove --file="$mc_path/outlinestorage"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -86,14 +117,26 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
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_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
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
|
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..." --time --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
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -114,7 +157,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
|
@ -16,12 +16,20 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
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)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
language_key=$(ynh_app_setting_get --app=$app --key=language_key)
|
||||||
|
slack_key=$(ynh_app_setting_get --app=$app --key=slack_key)
|
||||||
|
slack_secret=$(ynh_app_setting_get --app=$app --key=slack_secret)
|
||||||
|
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
||||||
|
utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret)
|
||||||
|
minio_domain=$(ynh_app_setting_get --app="minio" --key=domain)
|
||||||
|
minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id)
|
||||||
|
minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key)
|
||||||
|
mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -92,20 +100,49 @@ ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
# Install Nodejs
|
# Install Nodejs
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||||
|
|
||||||
# Install Yarn
|
# Install Yarn
|
||||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE YARN DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --time --weight=10
|
||||||
|
|
||||||
|
pushd "$final_path"
|
||||||
|
ynh_use_nodejs
|
||||||
|
ynh_script_progression --message="Fetching Yarn dev dependencies... This can be very long, be patient !" --time --weight=5
|
||||||
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --no-optional --frozen-lockfile
|
||||||
|
ynh_script_progression --message="Cleaning cache... " --time --weight=1
|
||||||
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean
|
||||||
|
ynh_script_progression --message="Building Yarn dev dependencies... This can be very long, be patient !" --time --weight=5
|
||||||
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn build
|
||||||
|
ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --time --weight=5
|
||||||
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production=true --frozen-lockfile
|
||||||
|
ynh_script_progression --message="Cleaning cache... " --time --weight=1
|
||||||
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..." --time --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --time --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file"
|
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
|
||||||
|
|
||||||
chmod 400 "$final_path/some_config_file"
|
chmod 400 "$final_path/.env"
|
||||||
chown $app:$app "$final_path/some_config_file"
|
chown $app:$app "$final_path/.env"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RUN DB MIGRATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Running DB initial migration..."
|
||||||
|
|
||||||
|
pushd "$final_path"
|
||||||
|
ynh_use_nodejs
|
||||||
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -130,7 +167,7 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
||||||
|
|
||||||
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Outline server" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
1
sources/patches/.gitignore
vendored
1
sources/patches/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*~
|
*~
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
|
*.js
|
14
sources/patches/app-01-email.patch
Normal file
14
sources/patches/app-01-email.patch
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
diff --git a/server/mailer.js b/server/mailer.js
|
||||||
|
index eeedb5ac..d979bab7 100644
|
||||||
|
--- a/server/mailer.js
|
||||||
|
+++ b/server/mailer.js
|
||||||
|
@@ -85,6 +85,7 @@ export class Mailer {
|
||||||
|
"SMTP_TLS_CIPHERS" in process.env
|
||||||
|
? { ciphers: process.env.SMTP_TLS_CIPHERS }
|
||||||
|
: undefined,
|
||||||
|
+ ignoreTLS:true
|
||||||
|
};
|
||||||
|
|
||||||
|
if (process.env.SMTP_USERNAME) {
|
||||||
|
--
|
||||||
|
2.18.0
|
15
sources/patches/app-02-email2.patch
Normal file
15
sources/patches/app-02-email2.patch
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
diff --git a/server/presenters/env.js b/server/presenters/env.js
|
||||||
|
index adf16ac9..54e009c8 100644
|
||||||
|
--- a/server/presenters/env.js
|
||||||
|
+++ b/server/presenters/env.js
|
||||||
|
@@ -17,7 +17,7 @@ export default function present(env: Object): Object {
|
||||||
|
SLACK_APP_ID: env.SLACK_APP_ID,
|
||||||
|
MAXIMUM_IMPORT_SIZE: env.MAXIMUM_IMPORT_SIZE || 1024 * 1000 * 5,
|
||||||
|
SUBDOMAINS_ENABLED: env.SUBDOMAINS_ENABLED === "true",
|
||||||
|
- EMAIL_ENABLED: !!env.SMTP_USERNAME || env.NODE_ENV === "development",
|
||||||
|
+ EMAIL_ENABLED: !!env.SMTP_HOST || env.NODE_ENV === "development",
|
||||||
|
GOOGLE_ANALYTICS_ID: env.GOOGLE_ANALYTICS_ID,
|
||||||
|
RELEASE: env.SOURCE_COMMIT || env.SOURCE_VERSION || undefined,
|
||||||
|
};
|
||||||
|
--
|
||||||
|
2.18.0
|
16
sources/patches/app-03-branding.patch
Normal file
16
sources/patches/app-03-branding.patch
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
diff --git a/app/scenes/Document/components/Document.js b/app/scenes/Document/components/Document.js
|
||||||
|
index 2c5bf69b..599bd4f6 100644
|
||||||
|
--- a/app/scenes/Document/components/Document.js
|
||||||
|
+++ b/app/scenes/Document/components/Document.js
|
||||||
|
@@ -593,9 +593,6 @@ class DocumentScene extends React.Component<Props> {
|
||||||
|
</MaxWidth>
|
||||||
|
</Container>
|
||||||
|
</Background>
|
||||||
|
- {isShare && !isCustomDomain() && (
|
||||||
|
- <Branding href="//www.getoutline.com?ref=sharelink" />
|
||||||
|
- )}
|
||||||
|
{!isShare && (
|
||||||
|
<>
|
||||||
|
<KeyboardShortcutsButton />
|
||||||
|
--
|
||||||
|
2.18.0
|
Loading…
Add table
Reference in a new issue