drop shared caddy volume — koncad owns its caddyfile copy in /data

This commit is contained in:
Daniel committed 2026-04-06 23:02:27 +02:00
1 parent e2f59d4825
commit a80433c9df
2 files changed
+9 -13

No files matched your search

+5 -10
View File
@@ -1,7 +1,7 @@
<?php <?php
// ─── Config ────────────────────────────────────────────────────────────────── // ─── Config ──────────────────────────────────────────────────────────────────
define('CADDYFILE_PATH', getenv('CADDYFILE_PATH') ?: '/etc/caddy/Caddyfile'); define('CADDY_ADMIN_URL', getenv('CADDY_ADMIN_URL') ?: 'http://localhost:2019');
define('CADDY_ADMIN_URL', getenv('CADDY_ADMIN_URL') ?: 'http://localhost:2019'); define('CADDYFILE_STORE', getenv('CADDYFILE_STORE') ?: '/data/Caddyfile');
// ─── Helpers ───────────────────────────────────────────────────────────────── // ─── Helpers ─────────────────────────────────────────────────────────────────
function parseCaddyfile(string $content): array { function parseCaddyfile(string $content): array {
@@ -102,7 +102,7 @@ if (isset($_GET['action'])) {
exit; exit;
case 'load': case 'load':
$raw = file_exists(CADDYFILE_PATH) ? file_get_contents(CADDYFILE_PATH) : ''; $raw = file_exists(CADDYFILE_STORE) ? file_get_contents(CADDYFILE_STORE) : '';
echo json_encode(['ok' => true, 'data' => parseCaddyfile($raw)]); echo json_encode(['ok' => true, 'data' => parseCaddyfile($raw)]);
exit; exit;
@@ -112,13 +112,8 @@ if (isset($_GET['action'])) {
$cf = buildCaddyfile($input['global'] ?? '', $input['sites'] ?? []); $cf = buildCaddyfile($input['global'] ?? '', $input['sites'] ?? []);
$result = caddyLoad($cf); $result = caddyLoad($cf);
if (!$result['ok']) { echo json_encode($result); exit; } if ($result['ok']) file_put_contents(CADDYFILE_STORE, $cf);
echo json_encode($result);
if (file_put_contents(CADDYFILE_PATH, $cf) === false) {
echo json_encode(['ok' => false, 'error' => 'Config applied but failed to write Caddyfile to disk']);
exit;
}
echo json_encode(['ok' => true]);
exit; exit;
case 'check_upstreams': case 'check_upstreams':
+4 -3
View File
@@ -2,18 +2,19 @@ services:
koncad: koncad:
build: . build: .
user: "1000:1000"
restart: unless-stopped restart: unless-stopped
ports: ports:
- "8080:80" - "8080:80"
volumes: volumes:
# Mount your existing Caddy config directory - koncad_data:/data
- /opt/caddy:/etc/caddy
environment: environment:
CADDY_ADMIN_URL: http://caddy:2019 CADDY_ADMIN_URL: http://caddy:2019
networks: networks:
- caddy-network - caddy-network
volumes:
koncad_data:
networks: networks:
caddy-network: caddy-network:
external: true external: true