Adds outline wiki
Diff
outline.tf | 10 ++++++++++
variables.tf | 7 +++++++
modules/outline/config.tf | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/outline/data.tf | 7 +++++++
modules/outline/database.tf | 11 +++++++++++
modules/outline/main.tf | 25 +++++++++++++++++++++++++
modules/outline/network.tf | 4 ++++
modules/outline/redis.tf | 22 ++++++++++++++++++++++
modules/outline/variables.tf | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
9 files changed, 198 insertions(+)
@@ -1,0 +1,10 @@
module "outline" {
source = "modules/outline"
smtp_password = "${var.outline_smtp_password}"
secret_key = "${var.outline_secret_key}"
slack_key = "${var.outline_slack_key}"
slack_secret = "${var.outline_slack_secret}"
slack_app_id = "${var.outline_slack_app_id}"
slack_verification_token = "${var.outline_slack_verification_token}"
hostname = "outline.${var.root-domain}"
}
@@ -85,3 +85,10 @@
variable "znc_pass" {}
variable "znc_user" {}
variable "outline_smtp_password" {}
variable "outline_secret_key" {}
variable "outline_slack_key" {}
variable "outline_slack_secret" {}
variable "outline_slack_app_id" {}
variable "outline_slack_verification_token" {}
@@ -1,0 +1,62 @@
resource "random_string" "password" {
length = 16
special = false
}
resource "random_string" "password_test" {
length = 16
special = false
}
locals {
environment = [
"DATABASE_URL=postgres://${var.db_username}:${random_string.password.result}@${var.db_host}:${var.db_port}/${var.db_name}?ssl_mode=disable",
"DATABASE_URL_TEST=postgres://${var.db_username}:${random_string.password_test.result}@${var.db_host}:${var.db_port}/${var.db_name_test}?ssl_mode=disable",
"SECRET_KEY=${var.secret_key}",
"PORT=3000",
"REDIS_URL=redis://${var.cache_host}:${var.cache_port}",
"URL=https://${var.hostname}",
"DEPLOYMENT=self",
"ENABLE_UPDATES=false",
"SUBDOMAINS_ENABLED=false",
"SLACK_KEY=${var.slack_key}",
"SLACK_VERIFICATION_TOKEN=${var.slack_verification_token}",
"SLACK_APP_ID=${var.slack_app_id}",
"SLACK_SECRET=${var.slack_secret}",
"GOOGLE_CLIENT_ID=",
"GOOGLE_CLIENT_SECRET=",
"GOOGLE_ALLOWED_DOMAINS=",
"SMTP_HOST=smtp.mailgun.org",
"SMTP_PORT=465",
"SMTP_USERNAME=${var.smtp_username}",
"SMTP_PASSWORD=${var.smtp_password}",
"SMTP_FROM_EMAIL=${var.smtp_email}",
"SMTP_REPLY_EMAIL=${var.reply_email}",
]
}
@@ -1,0 +1,7 @@
data "docker_registry_image" "redis" {
name = "redis:alpine"
}
data "docker_network" "postgres" {
name = "postgres"
}
@@ -1,0 +1,11 @@
module "database" {
source = "../postgres"
name = "${var.db_name}"
password = "${random_string.password.result}"
}
module "database_test" {
source = "../postgres"
name = "${var.db_name_test}"
password = "${random_string.password_test.result}"
}
@@ -1,0 +1,25 @@
module "container" {
source = "../container"
name = "outline"
image = "captn3m0/outline:alpine"
web {
expose = "true"
host = "${var.hostname}"
port = 3000
}
resource {
memory = 1024
memory_swap = 2048
}
networks = [
"${docker_network.outline.id}",
"${data.docker_network.postgres.id}",
]
env = "${local.environment}"
}
@@ -1,0 +1,4 @@
resource "docker_network" "outline" {
name = "outline"
driver = "bridge"
}
@@ -1,0 +1,22 @@
resource "docker_container" "redis" {
name = "outline-redis"
image = "${docker_image.redis.latest}"
volumes {
host_path = "/mnt/xwing/cache/outline"
container_path = "/data"
}
memory = 128
restart = "unless-stopped"
destroy_grace_seconds = 10
must_run = true
networks = ["${docker_network.outline.id}"]
}
resource "docker_image" "redis" {
name = "${data.docker_registry_image.redis.name}"
pull_triggers = ["${data.docker_registry_image.redis.sha256_digest}"]
keep_locally = true
}
@@ -1,0 +1,50 @@
variable "smtp_username" {
default = "outline@mail.captnemo.in"
}
variable "smtp_password" {}
variable "smtp_email" {
default = "outline@mail.captnemo.in"
}
variable "reply_email" {
default = "outline@captnemo.in"
}
variable "db_host" {
default = "postgres"
}
variable "db_name" {
default = "outline"
}
variable "db_name_test" {
default = "outline-test"
}
variable "db_port" {
default = "5432"
}
variable "db_username" {
default = "outline"
}
variable "cache_port" {
default = "6379"
}
variable "cache_host" {
default = "outline-redis"
}
variable "secret_key" {}
variable "slack_key" {}
variable "slack_secret" {}
variable "slack_app_id" {}
variable "slack_verification_token" {}
variable "hostname" {}