From 4b2700f349c5983edfc413dc28322a0c79ca68c9 Mon Sep 17 00:00:00 2001 From: Laur Ivan Date: Wed, 7 Dec 2022 11:04:33 +0100 Subject: [PATCH] feat! Add outline configuration. --- defaults/main.yml | 30 ++++++++++++++++++++++ templates/docker-compose.yml.j2 | 7 +++++- templates/env.outline.conf.j2 | 44 ++++++++++++++++++--------------- 3 files changed, 60 insertions(+), 21 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 97dbfcb..9778eae 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,9 @@ --- # defaults file for outline +outline_secret_key: 'changeme' +outline_utils_secret: 'changeme' + outline_setup_path: '~/outline' @@ -19,8 +22,35 @@ oidc_auth_uri: oidc_token_uri: oidc_userinfo_uri: +# If the db_host is not "postgres", then we assume the +# db is external and not spin up the docker container +outline_db_schema: "postgres" +outline_db_host: "postgres" +outlinr_db_port: "5432" outline_db_user: "postgres" outline_db_password: "changeme" outline_db: "outline" +# Spin up the fake S3 only if "fake_s3" is true +outline_fake_s3: true +outline_fake_s3_port: +outline_aws_access_key_id: +outline_aws_secret_access_key: +outline_aws_region: +outline_aws_s3_upload_bucket_url: "http://s3:4569" +outline_aws_s3_upload_bucket_name: outline-bucket +outline_aws_s3_upload_max_size: "26214400" +outline_aws_s3_force_path_style: "true" +outline_aws_s3_acl: "private" + +outline_smtp_host: +outline_smtp_port: +outline_smtp_username: +outline_smtp_password: +outline_smtp_from_email: +outline_smtp_reply_email: + +outline_team_logo_url: + +outline_language: 'en_US' diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 5430742..e4bc061 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -17,6 +17,7 @@ services: - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro +{% if outline_db_schema == 'postgres' and outline_db_host == 'postgres' %} postgres: image: docker.io/library/postgres:12-alpine env_file: @@ -36,8 +37,11 @@ services: {% endif %} volumes: - {{ outline_volume_db }}:/var/lib/postgresql/data +{% else %} + # External database at "{{ outline_db_schema }}:{{ outline_db_host }}: {{ outline_db_port }}" +{% endif %} - +{% if outline_fake_s3 %} s3: image: lphoward/fake-s3 env_file: @@ -50,6 +54,7 @@ services: - {{ outline_volume_s3 }}:/fakes3_root networks: - outline +{% endif %} outline: image: outlinewiki/outline:latest diff --git a/templates/env.outline.conf.j2 b/templates/env.outline.conf.j2 index 402217b..1c93aae 100644 --- a/templates/env.outline.conf.j2 +++ b/templates/env.outline.conf.j2 @@ -3,11 +3,11 @@ # keys (for auth) and the SECRET_KEY. # # Please use `openssl rand -hex 32` to create SECRET_KEY -SECRET_KEY=generate_a_new_key -UTILS_SECRET=generate_a_new_key +SECRET_KEY={{ outline_secret_key }} +UTILS_SECRET={{ outline_utils_secret }} -DATABASE_URL=postgres://{{ outline_db_user }}:{{ outline_db_password }}@postgres:5432/{{ outline_db }} -DATABASE_URL_TEST=postgres://{{ outline_db_user }}:{{ outline_db_password }}@wk-postgres:5432/{{ outline_db }}_test +DATABASE_URL={{ outline_db_schema }}://{{ outline_db_user }}:{{ outline_db_password }}@{{outline_db_host}}:{{ outline_db_port }}/{{ outline_db }} +DATABASE_URL_TEST={{ outline_db_schema }}://{{ outline_db_user }}:{{ outline_db_password }}@{{outline_db_host}}:{{ outline_db_port }}/{{ outline_db }}_test REDIS_URL=redis://redis:6379 # Must point to the publicly accessible URL for the installation @@ -49,31 +49,35 @@ GOOGLE_ANALYTICS_ID= SENTRY_DSN= # AWS credentials (optional in development) -AWS_ACCESS_KEY_ID=get_a_key_from_aws -AWS_SECRET_ACCESS_KEY=get_the_secret_of_above_key -AWS_REGION=xx-xxxx-x -AWS_S3_UPLOAD_BUCKET_URL=http://s3:4569 -AWS_S3_UPLOAD_BUCKET_NAME=outline-bucket -AWS_S3_UPLOAD_MAX_SIZE=26214400 -AWS_S3_FORCE_PATH_STYLE=true +AWS_ACCESS_KEY_ID={{ outline_aws_access_key_id }} +AWS_SECRET_ACCESS_KEY={{ outline_aws_secret_access_key }} +AWS_REGION={{ outline_aws_region }} +AWS_S3_UPLOAD_BUCKET_URL={ outline_aws_s3_upload_bucket_url} +AWS_S3_UPLOAD_BUCKET_NAME={{ outline_aws_s3_upload_bucket_name }} +AWS_S3_UPLOAD_MAX_SIZE={{ outline_aws_s3_upload_max_size }} +AWS_S3_FORCE_PATH_STYLE={{ outline_aws_s3_force_path_style }} # uploaded s3 objects permission level, default is private # set to "public-read" to allow public access -AWS_S3_ACL=private +AWS_S3_ACL={{ outline_aws_s3_acl }} +{% if outline_smtp_host and outline_smtp_port %} # Emails configuration (optional) -SMTP_HOST= -SMTP_PORT= -SMTP_USERNAME= -SMTP_PASSWORD= -SMTP_FROM_EMAIL= -SMTP_REPLY_EMAIL= +SMTP_HOST={{ outline_smtp_host }} +SMTP_PORT={{ outline_smtp_port }} +SMTP_USERNAME={{ outline_smtp_username }} +SMTP_PASSWORD={{ outline_smtp_password }} +SMTP_FROM_EMAIL={{ outline_smtp_from_email }} +SMTP_REPLY_EMAIL={{ outline_smtp_reply_email }} +{% endif %} +{% if outline_team_logo_url %} # Custom logo that displays on the authentication screen, scaled to height: 60px -# TEAM_LOGO=https://example.com/images/logo.png +TEAM_LOGO={{ outline_team_logo_url }} +{% endif %} # See translate.getoutline.com for a list of available language codes and their # percentage translated. -DEFAULT_LANGUAGE=en_US +DEFAULT_LANGUAGE={{ outline_language }}