Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions docker-compose2.0/docker-compose.setup.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
services:
core:
restart: unless-stopped
logging:
driver: journald
options:
tag: "defguard-core"
#journald logging:
#journald driver: journald
#journald options:
#journald tag: "defguard-core"
image: ghcr.io/defguard/defguard:${DEFGUARD_CORE_TAG:?DEFGUARD_CORE_TAG is required}
env_file: .env
environment:
Expand All @@ -21,10 +21,10 @@ services:

edge:
restart: unless-stopped
logging:
driver: journald
options:
tag: "defguard-edge"
#journald logging:
#journald driver: journald
#journald options:
#journald tag: "defguard-edge"
image: ghcr.io/defguard/defguard-proxy:${DEFGUARD_PROXY_TAG:?DEFGUARD_PROXY_TAG is required}
env_file: .env
volumes:
Expand All @@ -36,10 +36,10 @@ services:

gateway:
restart: unless-stopped
logging:
driver: journald
options:
tag: "defguard-gateway"
#journald logging:
#journald driver: journald
#journald options:
#journald tag: "defguard-gateway"
image: ghcr.io/defguard/gateway:${DEFGUARD_GATEWAY_TAG:?DEFGUARD_GATEWAY_TAG is required}
env_file: .env
cap_add:
Expand All @@ -54,10 +54,10 @@ services:

db:
restart: unless-stopped
logging:
driver: journald
options:
tag: "defguard-db"
#journald logging:
#journald driver: journald
#journald options:
#journald tag: "defguard-db"
image: postgres:18-alpine
env_file: .env
volumes:
Expand Down
24 changes: 24 additions & 0 deletions docker-compose2.0/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,29 @@ download_compose_file() {
success "Compose file downloaded."
}

journald_available() {
# Docker Desktop runs the daemon in a VM with no journal, even when the host has one.
[[ "$(docker info --format '{{.OperatingSystem}}' 2>/dev/null)" != *"Docker Desktop"* ]] \
&& [[ -S /run/systemd/journal/socket ]]
}

configure_logging() {
if ! grep -q '#journald ' "$COMPOSE_FILE"; then
return
fi

if ! journald_available; then
warn "journald not available – using Docker's default log driver."
return
fi

local tmp
tmp=$(mktemp)
sed 's/^\([[:space:]]*\)#journald /\1/' "$COMPOSE_FILE" > "$tmp"
mv "$tmp" "$COMPOSE_FILE"
success "journald found – container logs go to the system journal."
}

write_env() {
section "Generating configuration"

Expand Down Expand Up @@ -290,6 +313,7 @@ main() {
check_deps
check_volumes
download_compose_file
configure_logging
write_env
launch
show_wizard_info
Expand Down
Loading