drop shared caddy volume — koncad owns its caddyfile copy in /data
This commit is contained in:
1 parent
e2f59d4825
commit
a80433c9df
2 files changed
+8
-12
No files matched your search
+4
-9
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
// ─── Config ──────────────────────────────────────────────────────────────────
|
||||
define('CADDYFILE_PATH', getenv('CADDYFILE_PATH') ?: '/etc/caddy/Caddyfile');
|
||||
define('CADDY_ADMIN_URL', getenv('CADDY_ADMIN_URL') ?: 'http://localhost:2019');
|
||||
define('CADDYFILE_STORE', getenv('CADDYFILE_STORE') ?: '/data/Caddyfile');
|
||||
|
||||
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
||||
function parseCaddyfile(string $content): array {
|
||||
@@ -102,7 +102,7 @@ if (isset($_GET['action'])) {
|
||||
exit;
|
||||
|
||||
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)]);
|
||||
exit;
|
||||
|
||||
@@ -112,13 +112,8 @@ if (isset($_GET['action'])) {
|
||||
|
||||
$cf = buildCaddyfile($input['global'] ?? '', $input['sites'] ?? []);
|
||||
$result = caddyLoad($cf);
|
||||
if (!$result['ok']) { echo json_encode($result); exit; }
|
||||
|
||||
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]);
|
||||
if ($result['ok']) file_put_contents(CADDYFILE_STORE, $cf);
|
||||
echo json_encode($result);
|
||||
exit;
|
||||
|
||||
case 'check_upstreams':
|
||||
|
||||
+4
-3
@@ -2,18 +2,19 @@ services:
|
||||
|
||||
koncad:
|
||||
build: .
|
||||
user: "1000:1000"
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
# Mount your existing Caddy config directory
|
||||
- /opt/caddy:/etc/caddy
|
||||
- koncad_data:/data
|
||||
environment:
|
||||
CADDY_ADMIN_URL: http://caddy:2019
|
||||
networks:
|
||||
- caddy-network
|
||||
|
||||
volumes:
|
||||
koncad_data:
|
||||
|
||||
networks:
|
||||
caddy-network:
|
||||
external: true
|
||||
Reference in new issue
Block a user