tenseleyflow/shithub / 1f5b217

Browse files

Add docker-compose with Postgres 16 + .env.example

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
1f5b21725709df05c25053bac384f388ddb300ee
Parents
f91abba
Tree
f58037b

2 changed files

StatusFile+-
A .env.example 16 0
A docker-compose.yml 43 0
.env.exampleadded
@@ -0,0 +1,16 @@
1
+# shithub environment example. Copy to .env and edit. .env is gitignored.
2
+#
3
+# Variables follow SHITHUB_<area>_<key> naming so they don't collide with
4
+# system env. Nested config keys are joined with double-underscore in env
5
+# (e.g. database.url -> SHITHUB_DATABASE__URL).
6
+
7
+# ----- web -----
8
+SHITHUB_WEB_ADDR=:8080
9
+
10
+# ----- database (S01) -----
11
+# Used by `shithubd web`, `shithubd worker`, `shithubd migrate`, etc.
12
+SHITHUB_DATABASE_URL=postgres://shithub:shithub_dev@127.0.0.1:5432/shithub?sslmode=disable
13
+
14
+# Used only by tests. The dbtest harness creates per-test DBs cloned from a
15
+# template DB rooted under this server.
16
+SHITHUB_TEST_DATABASE_URL=postgres://shithub:shithub_dev@127.0.0.1:5432/postgres?sslmode=disable
docker-compose.ymladded
@@ -0,0 +1,43 @@
1
+# Local development stack. Production is provisioned via Ansible (S37);
2
+# this file is for `make dev-db` and friends.
3
+#
4
+# Services:
5
+#   postgres   — primary database (Postgres 16, S01)
6
+#   minio      — S3-compatible object store (S04)
7
+#   mailhog    — local SMTP catcher (S05)
8
+#
9
+# Each is volume-backed for dev persistence and bound to localhost only.
10
+
11
+name: shithub-dev
12
+
13
+services:
14
+  postgres:
15
+    image: postgres:16
16
+    container_name: shithub-postgres
17
+    restart: unless-stopped
18
+    environment:
19
+      POSTGRES_USER: shithub
20
+      POSTGRES_PASSWORD: shithub_dev
21
+      POSTGRES_DB: shithub
22
+    ports:
23
+      - "127.0.0.1:5432:5432"
24
+    volumes:
25
+      - shithub-pgdata:/var/lib/postgresql/data
26
+    healthcheck:
27
+      test: ["CMD-SHELL", "pg_isready -U shithub -d shithub"]
28
+      interval: 5s
29
+      timeout: 3s
30
+      retries: 10
31
+      start_period: 10s
32
+    command:
33
+      - "postgres"
34
+      - "-c"
35
+      - "shared_preload_libraries=pg_stat_statements"
36
+      - "-c"
37
+      - "log_statement=none"
38
+      - "-c"
39
+      - "max_connections=100"
40
+
41
+volumes:
42
+  shithub-pgdata:
43
+    name: shithub-pgdata