From be234882047828800986f2ae3949f2e3d267677d Mon Sep 17 00:00:00 2001 From: gilesb Date: Wed, 7 Jan 2026 12:04:58 +0000 Subject: [PATCH] feat: Docker support for L2 server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Dockerfile for L2 ActivityPub server - docker-compose.yml for standalone L2 - docker-stack.yml for full swarm deployment (L1+L2+Redis) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- Dockerfile | 19 ++++++++++ docker-compose.yml | 28 +++++++++++++++ docker-stack.yml | 87 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker-stack.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..470d42a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.11-slim + +WORKDIR /app + +# Install dependencies +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy application +COPY . . + +# Create data directory +RUN mkdir -p /data/l2 + +ENV PYTHONUNBUFFERED=1 +ENV ARTDAG_DATA=/data/l2 + +# Default command runs the server +CMD ["python", "server.py"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2723aa2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3.8" + +services: + l2-server: + build: . + image: git.rose-ash.com/art-dag/l2-server:latest + ports: + - "8200:8200" + environment: + - ARTDAG_DOMAIN=artdag.rose-ash.com + - ARTDAG_USER=giles + - ARTDAG_DATA=/data/l2 + - ARTDAG_L1=http://l1-server:8100 + volumes: + - l2_data:/data/l2 + networks: + - artdag + deploy: + replicas: 1 + restart_policy: + condition: on-failure + +volumes: + l2_data: + +networks: + artdag: + external: true diff --git a/docker-stack.yml b/docker-stack.yml new file mode 100644 index 0000000..f8c84df --- /dev/null +++ b/docker-stack.yml @@ -0,0 +1,87 @@ +version: "3.8" + +# Full Art DAG stack for Docker Swarm deployment +# Deploy with: docker stack deploy -c docker-stack.yml artdag + +services: + # Redis for L1 + redis: + image: redis:7-alpine + volumes: + - redis_data:/data + networks: + - artdag + deploy: + replicas: 1 + placement: + constraints: + - node.role == manager + restart_policy: + condition: on-failure + + # L1 Server (API) + l1-server: + image: git.rose-ash.com/art-dag/l1-server:latest + ports: + - "8100:8100" + environment: + - REDIS_URL=redis://redis:6379/5 + - CACHE_DIR=/data/cache + volumes: + - l1_cache:/data/cache + depends_on: + - redis + networks: + - artdag + deploy: + replicas: 1 + restart_policy: + condition: on-failure + + # L1 Worker (Celery) + l1-worker: + image: git.rose-ash.com/art-dag/l1-server:latest + command: celery -A celery_app worker --loglevel=info + environment: + - REDIS_URL=redis://redis:6379/5 + - CACHE_DIR=/data/cache + volumes: + - l1_cache:/data/cache + depends_on: + - redis + networks: + - artdag + deploy: + replicas: 2 + restart_policy: + condition: on-failure + + # L2 Server (ActivityPub) + l2-server: + image: git.rose-ash.com/art-dag/l2-server:latest + ports: + - "8200:8200" + environment: + - ARTDAG_DOMAIN=artdag.rose-ash.com + - ARTDAG_USER=giles + - ARTDAG_DATA=/data/l2 + - ARTDAG_L1=http://l1-server:8100 + volumes: + - l2_data:/data/l2 + depends_on: + - l1-server + networks: + - artdag + deploy: + replicas: 1 + restart_policy: + condition: on-failure + +volumes: + redis_data: + l1_cache: + l2_data: + +networks: + artdag: + driver: overlay