captainVersion: 4
services:
    $$cap_appname-redis:
        image: redis:5
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname-fakes3:
        image: lphoward/fake-s3
        volumes:
            - $$cap_appname-fakes3:/fakes3_root
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname-db:
        image: postgres:12.2
        volumes:
            - $$cap_appname-db-data:/var/lib/postgresql/data
        restart: always
        environment:
            POSTGRES_USER: $$cap_db_user
            POSTGRES_PASSWORD: $$cap_db_pass
            POSTGRES_DB: outline
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname-outline:
        depends_on:
            - $$cap_appname-fakes3
            - $$cap_appname-redis
            - $$cap_appname-db
        image: outlinewiki/outline:$$cap_outline_version
        environment:
            SECRET_KEY: $$cap_secret_key
            UTILS_SECRET: $$cap_utils_secret
            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://srv-captain--$$cap_appname-fakes3:4569
            AWS_S3_UPLOAD_BUCKET_NAME: bucket_name_here
            AWS_S3_UPLOAD_MAX_SIZE: '26214400'
            AWS_S3_ACL: private
            SLACK_KEY: $$cap_slack_key
            SLACK_SECRET: $$cap_slack_secret
            GOOGLE_CLIENT_ID: $$cap_google_client_id
            GOOGLE_CLIENT_SECRET: $$cap_google_client_secret
            FORCE_HTTPS: 'false'
            DEPLOYMENT: self
            ENABLE_UPDATES: 'false'
            SUBDOMAINS_ENABLED: 'false'
            WEBSOCKETS_ENABLED: 'false'
            DEBUG: cache,presenters,events
            URL: https://$$cap_appname-outline.$$cap_root_domain
            PORT: '80'
            REDIS_URL: redis://srv-captain--$$cap_appname-redis:6379
            DATABASE_URL_TEST: postgres://$$cap_db_user:$$cap_db_pass@srv-captain--$$cap_appname-db:5432/outline-test
            DATABASE_URL: postgres://$$cap_db_user:$$cap_db_pass@srv-captain--$$cap_appname-db:5432/outline
caproverOneClickApp:
    variables:
        - id: $$cap_db_user
          label: Database user
          defaultValue: outlineuser
          validRegex: /^([a-zA-Z0-9])+$/
        - id: $$cap_db_pass
          label: Database password
          description: ''
          validRegex: /.{8,}/
        - id: $$cap_slack_key
          label: Slack Key
          description: 'IMPORTANT: You need to, at least, set one 3rd party login method, either Slack or Google'
          defaultValue: get_a_key_from_slack
        - id: $$cap_slack_secret
          label: Slack Secret
          description: ''
          defaultValue: get_the_secret_of_above_key
        - id: $$cap_google_client_id
          label: Google Client ID
        - id: $$cap_google_client_secret
          label: Google Client Secret
          description: ''
        - id: $$cap_secret_key
          label: SECRET_KEY
          description: 'Run this command to generate a key: openssl rand -hex 32'
          defaultValue: c63eaeed7ee7459098e2901ed87c8b70817428b85fbe3ef59cb6a79abb2bbf4a
          validRegex: /^([0-9a-f]){64}$/
        - id: $$cap_utils_secret
          label: UTILS_SECRET
          description: 'Run this command to generate a key: openssl rand -hex 32'
          defaultValue: c9b4d178130f53efc7419eaec9a2e764481269c9602c2ef2e541bdadc63b5bbf
          validRegex: /^([0-9a-f]){64}$/
        - id: $$cap_outline_version
          label: Outline Version
          defaultValue: version-0.41.0
          description: Check out their page for the valid tags https://hub.docker.com/r/outlinewiki/outline/tags
          validRegex: /^([^\s^\/])+$/
    instructions:
        start: Outline is an open, extensible, wiki for your team built using React and Node.js.
        end: >
            IMPORTANT: before you start using Outline, you need to 

             1) Enable HTTPS 
             2) Force HTTPS 
             3) Enable Websocket in $$cap_appname-outline. 
             4) Run database migration `npm run sequelize:migrate` within the $$cap_appname-outline docker container.  

            You can customize more settings by environmental variables described here: https://github.com/outline/outline/blob/0deecfac446c37545e0787b3d32062e608a950ab/.env.sample 

             IMPORTANT: It will take up to 2 minutes for it to be ready. Before that, you might see a 502 error page.
    displayName: Outline
    isOfficial: true
    description: An open, extensible, wiki for your team built using React and Node.js.
    documentation: Taken from https://github.com/outline/outline/blob/master/docker-compose.yml
