Outline Wiki on AWS

This project is for deploying outline wiki on AWS. It uses various AWS Services.

  • VPC
  • Aurora PostgreSQL
  • Elasticache Redis
  • S3
  • EC2
  • Application Load Balancer
  • Route53
  • Certificate Manager
  • Secrets Manager

Prerequisite

Domain

Private Domain which is registered at Route53

AWS Account

Create AWS Account, then Install AWS CLI and configure it. To install and configure AWS CLI, Refer to AWS CLI Install

EC2 Key Pairs

Go to AWS EC2 console and create EC2 Key Pairs.

Database Credentials

Go to AWS Secrets Manger console and create database credentials.

Secret name should be outline-db

Store a new secret -> Other type of secrets -> Plaintext

Create json like this.

{
  "username": "xxxxx",
  "password": "xxxxx"
}

CDK

This is a CDK project for Python. To install CDK, Refer to CDK Getting Started

direnv

This is a tool that can load and unload environment variables depending on the current directory. To install direnv, Refer to Direnv Installation

Slack App

This project uses slack auth for authentication. To create application at slack, Refer to Create App

When configuring the Client ID, add a redirect URL under "OAuth & Permissions"

ex) https://URL/auth/slack.callback

  • URL : this is the URL registered at Route53
  • Client ID : this is SLACK_KEY in .envrc
  • Client Secret : this is SLACK_SECRET in .envrc

SMTP Sever

AWS SES can be used for SMTP or set other SMTP

Create .envrc

direnv looks up .envrc and apply it's variables on environment

.envrc must have these variables

# AWS Account number
export CDK_ACCOUNT=xxxxxxxxxxxx
# Region where to deploy service
export CDK_REGION=ap-northeast-2
# profile name which is set when configuring AWS CLI
export AWS_PROFILE=default
# Tag for AWS Services
export TAG=xxxxxxx
# Key pair name for EC2
export KEY_PAIR=xxxxxxx
# Private Domain name
export DOMAIN_NAME=xxxx.xxx
# Slack key and secret
export SLACK_KEY=1111111.111111
export SLACK_SECRET=xxxxxxx
# SMTP setting
export SMTP_HOST=xxxxxxx
export SMTP_PORT=xxx
export SMTP_USERNAME=xxxxxxx
export SMTP_PASSWORD=xxxxxxx
export SMTP_FROM_EMAIL=xxxxxxx
export SMTP_REPLY_EMAIL=xxxxxxx

Deploy CDK

$ cd outline_on_aws
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
$ cdk deploy Outline

To deactivate virtual environment

$ deactivate