tenseleyflow/shithub / c200e65

Browse files

Add MinIO + minio-init services and dev-storage make targets

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
c200e65d527717afd81131fa571239203ea2ec13
Parents
2439dcb
Tree
19f742c

2 changed files

StatusFile+-
M Makefile 17 0
M docker-compose.yml 40 0
Makefilemodified
@@ -84,6 +84,23 @@ dev-db-reset: ## Drop the dev Postgres volume and re-create.
8484
 	docker compose down -v
8585
 	$(MAKE) dev-db
8686
 
87
+dev-storage: ## Bring up MinIO + run minio-init to seed the bucket.
88
+	docker compose up -d minio
89
+	docker compose run --rm minio-init
90
+	@echo "MinIO S3 API: http://127.0.0.1:9000  console: http://127.0.0.1:9001"
91
+	@echo "Credentials: shithub-dev / shithub-dev-secret-please-change"
92
+
93
+dev-storage-down: ## Stop the MinIO container (volume persists).
94
+	docker compose stop minio
95
+
96
+dev-storage-reset: ## Drop the MinIO volume and re-seed.
97
+	docker compose down minio
98
+	docker volume rm -f shithub-miniodata
99
+	$(MAKE) dev-storage
100
+
101
+storage-check: build ## Run shithubd storage check against the configured backend.
102
+	./bin/shithubd storage check
103
+
87104
 migrate-up: ## Apply all pending migrations.
88105
 	./bin/shithubd migrate up
89106
 
docker-compose.ymlmodified
@@ -38,6 +38,46 @@ services:
3838
       - "-c"
3939
       - "max_connections=100"
4040
 
41
+  # S3-compatible object storage. Non-default seed credentials —
42
+  # MinIO's defaults (minioadmin/minioadmin) are insecure even in dev.
43
+  minio:
44
+    image: minio/minio:latest
45
+    container_name: shithub-minio
46
+    restart: unless-stopped
47
+    environment:
48
+      MINIO_ROOT_USER: shithub-dev
49
+      MINIO_ROOT_PASSWORD: shithub-dev-secret-please-change
50
+    ports:
51
+      - "127.0.0.1:9000:9000"  # S3 API
52
+      - "127.0.0.1:9001:9001"  # web console
53
+    volumes:
54
+      - shithub-miniodata:/data
55
+    command: server /data --console-address ":9001"
56
+    healthcheck:
57
+      test: ["CMD", "curl", "-fsS", "http://127.0.0.1:9000/minio/health/live"]
58
+      interval: 5s
59
+      timeout: 3s
60
+      retries: 10
61
+      start_period: 10s
62
+
63
+  # One-shot init: creates the shithub-dev bucket via mc.
64
+  minio-init:
65
+    image: minio/mc:latest
66
+    container_name: shithub-minio-init
67
+    depends_on:
68
+      minio:
69
+        condition: service_healthy
70
+    entrypoint:
71
+      - "/bin/sh"
72
+      - "-c"
73
+      - |
74
+        set -eu
75
+        mc alias set local http://minio:9000 shithub-dev shithub-dev-secret-please-change
76
+        mc mb --ignore-existing local/shithub-dev
77
+        echo "minio-init: bucket shithub-dev ready"
78
+
4179
 volumes:
4280
   shithub-pgdata:
4381
     name: shithub-pgdata
82
+  shithub-miniodata:
83
+    name: shithub-miniodata