refactor: move docker-compose files to deploy/ directory structure
Reorganize Docker configuration into environment-specific directories: - deploy/dev/: Development with hot reload and source mounting - deploy/test/: Ephemeral testing with branch isolation and dynamic ports - deploy/prod/: Production with resource limits, logging, and restart policy Key improvements in test compose: - Dynamic ports (no fixed 3000/8484) for parallel test runs - Branch-isolated container/network names via TEST_INSTANCE_ID - service_healthy condition instead of service_started - Increased retry counts for stability
This commit is contained in:
3
deploy/dev/.env.example
Normal file
3
deploy/dev/.env.example
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
PORT=3000
|
||||||
|
GRIST_MCP_TOKEN=your-token-here
|
||||||
|
CONFIG_PATH=/app/config.yaml
|
||||||
19
deploy/dev/docker-compose.yml
Normal file
19
deploy/dev/docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Development environment - hot reload, persistent data
|
||||||
|
services:
|
||||||
|
grist-mcp:
|
||||||
|
build:
|
||||||
|
context: ../..
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "${PORT:-3000}:3000"
|
||||||
|
volumes:
|
||||||
|
- ../../src:/app/src:ro
|
||||||
|
- ../../config.yaml:/app/config.yaml:ro
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:3000/health')"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 60s
|
||||||
3
deploy/prod/.env.example
Normal file
3
deploy/prod/.env.example
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
PORT=3000
|
||||||
|
GRIST_MCP_TOKEN=your-production-token
|
||||||
|
CONFIG_PATH=/app/config.yaml
|
||||||
31
deploy/prod/docker-compose.yml
Normal file
31
deploy/prod/docker-compose.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Production environment - resource limits, logging, restart policy
|
||||||
|
services:
|
||||||
|
grist-mcp:
|
||||||
|
build:
|
||||||
|
context: ../..
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "${PORT:-3000}:3000"
|
||||||
|
volumes:
|
||||||
|
- ./config.yaml:/app/config.yaml:ro
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
restart: unless-stopped
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 512M
|
||||||
|
cpus: "1"
|
||||||
|
reservations:
|
||||||
|
memory: 128M
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "50m"
|
||||||
|
max-file: "5"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:3000/health')"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 60s
|
||||||
@@ -1,29 +1,36 @@
|
|||||||
|
# Test environment - ephemeral, branch-isolated
|
||||||
services:
|
services:
|
||||||
grist-mcp:
|
grist-mcp:
|
||||||
build: .
|
build:
|
||||||
|
context: ../..
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: grist-mcp-test-${TEST_INSTANCE_ID:-default}
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000" # Dynamic port
|
||||||
environment:
|
environment:
|
||||||
- CONFIG_PATH=/app/config.yaml
|
- CONFIG_PATH=/app/config.yaml
|
||||||
- GRIST_MCP_TOKEN=test-token
|
- GRIST_MCP_TOKEN=test-token
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
volumes:
|
volumes:
|
||||||
- ./tests/integration/config.test.yaml:/app/config.yaml:ro
|
- ../../tests/integration/config.test.yaml:/app/config.yaml:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
mock-grist:
|
mock-grist:
|
||||||
condition: service_started
|
condition: service_healthy
|
||||||
networks:
|
networks:
|
||||||
- test-net
|
- test-net
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:3000/health')"]
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:3000/health')"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 10
|
||||||
|
start_period: 10s
|
||||||
|
|
||||||
mock-grist:
|
mock-grist:
|
||||||
build: tests/integration/mock_grist
|
build:
|
||||||
|
context: ../../tests/integration/mock_grist
|
||||||
|
container_name: mock-grist-test-${TEST_INSTANCE_ID:-default}
|
||||||
ports:
|
ports:
|
||||||
- "8484:8484"
|
- "8484" # Dynamic port
|
||||||
environment:
|
environment:
|
||||||
- PORT=8484
|
- PORT=8484
|
||||||
networks:
|
networks:
|
||||||
@@ -32,8 +39,10 @@ services:
|
|||||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8484/health')"]
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8484/health')"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 10
|
||||||
|
start_period: 10s
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
test-net:
|
test-net:
|
||||||
|
name: grist-mcp-test-${TEST_INSTANCE_ID:-default}
|
||||||
driver: bridge
|
driver: bridge
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
services:
|
|
||||||
grist-mcp:
|
|
||||||
build: .
|
|
||||||
ports:
|
|
||||||
- "${PORT:-3000}:3000"
|
|
||||||
volumes:
|
|
||||||
- ./config.yaml:/app/config.yaml:ro
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
restart: unless-stopped
|
|
||||||
Reference in New Issue
Block a user