Repository navigation
Expand file tree
/
Copy pathdocker-compose.example.yml
More file actions
166 lines (162 loc) · 5.66 KB
/
Copy pathdocker-compose.example.yml
File metadata and controls
166 lines (162 loc) · 5.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# PrintMaster Docker Compose Example
#
# This example demonstrates running PrintMaster server and agent with PostgreSQL.
# Customize the following before deploying to production:
# - DATABASE_URL credentials and connection string
# - Port mappings and expose settings
# - Volume mount paths and persistent storage
# - Resource limits and restart policies
# - Network configuration and isolation
#
# Usage:
# 1. Copy this file: cp docker-compose.example.yml docker-compose.yml
# 2. Create .env file with your configuration (see below)
# 3. Build and start: docker compose up -d --build
# 4. View logs: docker compose logs -f server
# 5. Stop services: docker compose down
# 6. Cleanup volumes: docker compose down -v
#
# Required Environment Variables (.env file):
# ROOT_PATH=/path/to/data
# DB_HOST=printmaster-db
# DB_PORT=5432
# DB_NAME=printmaster
# DB_USER=printmaster
# DB_PASS=<your-secure-password>
# TZ=America/New_York
# BEHIND_PROXY=true
# TRUSTED_PROXIES=nginx
# SMTP_ENABLED=false
# SMTP_HOST=
# SMTP_PORT=
# SMTP_USER=
# SMTP_PASS=
# SMTP_FROM=
# ADMIN_PASSWORD=<your-admin-password>
#
# IMPORTANT: Set ADMIN_PASSWORD before first run!
# The admin password can only be set during initial database creation.
# To reset: stop containers, delete server data volume, restart with new password.
services:
# TimescaleDB (PostgreSQL 18) Database
# Replace credentials and tune performance for production use.
db:
# New deployments use PostgreSQL 18. For existing database volumes, follow
# https://docs.printmaster.work/deployment/database-upgrade/.
image: timescale/timescaledb:latest-pg18
restart: unless-stopped
container_name: ${DB_HOST}
environment:
# IMPORTANT: Change these credentials in production
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASS}
POSTGRES_DB: ${DB_NAME}
volumes:
# PG18 images use /var/lib/postgresql as the data root.
- ${ROOT_PATH}/server/database:/var/lib/postgresql
command: ["postgres", "-c", "shared_preload_libraries=timescaledb"]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- printmaster-net
# PrintMaster Server
# Central hub for multi-agent management and device aggregation.
server:
image: 'ghcr.io/printmaster-org/printmaster-server:latest'
restart: on-failure:5
container_name: printmaster-server
depends_on:
db:
condition: service_healthy
environment:
# User and group IDs for file permissions (optional - defaults to root)
# Set to 99:100 for Unraid (nobody:users) or your preferred UID:GID
PUID: ${PUID:-0}
PGID: ${PGID:-0}
# Database configuration
SERVER_DB_DRIVER: postgres
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASS: ${DB_PASS}
# Timezone setting
TZ: ${TZ}
# Proxy and HTTPS settings
BEHIND_PROXY: ${BEHIND_PROXY}
TRUSTED_PROXIES: ${TRUSTED_PROXIES}
# SMTP settings for email notifications
SMTP_ENABLED: ${SMTP_ENABLED}
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT}
SMTP_USER: ${SMTP_USER}
SMTP_PASS: ${SMTP_PASS}
SMTP_FROM: ${SMTP_FROM}
# Admin user password (set before first run!)
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
# Docker environment flag
DOCKER: "true"
# Auto-join secret for agent registration (change to re-enable auto-join)
INIT_SECRET: ${INIT_SECRET:-}
# Uncomment and adjust additional server settings as needed:
LOG_LEVEL: "info"
# TLS_CERT: "/var/lib/printmaster/server/cert.pem"
# TLS_KEY: "/var/lib/printmaster/server/key.pem"
volumes:
- '${ROOT_PATH}/server/data:/var/lib/printmaster/server:rw'
- '${ROOT_PATH}/server/logs:/var/log/printmaster/server:rw'
# NOTE: Do NOT set 'user:' here - PUID/PGID handles privilege dropping.
# If you must use 'user:', ensure the volume is pre-owned by that UID:GID.
healthcheck:
test: [ "CMD", "/printmaster-server", "--health" ]
interval: 30s
timeout: 5s
retries: 3
networks:
- printmaster-net
- backend
# PrintMaster Agent (Optional)
# Local agent for printer discovery and monitoring. Can be run on separate hosts.
# Comment out if you only need the server.
agent:
image: 'ghcr.io/printmaster-org/printmaster-agent:latest'
restart: on-failure:5
container_name: printmaster-agent
depends_on:
server:
condition: service_healthy
environment:
# User and group IDs for file permissions (optional - defaults to root)
# Set to 99:100 for Unraid (nobody:users) or your preferred UID:GID
PUID: ${PUID:-0}
PGID: ${PGID:-0}
# Server registration
SERVER_URL: "http://printmaster-server:9090"
DOCKER: "true"
# Auto-join secret (must match server INIT_SECRET for auto-registration)
INIT_SECRET: ${INIT_SECRET:-}
# Uncomment and adjust additional agent settings as needed:
# DISCOVERY_RANGE: "192.168.1.0/24"
# AGENT_NAME: "Site-A-Agent"
LOG_LEVEL: "info"
volumes:
- '${ROOT_PATH}/agent/data:/var/lib/printmaster/agent:rw'
# NOTE: Do NOT set 'user:' here - PUID/PGID handles privilege dropping.
# If you must use 'user:', ensure the volume is pre-owned by that UID:GID.
healthcheck:
test: [ "CMD", "/printmaster-agent", "--health" ]
interval: 30s
timeout: 5s
retries: 3
networks:
- printmaster-net
networks:
printmaster-net:
name: printmaster-net
driver: bridge
backend:
name: backend
external: true