Switching to subdomain list and flatcar "trees" spec.

main
Thomas Hintz 2 weeks ago
parent 052acf4173
commit 221fccc3d1

@ -4,8 +4,8 @@ After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/docker compose -f /home/core/docker-compose.yaml up
ExecStop=/usr/bin/docker compose -f /home/core/docker-compose.yaml stop
ExecStart=/usr/bin/docker compose -f /app/docker-compose.yaml up
ExecStop=/usr/bin/docker compose -f /app/docker-compose.yaml stop
Restart=always
RestartSec=5s

@ -3,7 +3,7 @@ services:
lb:
image: docker.io/caddy:2
volumes:
- /var/lb/caddy:/etc/caddy
- /app/lb:/etc/caddy
# - ./lb/:/etc/caddy
- config:/config
- data:/data
@ -16,16 +16,16 @@ services:
# thintz-com:
# image: docker.io/caddy:2
# volumes:
# #- /var/thintz-com/caddy:/etc/caddy
# #- /app/thintz-com/caddy:/etc/caddy
# - ./thintz-com/:/etc/caddy
# networks:
# - lb
# restart: unless-stopped
# nginx:
# image: nginx
# restart: unless-stopped
# networks:
# - lb
nginx:
image: nginx
restart: unless-stopped
networks:
- lb
wg-easy:
image: ghcr.io/wg-easy/wg-easy:15
environment:

@ -3,5 +3,9 @@ wg-easy.nassella.cc {
# tls internal
# x
log
# log
}
nassella.cc {
reverse_proxy http://nginx:80
}

@ -39,13 +39,16 @@ storage:
- device: /dev/disk/by-label/appstorage
format: ext4
wipe_filesystem: false
trees:
- path: /app
local: app
files:
- path: /var/lb/caddy/Caddyfile
contents:
local: app/lb/Caddyfile
- path: /var/thintz-com/caddy/Caddyfile
contents:
local: app/thintz-com/Caddyfile
# - path: /var/lb/caddy/Caddyfile
# contents:
# local: app/lb/Caddyfile
# - path: /var/thintz-com/caddy/Caddyfile
# contents:
# local: app/thintz-com/Caddyfile
### docker-compose sysext
### https://flatcar.github.io/sysext-bakery/docker_compose/
- path: /opt/extensions/docker-compose/docker-compose-2.34.0-x86-64.raw
@ -58,14 +61,14 @@ storage:
- path: /etc/sysupdate.d/noop.conf
contents:
source: https://extensions.flatcar.org/extensions/noop.conf
- path: /home/core/docker-compose.yaml
mode: 0644
user:
name: core
group:
name: core
contents:
local: app/docker-compose.yaml
# - path: /var/docker-compose.yaml
# mode: 0644
# user:
# name: core
# group:
# name: core
# contents:
# local: app/docker-compose.yaml
links:
- target: /opt/extensions/docker-compose/docker-compose-2.34.0-x86-64.raw
path: /etc/extensions/docker-compose.raw

@ -74,6 +74,11 @@ variable "domain" {
description = "Root domain to use"
}
variable "subdomains" {
type = list
description = "Subdomains to setup"
}
provider "digitalocean" {
token = var.do_token
}
@ -97,15 +102,25 @@ resource "digitalocean_reserved_ip" "machine" {
region = digitalocean_droplet.machine.region
}
resource "cloudflare_dns_record" "machine" {
resource "cloudflare_dns_record" "root" {
zone_id = var.cloudflare_zone_id
name = "wg-easy"
name = "@"
content = digitalocean_reserved_ip.machine.ip_address
type = "A"
proxied = false
ttl = 300
}
resource "cloudflare_dns_record" "subdomains" {
for_each = toset(var.subdomains)
zone_id = var.cloudflare_zone_id
name = each.key
content = var.domain
type = "CNAME"
proxied = false
ttl = 300
}
resource "digitalocean_volume" "machine" {
region = var.datacenter
name = "${var.cluster_name}"
@ -146,6 +161,6 @@ resource "digitalocean_volume_attachment" "machine" {
output "domain-mappings" {
value = {
"wg-easy.${var.domain}" = digitalocean_reserved_ip.machine.ip_address
"${var.domain}" = digitalocean_reserved_ip.machine.ip_address
}
}

@ -1,4 +1,5 @@
domain = ""
subdomains = ["wg-easy"]
do_token = "" # token from "API" settings on DigitalOcean

Loading…
Cancel
Save