Skip to content

Commit a91f5a9

Browse files
committed
Initial commit: DevStack Core v1.3.0 with renamed CLI
0 parents  commit a91f5a9

File tree

449 files changed

+195455
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

449 files changed

+195455
-0
lines changed

.env.example

Lines changed: 362 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,362 @@
1+
# DevStack Core Environment Configuration
2+
# Git Server (Forgejo) + Local Development Services
3+
#
4+
# Copy this file to .env and fill in the values
5+
# DO NOT commit .env to version control
6+
7+
# ===========================================================================
8+
# HashiCorp Vault Configuration (Secrets Management & PKI)
9+
# ===========================================================================
10+
# Vault manages all service credentials and TLS certificates
11+
#
12+
# SETUP INSTRUCTIONS:
13+
# 1. Start services: ./devstack.sh start
14+
# 2. Vault auto-initializes and unseals
15+
# 3. Bootstrap PKI: ./devstack.sh vault-bootstrap
16+
# 4. Token saved to: ~/.config/vault/root-token
17+
#
18+
# After initial setup, set VAULT_TOKEN here for automatic integration
19+
20+
VAULT_ADDR=http://vault:8200
21+
VAULT_TOKEN=
22+
23+
# IMPORTANT: After running vault-init, copy the root token here:
24+
# VAULT_TOKEN=hvs.xxxxxxxxxxxxxxxxxxxxx
25+
#
26+
# Or leave empty and it will be read from ~/.config/vault/root-token
27+
28+
# ===========================================================================
29+
# Docker Network IP Addresses (172.20.0.0/16)
30+
# ===========================================================================
31+
# Static IP addresses for services in the dev-services network
32+
# Change these if you need custom IP assignments or have conflicts
33+
#
34+
# Default assignments:
35+
POSTGRES_IP=172.20.0.10
36+
PGBOUNCER_IP=172.20.0.11
37+
MYSQL_IP=172.20.0.12
38+
REDIS_1_IP=172.20.0.13
39+
RABBITMQ_IP=172.20.0.14
40+
MONGODB_IP=172.20.0.15
41+
REDIS_2_IP=172.20.0.16
42+
REDIS_3_IP=172.20.0.17
43+
FORGEJO_IP=172.20.0.20
44+
VAULT_IP=172.20.0.21
45+
REFERENCE_API_IP=172.20.0.100
46+
PROMETHEUS_IP=172.20.0.101
47+
GRAFANA_IP=172.20.0.102
48+
LOKI_IP=172.20.0.103
49+
50+
# ===========================================================================
51+
# TLS Configuration (Enabled by Default)
52+
# ===========================================================================
53+
# All services configured to accept BOTH encrypted and unencrypted connections
54+
# Certificates automatically generated by Vault PKI
55+
#
56+
# Set to 'true' to enable TLS for specific services:
57+
58+
POSTGRES_ENABLE_TLS=true
59+
MYSQL_ENABLE_TLS=true
60+
REDIS_ENABLE_TLS=true
61+
RABBITMQ_ENABLE_TLS=true
62+
MONGODB_ENABLE_TLS=true
63+
FORGEJO_ENABLE_TLS=true
64+
65+
# ===========================================================================
66+
# PostgreSQL Configuration (MIGRATED TO VAULT)
67+
# ===========================================================================
68+
# PostgreSQL credentials are now managed by Vault
69+
#
70+
# Credentials stored at: secret/data/postgres
71+
# - user: dev_admin
72+
# - password: <auto-generated by vault-bootstrap>
73+
# - database: dev_database
74+
#
75+
# To retrieve password:
76+
# vault kv get -field=password secret/postgres
77+
#
78+
# NOTE: POSTGRES_USER and POSTGRES_DB are still defined below (used for healthchecks
79+
# and Vault bootstrap), but POSTGRES_PASSWORD is intentionally empty and loaded from
80+
# Vault at runtime. These variables serve as service identifiers, not credentials.
81+
82+
# PostgreSQL User Configuration (used by healthchecks and Vault bootstrap)
83+
POSTGRES_USER=dev_admin
84+
POSTGRES_DB=dev_database
85+
# PostgreSQL Password (loaded from Vault at runtime by manage-colima.sh)
86+
# Empty default to suppress docker-compose warnings (actual password loaded from Vault)
87+
# DO NOT set a password here - it will be loaded from Vault automatically
88+
POSTGRES_PASSWORD=
89+
90+
# PostgreSQL Port Configuration
91+
POSTGRES_HOST_PORT=5432
92+
PGBOUNCER_HOST_PORT=6432
93+
94+
# PostgreSQL Performance Tuning
95+
POSTGRES_MAX_CONNECTIONS=100
96+
POSTGRES_SHARED_BUFFERS=256MB
97+
POSTGRES_EFFECTIVE_CACHE_SIZE=1GB
98+
POSTGRES_WORK_MEM=8MB
99+
100+
# PostgreSQL Healthcheck Configuration
101+
POSTGRES_HEALTH_INTERVAL=60s
102+
POSTGRES_HEALTH_TIMEOUT=5s
103+
POSTGRES_HEALTH_RETRIES=5
104+
POSTGRES_HEALTH_START_PERIOD=30s
105+
106+
# ===========================================================================
107+
# MySQL Configuration (MIGRATED TO VAULT)
108+
# ===========================================================================
109+
# MySQL credentials are now managed by Vault
110+
#
111+
# Credentials stored at: secret/data/mysql
112+
# - root_password: <auto-generated by vault-bootstrap>
113+
# - user: dev_admin
114+
# - password: <auto-generated by vault-bootstrap>
115+
# - database: dev_database
116+
#
117+
# To retrieve password:
118+
# vault kv get -field=password secret/mysql
119+
# vault kv get -field=root_password secret/mysql
120+
121+
# MySQL User Configuration (used by healthchecks and Vault bootstrap)
122+
MYSQL_USER=dev_admin
123+
MYSQL_DATABASE=dev_database
124+
125+
# MySQL Port Configuration
126+
MYSQL_HOST_PORT=3306
127+
128+
# MySQL Performance Tuning
129+
MYSQL_MAX_CONNECTIONS=100
130+
MYSQL_INNODB_BUFFER_POOL=256M
131+
132+
# MySQL Healthcheck Configuration
133+
MYSQL_HEALTH_INTERVAL=60s
134+
MYSQL_HEALTH_TIMEOUT=5s
135+
MYSQL_HEALTH_RETRIES=5
136+
137+
# ===========================================================================
138+
# Redis Configuration (MIGRATED TO VAULT)
139+
# ===========================================================================
140+
# Redis credentials are now managed by Vault
141+
#
142+
# Credentials stored at: secret/data/redis-1 (shared across all nodes)
143+
# - password: <auto-generated by vault-bootstrap>
144+
#
145+
# To retrieve password:
146+
# vault kv get -field=password secret/redis-1
147+
148+
# Redis Port Configuration (3-node cluster)
149+
REDIS_1_HOST_PORT=6379
150+
REDIS_1_CLUSTER_PORT=16379
151+
REDIS_2_HOST_PORT=6380
152+
REDIS_2_CLUSTER_PORT=16380
153+
REDIS_3_HOST_PORT=6381
154+
REDIS_3_CLUSTER_PORT=16381
155+
156+
# Redis Performance Tuning
157+
REDIS_MAXMEMORY=256mb
158+
159+
# Redis Healthcheck Configuration
160+
REDIS_HEALTH_INTERVAL=60s
161+
REDIS_HEALTH_TIMEOUT=5s
162+
REDIS_HEALTH_RETRIES=5
163+
164+
# Redis TLS Configuration
165+
# When REDIS_ENABLE_TLS=true, Redis runs in dual-mode accepting connections on:
166+
#
167+
# Host Port Mappings:
168+
# Non-TLS (plain TCP):
169+
# - localhost:6379 → redis-1:6379 (standard port)
170+
# - localhost:6380 → redis-2:6379 (standard port)
171+
# - localhost:6381 → redis-3:6379 (standard port)
172+
#
173+
# TLS (encrypted):
174+
# - localhost:6390 → redis-1:6380 (TLS port)
175+
# - localhost:6391 → redis-2:6380 (TLS port)
176+
# - localhost:6392 → redis-3:6380 (TLS port)
177+
#
178+
# Note: REDIS_ENABLE_TLS is already set in the main TLS Configuration section above
179+
# Certificates are pre-generated using: VAULT_ADDR=http://localhost:8200 VAULT_TOKEN=<token> ./scripts/generate-certificates.sh
180+
# Certificate locations: ~/.config/vault/certs/redis-{1,2,3}/
181+
#
182+
# TLS port mappings (when REDIS_ENABLE_TLS=true):
183+
REDIS_1_TLS_PORT=6390
184+
REDIS_2_TLS_PORT=6391
185+
REDIS_3_TLS_PORT=6392
186+
187+
# ===========================================================================
188+
# RabbitMQ Configuration (MIGRATED TO VAULT)
189+
# ===========================================================================
190+
# RabbitMQ credentials are now managed by Vault
191+
#
192+
# Credentials stored at: secret/data/rabbitmq
193+
# - user: dev_admin
194+
# - password: <auto-generated by vault-bootstrap>
195+
# - vhost: dev_vhost
196+
#
197+
# To retrieve password:
198+
# vault kv get -field=password secret/rabbitmq
199+
200+
# RabbitMQ Configuration
201+
RABBITMQ_VHOST=dev_vhost
202+
203+
# RabbitMQ Port Configuration
204+
RABBITMQ_AMQP_PORT=5672
205+
RABBITMQ_MGMT_PORT=15672
206+
207+
# RabbitMQ Healthcheck Configuration
208+
RABBITMQ_HEALTH_INTERVAL=60s
209+
RABBITMQ_HEALTH_TIMEOUT=10s
210+
RABBITMQ_HEALTH_RETRIES=5
211+
212+
# ===========================================================================
213+
# MongoDB Configuration (MIGRATED TO VAULT)
214+
# ===========================================================================
215+
# MongoDB credentials are now managed by Vault
216+
#
217+
# Credentials stored at: secret/data/mongodb
218+
# - user: dev_admin
219+
# - password: <auto-generated by vault-bootstrap>
220+
# - database: dev_database
221+
#
222+
# To retrieve password:
223+
# vault kv get -field=password secret/mongodb
224+
#
225+
# NOTE: MONGODB_USER and MONGODB_DATABASE are still defined below (used for healthchecks
226+
# and Vault bootstrap). The password is fetched from Vault at container startup.
227+
# These variables serve as service identifiers, not credentials.
228+
229+
# MongoDB User Configuration (used by healthchecks and Vault bootstrap)
230+
MONGODB_USER=dev_admin
231+
MONGODB_DATABASE=dev_database
232+
233+
# MongoDB Port Configuration
234+
MONGODB_HOST_PORT=27017
235+
236+
# MongoDB Healthcheck Configuration
237+
MONGODB_HEALTH_INTERVAL=60s
238+
MONGODB_HEALTH_TIMEOUT=5s
239+
MONGODB_HEALTH_RETRIES=5
240+
241+
# ===========================================================================
242+
# Reference API (FastAPI) - Integration Testing & Examples
243+
# ===========================================================================
244+
# FastAPI reference application demonstrating infrastructure integration patterns
245+
# NOT production code - use as reference for implementing similar patterns
246+
#
247+
# Features:
248+
# - Health checks for all infrastructure services
249+
# - Vault integration examples
250+
# - Database connectivity examples (PostgreSQL, MySQL, MongoDB)
251+
# - Redis caching examples
252+
# - RabbitMQ messaging examples
253+
# - HTTPS/TLS support with Vault-managed certificates
254+
#
255+
# Access (HTTP):
256+
# - API Docs: http://localhost:8000/docs
257+
# - OpenAPI: http://localhost:8000/openapi.json
258+
# - Health: http://localhost:8000/health/all
259+
#
260+
# Access (HTTPS - when TLS enabled):
261+
# - API Docs: https://localhost:8443/docs
262+
# - OpenAPI: https://localhost:8443/openapi.json
263+
# - Health: https://localhost:8443/health/all
264+
265+
REFERENCE_API_HTTP_PORT=8000
266+
REFERENCE_API_HTTPS_PORT=8443
267+
REFERENCE_API_ENABLE_TLS=true
268+
269+
# ===========================================================================
270+
# Observability Stack (Prometheus, Grafana, Loki)
271+
# ===========================================================================
272+
# Prometheus: Metrics collection and time-series database
273+
# Grafana: Visualization and dashboarding
274+
# Loki: Log aggregation (API-only, query via Grafana)
275+
#
276+
# Access:
277+
# - Prometheus: http://localhost:9090
278+
# - Grafana: http://localhost:3001 (default: admin/admin)
279+
# - Loki: API-only service (use Grafana Explore at http://localhost:3001/explore)
280+
#
281+
# Grafana Configuration:
282+
GRAFANA_ADMIN_USER=admin
283+
GRAFANA_ADMIN_PASSWORD=
284+
# IMPORTANT: Set a strong password! Default 'admin' is a security risk.
285+
# After first start, Grafana will prompt you to change the password.
286+
287+
# Port Configuration:
288+
PROMETHEUS_PORT=9090
289+
GRAFANA_PORT=3001
290+
LOKI_PORT=3100
291+
292+
# ===========================================================================
293+
# Forgejo Configuration (Git Server)
294+
# ===========================================================================
295+
FORGEJO_DOMAIN=localhost
296+
# For network access from UTM VMs, use: FORGEJO_DOMAIN=<COLIMA_IP>
297+
298+
# ===========================================================================
299+
# HashiCorp Vault Configuration (Secrets Management)
300+
# ===========================================================================
301+
# Vault uses file storage backend (not dev mode)
302+
# Unseal keys and root token are stored in ~/.config/vault/
303+
#
304+
# IMPORTANT:
305+
# - Vault will be automatically initialized on first start
306+
# - Unseal keys saved to: ~/.config/vault/keys.json
307+
# - Root token saved to: ~/.config/vault/root-token
308+
# - BACKUP these files - they cannot be recovered if lost!
309+
#
310+
# Access Vault:
311+
# - UI: http://localhost:8200/ui
312+
# - CLI: export VAULT_ADDR=http://localhost:8200
313+
# export VAULT_TOKEN=$(cat ~/.config/vault/root-token)
314+
#
315+
# Management:
316+
# - Initialize: ./manage-colima.sh vault-init
317+
# - Unseal: ./manage-colima.sh vault-unseal
318+
# - Status: ./manage-colima.sh vault-status
319+
# - Get token: ./manage-colima.sh vault-token
320+
321+
# ===========================================================================
322+
# NOTES
323+
# ===========================================================================
324+
#
325+
# 1. Get Colima IP address:
326+
# colima list | grep default | awk '{print $NF}'
327+
#
328+
# 2. Access services from Mac:
329+
# - Forgejo: http://localhost:3000
330+
# - Vault UI: http://localhost:8200/ui
331+
# - PostgreSQL: localhost:5432
332+
# - Redis: localhost:6379
333+
# - RabbitMQ UI: http://localhost:15672
334+
# - MongoDB: localhost:27017
335+
# - Reference API: http://localhost:8000/docs (HTTPS: https://localhost:8443/docs)
336+
# - Prometheus: http://localhost:9090
337+
# - Grafana: http://localhost:3001
338+
# - Loki: API-only (query via Grafana Explore)
339+
#
340+
# 3. Access from UTM VM (for development):
341+
# Replace 'localhost' with Colima IP (e.g., 192.168.106.2)
342+
#
343+
# 4. Vault-Managed Secrets (All Services Migrated):
344+
# - All database services now use Vault for credential management
345+
# - Services: PostgreSQL, MySQL, Redis, RabbitMQ, MongoDB
346+
# - Retrieve any password: vault kv get -field=password secret/<service>
347+
# - List all secrets: vault kv list secret/
348+
# - Example services: postgres, mysql, redis-1, rabbitmq, mongodb
349+
#
350+
# 5. TLS Certificates:
351+
# - CA certificates exported to: ~/.config/vault/ca/
352+
# - Trust CA on macOS: sudo security add-trusted-cert -d -r trustRoot \
353+
# -k /Library/Keychains/System.keychain \
354+
# ~/.config/vault/ca/ca-chain.pem
355+
# - PostgreSQL with TLS: psql "postgresql://dev_admin@localhost:5432/dev_database?sslmode=verify-ca&sslrootcert=~/.config/vault/ca/ca-chain.pem"
356+
#
357+
# 6. Security:
358+
# - Vault root token is highly sensitive - treat like master password
359+
# - Backup ~/.config/vault/ directory securely
360+
# - Use strong, unique passwords for each service
361+
# - Different from UTM VM passwords
362+
# - Store securely (e.g., password manager)

0 commit comments

Comments
 (0)