mirror of
https://github.com/YunoHost-Apps/outline_ynh.git
synced 2024-09-03 19:56:12 +02:00
commit
cb16804a2d
6 changed files with 120 additions and 39 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*~
|
*~
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
|
.DS_Store
|
36
conf/.env
36
conf/.env
|
@ -10,11 +10,11 @@
|
||||||
|
|
||||||
# Generate a hex-encoded 32-byte random key. You should use `openssl rand -hex 32`
|
# Generate a hex-encoded 32-byte random key. You should use `openssl rand -hex 32`
|
||||||
# in your terminal to generate a random value.
|
# in your terminal to generate a random value.
|
||||||
SECRET_KEY=53b654d84c820573dc19e86d09c4c47d44c17b32055154a0cbc75efc5aee00fb
|
SECRET_KEY=__SECRET_KEY__
|
||||||
|
|
||||||
# Generate a unique random key. The format is not important but you could still use
|
# Generate a unique random key. The format is not important but you could still use
|
||||||
# `openssl rand -hex 32` in your terminal to produce this.
|
# `openssl rand -hex 32` in your terminal to produce this.
|
||||||
UTILS_SECRET=7cbd5fbf647a8f85f06560c6dad74d2eee21fd4e1889f91dabb7dd873c7428be
|
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.
|
||||||
|
@ -36,11 +36,11 @@ PORT=__PORT__
|
||||||
# A more detailed guide on setting up S3 is available here:
|
# A more detailed guide on setting up S3 is available here:
|
||||||
# => https://wiki.generaloutline.com/share/125de1cc-9ff6-424b-8415-0d58c809a40f
|
# => https://wiki.generaloutline.com/share/125de1cc-9ff6-424b-8415-0d58c809a40f
|
||||||
#
|
#
|
||||||
AWS_ACCESS_KEY_ID=get_a_key_from_aws
|
AWS_ACCESS_KEY_ID=__MINIO_ID__
|
||||||
AWS_SECRET_ACCESS_KEY=get_the_secret_of_above_key
|
AWS_SECRET_ACCESS_KEY=__MINIO_KEY__
|
||||||
AWS_REGION=xx-xxxx
|
AWS_REGION=fr-ynh-1
|
||||||
AWS_S3_UPLOAD_BUCKET_URL=http://s3:4569
|
AWS_S3_UPLOAD_BUCKET_URL=https://__MINIO_DOMAIN__
|
||||||
AWS_S3_UPLOAD_BUCKET_NAME=bucket_name_here
|
AWS_S3_UPLOAD_BUCKET_NAME=outlinestorage
|
||||||
AWS_S3_UPLOAD_MAX_SIZE=26214400
|
AWS_S3_UPLOAD_MAX_SIZE=26214400
|
||||||
AWS_S3_FORCE_PATH_STYLE=true
|
AWS_S3_FORCE_PATH_STYLE=true
|
||||||
AWS_S3_ACL=private
|
AWS_S3_ACL=private
|
||||||
|
@ -57,8 +57,8 @@ AWS_S3_ACL=private
|
||||||
#
|
#
|
||||||
# When configuring the Client ID, add a redirect URL under "OAuth & Permissions":
|
# When configuring the Client ID, add a redirect URL under "OAuth & Permissions":
|
||||||
# https://<URL>/auth/slack.callback
|
# https://<URL>/auth/slack.callback
|
||||||
SLACK_KEY=__SLACKKEY__
|
SLACK_KEY=__SLACK_KEY__
|
||||||
SLACK_SECRET=__SLACKSECRET__
|
SLACK_SECRET=__SLACK_SECRET__
|
||||||
|
|
||||||
# To configure Google auth, you'll need to create an OAuth Client ID at
|
# To configure Google auth, you'll need to create an OAuth Client ID at
|
||||||
# => https://console.cloud.google.com/apis/credentials
|
# => https://console.cloud.google.com/apis/credentials
|
||||||
|
@ -139,18 +139,18 @@ SENTRY_DSN=
|
||||||
|
|
||||||
# To support sending outgoing transactional emails such as "document updated" or
|
# To support sending outgoing transactional emails such as "document updated" or
|
||||||
# "you've been invited" you'll need to provide authentication for an SMTP server
|
# "you've been invited" you'll need to provide authentication for an SMTP server
|
||||||
SMTP_HOST=
|
SMTP_HOST='localhost'
|
||||||
SMTP_PORT=
|
SMTP_PORT='25'
|
||||||
SMTP_USERNAME=
|
SMTP_USERNAME=''
|
||||||
SMTP_PASSWORD=
|
SMTP_PASSWORD=''
|
||||||
SMTP_FROM_EMAIL=
|
SMTP_FROM_EMAIL='__APP__@__DOMAIN__'
|
||||||
SMTP_REPLY_EMAIL=
|
SMTP_REPLY_EMAIL='webmaster@__DOMAIN__'
|
||||||
SMTP_TLS_CIPHERS=
|
SMTP_TLS_CIPHERS=''
|
||||||
SMTP_SECURE=true
|
SMTP_SECURE='true'
|
||||||
|
|
||||||
# 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=en_US
|
DEFAULT_LANGUAGE=__LANGUAGE_KEY__
|
||||||
|
|
7
conf/mc.src
Normal file
7
conf/mc.src
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SOURCE_URL=https://dl.min.io/client/mc/release/linux-amd64/archive/mc.RELEASE.2021-11-05T10-05-06Z
|
||||||
|
SOURCE_SUM=9f5ad72fd93678f9f756c6da34a8d4d1e61f7356a96ee327c652ad765975d2b2
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=
|
||||||
|
SOURCE_IN_SUBDIR=false
|
||||||
|
SOURCE_FILENAME=mc
|
||||||
|
SOURCE_EXTRACT=false
|
|
@ -12,7 +12,7 @@ location / {
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Host $server_name;
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
|
client_max_body_size 200M;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
|
|
|
@ -46,15 +46,22 @@
|
||||||
"fr": "Choisissez la langue de l'application"
|
"fr": "Choisissez la langue de l'application"
|
||||||
},
|
},
|
||||||
"choices": ["fr", "en"],
|
"choices": ["fr", "en"],
|
||||||
"default": "fr"
|
"default": "en"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "slackkey",
|
"name": "slack_key",
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"ask": "Slack Client ID (from https://api.slack.com/apps)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "slacksecret",
|
"name": "slack_secret",
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"ask": "Slack Client Secret (from https://api.slack.com/apps)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "minio_domain",
|
||||||
|
"type": "domain",
|
||||||
|
"ask": "Domain for MinIO app (if not yet installed, it will automatically be). Please note that this domain has to be free from any app"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,22 +27,43 @@ ynh_abort_if_errors
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url="/" #$YNH_APP_ARG_PATH
|
path_url="/" #$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
language=$YNH_APP_ARG_LANGUAGE
|
|
||||||
slackkey=$YNH_APP_ARG_SLACKKEY
|
|
||||||
slacksecret=$YNH_APP_ARG_SLACKSECRET
|
|
||||||
|
|
||||||
### If it's a multi-instance app, meaning it can be installed several times independently
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
### The id of the app as stated in the manifest is available as $YNH_APP_ID
|
|
||||||
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2"...)
|
if [ $language == "fr" ]; then
|
||||||
### The app instance name is available as $YNH_APP_INSTANCE_NAME
|
language_key="fr_FR"
|
||||||
### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
echo "French"
|
||||||
### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
else
|
||||||
### - ynhexample__{N} for the subsequent installations, with N=3,4...
|
language_key="en_US"
|
||||||
### The app instance name is probably what interests you most, since this is
|
echo "English"
|
||||||
### guaranteed to be unique. This is a good unique identifier to define installation path,
|
fi
|
||||||
### db names...
|
|
||||||
|
secret_key=`openssl rand -hex 32`
|
||||||
|
utils_secret=`openssl rand -hex 32`
|
||||||
|
|
||||||
|
slack_key=$YNH_APP_ARG_SLACK_KEY
|
||||||
|
slack_secret=$YNH_APP_ARG_SLACK_SECRET
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK IF MINIO IS INSTALLED, IF NOT INSTALL IT
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing MinIO if needed..." --time --weight=1
|
||||||
|
|
||||||
|
if ! yunohost app list | grep -q "id: minio"; then
|
||||||
|
echo "MinIO is not installed. Installing... "
|
||||||
|
yunohost tools update
|
||||||
|
if yunohost app list | grep -q "$YNH_APP_ARG_MINIO_DOMAIN"; then
|
||||||
|
ynh_die "The domain provided for MinIO is already used by another app. Please chose another one !"
|
||||||
|
fi
|
||||||
|
yunohost app install https://github.com/limezy/minio_ynh --force --args "domain=$YNH_APP_ARG_MINIO_DOMAIN&is_public=true&language=en"
|
||||||
|
fi
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -51,6 +72,8 @@ ynh_script_progression --message="Validating installation parameters..." --time
|
||||||
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
|
||||||
|
|
||||||
|
@ -62,6 +85,8 @@ ynh_script_progression --message="Storing installation settings..." --time --wei
|
||||||
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=utils_secret --value=$utils_secret
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -79,6 +104,13 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
ynh_script_progression --message="Installing dependencies..." --time --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
|
||||||
|
|
||||||
|
@ -121,6 +153,32 @@ 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
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up MinIO bucket for Outline..." --time --weight=1
|
||||||
|
|
||||||
|
$mc_path/mc alias set minio "https://$minio_domain" $minio_id $minio_key
|
||||||
|
$mc_path/mc mb minio/outlinestorage --region "fr-ynh-1"
|
||||||
|
$mc_path/mc policy set public minio/outlinestorage
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -129,16 +187,24 @@ ynh_script_progression --message="Configuring NGINX web server..." --time --weig
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILD YARN DEPENDENCIES
|
# BUILD YARN DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building 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_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --frozen-lockfile
|
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_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_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
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue