feat: added compose.yaml

This commit is contained in:
2026-08-21 11:39:28 +02:00
parent 99c2988070
commit 8e6e8fa951
8 changed files with 82 additions and 66 deletions
-3
View File
@@ -1,3 +0,0 @@
DTTMR_OTLP_ENDPOINT=172.17.0.1:4317
DTTMR_DATABASE_URL=postgres://postgres:postgres@172.17.0.1:5432/postgres?sslmode=disable&timezone=utc
DTTMR_JWT_SECRET=V*$#Jt9OlYW0gEB6PyUU$qLYbJ^NC7LZ
+17
View File
@@ -0,0 +1,17 @@
# PostgreSQL Config
POSTGRES_USER=dttmr_user
POSTGRES_PASSWORD=super_secret_db_password
POSTGRES_DB=dttmr_db
# App Config
DTTMR_DATABASE_URL=postgres://dttmr_user:super_secret_db_password@postgres:5432/dttmr_db?sslmode=disable&timezone=utc
DTTMR_OTLP_ENDPOINT=otel-collector:4317
DTTMR_ENVIRONMENT=production
DTTMR_JWT_SECRET=super_secret_jwt_key
DTTMR_PORT=8080
# Bootstrap Admin
ADMIN_EMAIL=admin@example.com
ADMIN_USERNAME=admin
ADMIN_PASSWORD=changeme
+2
View File
@@ -10,6 +10,8 @@ RUN go mod download
COPY "./internal" "./internal" COPY "./internal" "./internal"
COPY "./cmd" "./cmd" COPY "./cmd" "./cmd"
COPY "Makefile" "./Makefile" COPY "Makefile" "./Makefile"
# So make can fetch tag and commit
COPY "./.git" "./.git"
RUN make build RUN make build
+48
View File
@@ -0,0 +1,48 @@
services:
postgres:
image: postgres:16-alpine
container_name: dttmr-postgres
restart: unless-stopped
env_file:
- .env
volumes:
- /srv/dttmr-api/postgresql:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
otel-collector:
image: otel/opentelemetry-collector:latest
container_name: dttmr-otel
restart: unless-stopped
command: ["--config=/etc/otelcol/config.yaml"]
volumes:
- ./docker/otel-config.yaml:/etc/otelcol/config.yaml
ports:
- "4317:4317"
bootstrap:
build: .
container_name: dttmr-bootstrap
env_file:
- .env
command: ["bootstrap", "--email=${ADMIN_EMAIL}", "--name=${ADMIN_USERNAME}", "--password=${ADMIN_PASSWORD}"]
depends_on:
postgres:
condition: service_healthy
api:
build: .
container_name: dttmr-api
restart: unless-stopped
env_file:
- .env
ports:
- "8080:8080"
depends_on:
otel-collector:
condition: service_started
bootstrap:
condition: service_completed_successfully
-33
View File
@@ -1,33 +0,0 @@
services:
otel-collector:
image: otel/opentelemetry-collector:latest
command: ["--config=/etc/otel-collector-config.yaml"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "4317:4317"
jaeger:
image: jaegertracing/all-in-one:latest
environment:
- COLLECTOR_OTLP_ENABLED=true
ports:
- "16686:16686"
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
postgres:
image: postgres:latest
volumes:
- ./postgresql-data:/var/lib/postgresql/data
ports:
- "15432:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=dttmr
-23
View File
@@ -1,23 +0,0 @@
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
exporters:
otlp/jaeger:
endpoint: jaeger:4317
tls:
insecure: true
prometheus:
endpoint: 0.0.0.0:8889
service:
pipelines:
traces:
receivers: [otlp]
exporters: [otlp/jaeger]
metrics:
receivers: [otlp]
exporters: [prometheus]
+15
View File
@@ -0,0 +1,15 @@
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
exporters:
debug:
verbosity: basic
service:
pipelines:
traces:
receivers: [otlp]
exporters: [debug]
-7
View File
@@ -1,7 +0,0 @@
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'otel-collector'
static_configs:
- targets: ['otel-collector:8889']