@@ -73,39 +73,60 @@ When you distribute self-hosted software (on-premise), you fly blind. You don't
7373
7474## ⚡ Quick Start (Server)
7575
76- Docker:
76+ ### 1. Create the configuration
7777
78- ``` docker pull ghcr.io/btouchard/shm:latest ```
79-
80- Get the server running in 30 seconds.
81-
82- ### 1. Create a ` compose.yml `
78+ Create a ` compose.yml ` file:
8379
8480``` yaml
85- services :
86- shm :
87- image : ghcr.io/btouchard/shm:latest # (Or build locally)
88- ports :
89- - " 8080:8080"
90- environment :
91- - SHM_DB_DSN=postgres://user:pass@db:5432/shm?sslmode=disable
92- depends_on :
93- - db
81+ name : shm
9482
83+ services :
9584 db :
9685 image : postgres:15-alpine
86+ container_name : shm-db
87+ restart : unless-stopped
9788 environment :
98- POSTGRES_USER : user
99- POSTGRES_PASSWORD : pass
100- POSTGRES_DB : shm
89+ POSTGRES_USER : shm
90+ POSTGRES_PASSWORD : ${DB_PASSWORD:-change-me-in-production}
91+ POSTGRES_DB : metrics
10192 volumes :
102- - shm_data:/var/lib/postgresql/data
93+ - postgres_data:/var/lib/postgresql/data
94+ - ./migrations:/docker-entrypoint-initdb.d
95+ healthcheck :
96+ test : ["CMD-SHELL", "pg_isready -U shm -d metrics"]
97+ interval : 10s
98+ timeout : 5s
99+ retries : 5
100+
101+ app :
102+ image : ghcr.io/btouchard/shm:latest
103+ # Or build from source:
104+ # build:
105+ # context: .
106+ # dockerfile: Dockerfile
107+ container_name : shm-app
108+ restart : unless-stopped
109+ depends_on :
110+ db :
111+ condition : service_healthy
112+ environment :
113+ SHM_DB_DSN : " postgres://shm:${DB_PASSWORD:-change-me-in-production}@db:5432/metrics?sslmode=disable"
114+ PORT : " 8080"
115+ ports :
116+ - " 8080:8080"
103117
104118volumes :
105- shm_data :
119+ postgres_data :
120+ ` ` `
121+
122+ ### 2. Download migrations
123+
124+ ` ` ` bash
125+ mkdir -p migrations
126+ curl -sL https://raw.githubusercontent.com/btouchard/shm/main/migrations/001_init.sql -o migrations/001_init.sql
106127```
107128
108- ### 2. Run it
129+ ### 3. Start the services
109130
110131``` bash
111132docker compose up -d
0 commit comments