From 1b5a04393bd54a5b852a8f526a889011dca814af Mon Sep 17 00:00:00 2001 From: Cristen Jones Date: Tue, 6 Aug 2024 16:40:46 -0400 Subject: [PATCH] even simpler docker compose --- .github/workflows/tests-axe.yml | 3 +- deploy/dev-standalone.yml | 117 +++++++------------------------- 2 files changed, 27 insertions(+), 93 deletions(-) diff --git a/.github/workflows/tests-axe.yml b/.github/workflows/tests-axe.yml index dc95a48475..7a386762e2 100644 --- a/.github/workflows/tests-axe.yml +++ b/.github/workflows/tests-axe.yml @@ -41,9 +41,8 @@ jobs: aws-region: us-east-1 mask-aws-account-id: true - run: npm install --ignore-scripts - - run: cp .env.template .env # The docker compose expects an .env file - name: docker compose up - run: docker compose --file deploy/dev-standalone.yml up --build --detach --wait + run: docker compose --file deploy/dev-standalone.yml up --detach --wait - uses: docker://mcr.microsoft.com/playwright:v1.42.1-jammy with: args: npx playwright test axe diff --git a/deploy/dev-standalone.yml b/deploy/dev-standalone.yml index 0cc33ab9d6..705cb0b4db 100644 --- a/deploy/dev-standalone.yml +++ b/deploy/dev-standalone.yml @@ -1,112 +1,47 @@ services: + redis: + network_mode: host + image: grokzen/redis-cluster + container_name: redis + restart: on-failure + ports: + - 30001-30006:30001-30006 + environment: + - INITIAL_PORT=30001 + - REDIS_CLUSTER_IP=0.0.0.0 + - IP=0.0.0.0 + healthcheck: + test: ["CMD", "redis-cli", "-p", "30001", "ping"] + interval: 5s + timeout: 5s + retries: 5 + start_period: 5s dotcom: + network_mode: host + depends_on: + - redis build: context: ../ dockerfile: ./deploy/dotcom/dev/1/Dockerfile - env_file: - - ../.env - depends_on: - redis-cluster-init: - condition: service_started environment: - MIX_ENV=dev + - CMS_API_BASE_URL=https://live-mbta.pantheonsite.io + - OPEN_TRIP_PLANNER_URL=http://otp2-local.mbtace.com - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} - MBTA_API_BASE_URL=${MBTA_API_BASE_URL} - MBTA_API_KEY=${MBTA_API_KEY} - PORT=4001 - - REDIS_HOST=10.0.0.11 - - REDIS_PORT=6379 - WEBPACK_PORT=8092 - WARM_CACHES=false + - REDIS_PORT=30001 expose: - 4001 - ports: - - 4001:4001 - - 8092:8092 healthcheck: test: curl --fail http://localhost:4001/_health || exit 1 - interval: 10s + interval: 15s retries: 5 - start_period: 180s - timeout: 10s + start_period: 100s + timeout: 30s volumes: - ../:/app - networks: - dotcom_network: - ipv4_address: 10.0.0.1 - redis-cluster-init: - image: redis:7.2.4 - command: redis-cli --cluster create 10.0.0.11:6379 10.0.0.12:6379 10.0.0.13:6379 10.0.0.14:6379 10.0.0.15:6379 10.0.0.16:6379 --cluster-replicas 1 --cluster-yes - depends_on: - redis-1: - condition: service_healthy - redis-2: - condition: service_healthy - redis-3: - condition: service_healthy - redis-4: - condition: service_healthy - redis-5: - condition: service_healthy - redis-6: - condition: service_healthy - networks: - dotcom_network: - ipv4_address: 10.0.0.10 - redis-1: &redis - build: - context: ../ - dockerfile: ./deploy/redis/Dockerfile - healthcheck: - test: [ "CMD", "redis-cli", "PING"] - timeout: 10s - interval: 3s - retries: 10 - environment: - - CLUSTER_ANNOUNCE_IP=10.0.0.11 - networks: - dotcom_network: - ipv4_address: 10.0.0.11 - redis-2: - <<: *redis - environment: - - CLUSTER_ANNOUNCE_IP=10.0.0.12 - networks: - dotcom_network: - ipv4_address: 10.0.0.12 - redis-3: - <<: *redis - environment: - - CLUSTER_ANNOUNCE_IP=10.0.0.13 - networks: - dotcom_network: - ipv4_address: 10.0.0.13 - redis-4: - <<: *redis - environment: - - CLUSTER_ANNOUNCE_IP=10.0.0.14 - networks: - dotcom_network: - ipv4_address: 10.0.0.14 - redis-5: - <<: *redis - environment: - - CLUSTER_ANNOUNCE_IP=10.0.0.15 - networks: - dotcom_network: - ipv4_address: 10.0.0.15 - redis-6: - <<: *redis - environment: - - CLUSTER_ANNOUNCE_IP=10.0.0.16 - networks: - dotcom_network: - ipv4_address: 10.0.0.16 -networks: - dotcom_network: - driver: bridge - ipam: - config: - - subnet: 10.0.0.0/24 - gateway: 10.0.0.254