Inline NATS config via docker-compose configs

Coolify's compose executor rewrites relative bind mounts to a persistent
app dir with no source file, causing docker to auto-create the mount
target as a directory and fail with "not a directory". Delivering the
config through configs.content instead avoids the rewrite entirely and
lets Docker Compose substitute NATS_USER/NATS_PASSWORD at parse time.
This commit is contained in:
2026-08-25 10:07:05 +00:00
parent f9a999d6bd
commit acd37942e9
3 changed files with 32 additions and 29 deletions
+28 -3
View File
@@ -5,10 +5,10 @@ services:
command: ["-c", "/etc/nats/nats-server.conf"]
environment:
- SERVICE_FQDN_NATS_8080
- NATS_USER=${NATS_USER}
- NATS_PASSWORD=${NATS_PASSWORD}
configs:
- source: nats-conf
target: /etc/nats/nats-server.conf
volumes:
- ./nats-server.conf:/etc/nats/nats-server.conf:ro
- nats-data:/data
expose:
- "4222"
@@ -20,5 +20,30 @@ services:
timeout: 5s
retries: 3
configs:
nats-conf:
content: |
server_name: "nats-volcanic"
port: 4222
http_port: 8222
jetstream {
store_dir: "/data"
max_memory_store: 256MB
max_file_store: 4GB
}
websocket {
port: 8080
no_tls: true
}
authorization {
users = [
{ user: "${NATS_USER}", password: "${NATS_PASSWORD}" }
]
}
volumes:
nats-data: