feat: migrate Diary to VPN only access (#36)
continuous-integration/drone/push Build is passing Details

Reviewed-on: #36
Co-authored-by: Davide Polonio <poloniodavide@gmail.com>
Co-committed-by: Davide Polonio <poloniodavide@gmail.com>
master
Davide Polonio 2025-01-12 22:09:22 +01:00 committed by Davide Polonio
parent 6058545dd4
commit 9f128430ba
2 changed files with 63 additions and 12 deletions

5
diary/Caddyfile Normal file
View File

@ -0,0 +1,5 @@
https://diary.lan.poldebra.me {
tls /cert.crt /key.key
reverse_proxy app:80 {
}
}

View File

@ -1,19 +1,43 @@
version: "3.9"
services: services:
mock:
image: nginx:alpine
restart: unless-stopped
env_file:
- .env
networks:
- proxy
reverse_proxy:
image: caddy:alpine
restart: unless-stopped
network_mode: service:tailscale
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- /srv/docker/reverse_proxy/certs/diary.lan.poldebra.me/fullchain.pem:/cert.crt:ro
- /srv/docker/reverse_proxy/certs/diary.lan.poldebra.me/key.pem:/key.key:ro
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "https://diary.lan.poldebra.me"]
interval: 5s
timeout: 10s
retries: 3
depends_on:
app:
condition: service_started
tailscale:
condition: service_healthy
app: app:
image: monica:4-apache image: monica:4-apache
depends_on: depends_on:
- db db:
condition: service_started
tailscale:
condition: service_healthy
env_file: env_file:
- .monica.env - .monica.env
- .env
volumes: volumes:
- data:/var/www/html/storage - data:/var/www/html/storage
restart: unless-stopped restart: unless-stopped
networks:
- internal
- proxy
cron: cron:
image: monica:4-apache image: monica:4-apache
@ -23,7 +47,7 @@ services:
- data:/var/www/html/storage - data:/var/www/html/storage
command: cron.sh command: cron.sh
depends_on: depends_on:
- db - app
db: db:
image: mysql:8.0 image: mysql:8.0
@ -32,8 +56,26 @@ services:
volumes: volumes:
- mysql:/var/lib/mysql - mysql:/var/lib/mysql
restart: unless-stopped restart: unless-stopped
networks:
- internal tailscale:
hostname: diary
image: tailscale/tailscale:latest
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "tailscale status"]
interval: 1s
timeout: 5s
retries: 60
volumes:
- tailscale:/var/lib
- /lib/modules:/lib/modules:ro
devices:
- /dev/net/tun:/dev/net/tun
cap_add:
- net_admin
- sys_module
- net_raw
command: tailscaled
volumes: volumes:
data: data:
@ -48,9 +90,13 @@ volumes:
type: none type: none
o: bind o: bind
device: "/srv/docker/diary/mysql" device: "/srv/docker/diary/mysql"
tailscale:
driver: local
driver_opts:
type: none
o: bind
device: "/srv/docker/diary/tailscale"
networks: networks:
proxy: proxy:
external: true external: true
internal: