Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ services:
- PORT=3001
- ADMIN_SECRET_KEY=${ADMIN_SECRET_KEY}
- PROJECT_REGISTRY_CONTRACT_ID=${PROJECT_REGISTRY_CONTRACT_ID}
- REDIS_URL=redis://redis:6379
# Keep the V8 heap ceiling under the container memory limit below (#225).
- NODE_OPTIONS=--max-old-space-size=384
depends_on:
redis:
condition: service_healthy
volumes:
- ./src:/app/src:ro
restart: unless-stopped
Expand All @@ -37,28 +33,3 @@ services:
timeout: 5s
retries: 3
start_period: 10s

redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
restart: unless-stopped
command: ["redis-server", "--maxmemory", "192mb", "--maxmemory-policy", "allkeys-lru"]
deploy:
resources:
limits:
cpus: "0.25"
memory: 256M
reservations:
cpus: "0.1"
memory: 64M
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3

volumes:
redis_data:
17 changes: 0 additions & 17 deletions src/__tests__/container-resources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,6 @@ describe("container resource limits (#225)", () => {
});
});

describe("redis service", () => {
it("declares memory and CPU limits", () => {
const limits = limitsFor("redis");
expect(toBytes(limits.memory!)).toBeGreaterThan(0);
expect(Number(limits.cpus)).toBeGreaterThan(0);
});

it("caps its own memory below the container limit and evicts", () => {
const command = (compose.services.redis.command ?? []).join(" ");
expect(command).toMatch(/--maxmemory\s+\d+mb/);
expect(command).toMatch(/allkeys-lru/);

const maxMemoryMb = Number(/--maxmemory (\d+)mb/.exec(command)![1]);
expect(maxMemoryMb * MB).toBeLessThan(toBytes(limitsFor("redis").memory!));
});
});

describe("documentation", () => {
const docPath = path.join(ROOT, "docs", "DEPLOYMENT.md");

Expand Down