devops/quadlets/modules/plane/api/main.tf

182 lines
3.8 KiB
HCL

variable "wait_on" {
type = any
description = "Resources to wait on"
default = true
}
variable "server_ip" {
type = string
}
variable "ssh_private_key_path" {
type = string
}
variable "server_domain" {
type = string
}
# Accept credentials from parent Plane module
variable "db_password" {
type = string
sensitive = true
}
variable "redis_password" {
type = string
sensitive = true
}
variable "rabbitmq_password" {
type = string
sensitive = true
}
variable "minio_access_key" {
type = string
sensitive = true
}
variable "minio_secret_key" {
type = string
sensitive = true
}
variable "secret_key" {
type = string
sensitive = true
}
module "api" {
source = "../../quadlet-app"
wait_on = var.wait_on
server_ip = var.server_ip
ssh_private_key_path = var.ssh_private_key_path
restart_policy = "never"
app_name = "plane-api"
image = "docker.io/makeplane/plane-backend:v1.0.0"
ports = ["3011:8000"]
volumes = [
"/opt/storage/data/plane-api:/var/www/plane:Z"
]
environment = {
# Database settings
DATABASE_URL = "postgresql://plane:${var.db_password}@systemd-postgres:5432/plane"
POSTGRES_USER = "plane"
POSTGRES_PASSWORD = var.db_password
POSTGRES_DB = "plane"
# Redis settings
REDIS_URL = "redis://:${var.redis_password}@systemd-valkey:6379/0"
REDIS_HOST = "systemd-valkey"
REDIS_PORT = "6379"
# RabbitMQ settings
RABBITMQ_URL = "amqp://plane:${var.rabbitmq_password}@systemd-rabbitmq:5672/plane"
RABBITMQ_HOST = "systemd-rabbitmq"
RABBITMQ_PORT = "5672"
RABBITMQ_USER = "plane"
RABBITMQ_PASSWORD = var.rabbitmq_password
RABBITMQ_VHOST = "plane"
# MinIO/S3 settings
AWS_S3_ENDPOINT_URL = "http://systemd-minio:9000"
AWS_ACCESS_KEY_ID = var.minio_access_key
AWS_SECRET_ACCESS_KEY = var.minio_secret_key
AWS_S3_BUCKET_NAME = "plane"
AWS_REGION = "us-east-1"
USE_MINIO = "1"
# Application settings
SECRET_KEY = var.secret_key
DEBUG = "0"
ENVIRONMENT = "production"
# Web settings
WEB_URL = "https://plane.${var.server_domain}/api/"
ADMIN_BASE_URL = "https://plane.${var.server_domain}/god-mode/"
SPACE_BASE_URL = "https://plane.${var.server_domain}/spaces/"
APP_BASE_URL = "https://plane.${var.server_domain}/"
LIVE_BASE_URL = "https://plane.${var.server_domain}/live/"
# File upload settings
FILE_SIZE_LIMIT = "5242880"
# Rate limiting
API_KEY_RATE_LIMIT = "60/minute"
# Workers
GUNICORN_WORKERS=3
# Email settings (optional - can be configured later)
# EMAIL_HOST = ""
# EMAIL_PORT = ""
# EMAIL_HOST_USER = ""
# EMAIL_HOST_PASSWORD = ""
# EMAIL_USE_TLS = "1"
# OpenAI/GPT settings (optional)
# OPENAI_API_KEY = ""
# GPT_ENGINE = "gpt-3.5-turbo"
}
command = ["./bin/docker-entrypoint-api.sh"]
haproxy_services = [
{
name = "plane-api"
domain = "plane.${var.server_domain}/api/"
port = "3011"
host = "127.0.0.1"
tls = false
},
{
name = "plane-auth"
domain = "plane.${var.server_domain}/auth/"
port = "3011"
host = "127.0.0.1"
tls = false
}
]
}
output "app_urls" {
value = module.api.app_urls
}
output "installed" {
value = true
depends_on = [module.api.installed]
}
output "db_password" {
value = var.db_password
sensitive = true
}
output "redis_password" {
value = var.redis_password
sensitive = true
}
output "rabbitmq_password" {
value = var.rabbitmq_password
sensitive = true
}
output "minio_access_key" {
value = var.minio_access_key
sensitive = true
}
output "minio_secret_key" {
value = var.minio_secret_key
sensitive = true
}
output "secret_key" {
value = var.secret_key
sensitive = true
}