From c1e2e229f99c07114769eac2523354c43ec8a5e2 Mon Sep 17 00:00:00 2001 From: Ryan Parman Date: Thu, 9 Jan 2025 10:31:36 -0700 Subject: [PATCH] fix: Add initial support for scaling the Lambda runtime. --- .hadolint.yml | 4 ++++ localdev/compose.yml | 48 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/.hadolint.yml b/.hadolint.yml index f9f7dc2..1b4c544 100644 --- a/.hadolint.yml +++ b/.hadolint.yml @@ -1,4 +1,8 @@ ignored: + # Specify version with `dnf install -y -`. + # This is for local development only. It's fine. + - DL3041 + # "Multiple consecutive `RUN` instructions. Consider consolidation." # We've learned to love the layer cache. Considered and disregarded. - DL3059 diff --git a/localdev/compose.yml b/localdev/compose.yml index a94194b..b75afcf 100644 --- a/localdev/compose.yml +++ b/localdev/compose.yml @@ -2,7 +2,7 @@ services: lambda: # Name of the container when it is running. - container_name: localdev-lambda + # container_name: localdev-lambda # Instructions which tell BuildKit how to build the image, passing secrets # SECURELY to the Dockerfile. @@ -14,6 +14,10 @@ services: depends_on: - cache + - traefik + + # Run multiple copies of this container. + scale: 1 # Set shared memory limit when using `docker compose`. shm_size: 128mb @@ -61,6 +65,48 @@ services: extra_hosts: - host.docker.internal:host-gateway + labels: + - "traefik.http.routers.lambda.rule=Host(`lambda.docker.localhost`)" + + traefik: + # Name of the container when it is running. + container_name: localdev-traefik + + # Instructions which tell BuildKit how to build the image, passing secrets + # SECURELY to the Dockerfile. + image: traefik:3 + + # Enables the web UI and tells Traefik to listen to docker + command: + #- "--log.level=DEBUG" + - "--api.insecure=true" + - "--providers.docker=true" + - "--providers.docker.exposedbydefault=false" + - "--entryPoints.web.address=:8081" + + # Set shared memory limit when using `docker compose`. + shm_size: 512mb + + # Stay running. Restart on failure. + restart: always + + # Basic Linux-y and permission stuff. + privileged: true + pid: host + sysctls: + net.core.somaxconn: 1024 + + # Connect persistent volumes to the container. + volumes: + # So that Traefik can listen to the Docker events + - "/var/run/docker.sock:/var/run/docker.sock:ro" + + # Inside, the container runs on port 808x. We want to expose the same port + # number on the host. + ports: + - 8081:8081 + - 8082:8080 # Traefik's web UI, enabled by --api + cache: # Name of the container when it is running. container_name: localdev-valkey