From 0c8d27394aeb4e09ac0061cbf5e1e3a38a766f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kol=C3=A1rik?= Date: Mon, 6 Jan 2025 21:26:31 +0100 Subject: [PATCH] refactor: reorganize config locations --- .github/workflows/ci.yml | 3 ++- .github/workflows/e2e.yml | 3 ++- .gitignore | 1 + config/redis/{docker.env => .env.redis} | 0 config/redis/README.md | 14 +++++++++++-- docker-compose.dev.yml | 14 ++++++------- docker-compose.yml | 26 ++++++++++++------------- 7 files changed, 37 insertions(+), 24 deletions(-) rename config/redis/{docker.env => .env.redis} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93892dc9..0178296c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,8 @@ jobs: node-version: 20.x - name: Set up Redis run: | - docker compose --env-file config/redis/docker.env up -d + cp config/redis/.env.redis ../../ + docker compose --env-file .env.redis up -d - name: Build run: | npm ci diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 0d1cef1e..28c47ed6 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -43,7 +43,8 @@ jobs: docker restart $(docker ps -aq) - name: Set up Redis run: | - docker compose --env-file config/redis/docker.env up -d + cp config/redis/.env.redis ../../ + docker compose --env-file .env.redis up -d - name: Build run: | npm ci diff --git a/.gitignore b/.gitignore index 84c283dd..2d636142 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ probes-stats/all-result.csv probes-stats/all-result.json .eslintcache .env +/.env.redis diff --git a/config/redis/docker.env b/config/redis/.env.redis similarity index 100% rename from config/redis/docker.env rename to config/redis/.env.redis diff --git a/config/redis/README.md b/config/redis/README.md index 057c78da..77cd5cb2 100644 --- a/config/redis/README.md +++ b/config/redis/README.md @@ -12,6 +12,16 @@ swapon /swapfile echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab ``` -## Config +### Docker config -See `docker-compose.yml` in the project root and the config files in this directory. +Assuming you start in this directory: + +``` +cp .env.redis ../../ +``` + +Set the redis password and return to the project root. Then: + +``` +docker compose --env-file .env.redis up -d +``` diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 0f306055..2eceff8d 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -7,7 +7,7 @@ services: - ./config/redis/standalone.conf:/redis-stack.conf - ./data/redis/7001:/data env_file: - - ./config/redis/docker.env + - ./config/redis/.env.redis redis-standalone-2: image: redis/redis-stack-server:7.4.0-v1 ports: @@ -16,7 +16,7 @@ services: - ./config/redis/standalone.conf:/redis-stack.conf - ./data/redis/7002:/data env_file: - - ./config/redis/docker.env + - ./config/redis/.env.redis redis-node-01: image: redis/redis-stack-server:7.4.0-v1 command: [ "bash", "/home/runner/mounted/node.sh", "7101" ] @@ -25,7 +25,7 @@ services: - ./config/redis:/home/runner/mounted - ./data/redis/7101:/data env_file: - - ./config/redis/docker.env + - ./config/redis/.env.redis redis-node-02: image: redis/redis-stack-server:7.4.0-v1 command: [ "bash", "/home/runner/mounted/node.sh", "7102" ] @@ -34,7 +34,7 @@ services: - ./config/redis:/home/runner/mounted - ./data/redis/7102:/data env_file: - - ./config/redis/docker.env + - ./config/redis/.env.redis redis-node-03: image: redis/redis-stack-server:7.4.0-v1 command: [ "bash", "/home/runner/mounted/node.sh", "7103" ] @@ -43,7 +43,7 @@ services: - ./config/redis:/home/runner/mounted - ./data/redis/7103:/data env_file: - - ./config/redis/docker.env + - ./config/redis/.env.redis redis-node-04: image: redis/redis-stack-server:7.4.0-v1 command: [ "bash", "/home/runner/mounted/node.sh", "7104" ] @@ -52,7 +52,7 @@ services: - ./config/redis:/home/runner/mounted - ./data/redis/7104:/data env_file: - - ./config/redis/docker.env + - ./config/redis/.env.redis redis-cluster-creator: image: redis/redis-stack-server:7.4.0-v1 command: redis-cli -a "$REDIS_PASSWORD" --cluster create $REDIS_PUBLIC_IP:7101 $REDIS_PUBLIC_IP:7102 $REDIS_PUBLIC_IP:7103 $REDIS_PUBLIC_IP:7104 --cluster-replicas 0 --cluster-yes @@ -63,7 +63,7 @@ services: - redis-node-03 - redis-node-04 env_file: - - ./config/redis/docker.env + - ./config/redis/.env.redis mariadb: image: mariadb:10.11.5 diff --git a/docker-compose.yml b/docker-compose.yml index 1f0cf19f..1b28acd1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: - ./config/redis/standalone.conf:/redis-stack.conf - /data/redis/7001:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-standalone-2: @@ -18,7 +18,7 @@ services: - ./config/redis/standalone.conf:/redis-stack.conf - /data/redis/7002:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-node-01: @@ -29,7 +29,7 @@ services: - ./config/redis:/home/runner/mounted - /data/redis/7101:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-node-02: @@ -40,7 +40,7 @@ services: - ./config/redis:/home/runner/mounted - /data/redis/7102:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-node-03: @@ -51,7 +51,7 @@ services: - ./config/redis:/home/runner/mounted - /data/redis/7103:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-node-04: @@ -62,7 +62,7 @@ services: - ./config/redis:/home/runner/mounted - /data/redis/7104:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-node-05: @@ -73,7 +73,7 @@ services: - ./config/redis:/home/runner/mounted - /data/redis/7105:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-node-06: @@ -84,7 +84,7 @@ services: - ./config/redis:/home/runner/mounted - /data/redis/7106:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-node-07: @@ -95,7 +95,7 @@ services: - ./config/redis:/home/runner/mounted - /data/redis/7107:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-node-08: @@ -106,7 +106,7 @@ services: - ./config/redis:/home/runner/mounted - /data/redis/7108:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-node-09: @@ -117,7 +117,7 @@ services: - ./config/redis:/home/runner/mounted - /data/redis/7109:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-node-10: @@ -128,7 +128,7 @@ services: - ./config/redis:/home/runner/mounted - /data/redis/7110:/data env_file: - - ./config/redis/docker.env + - ./.env.redis restart: unless-stopped stop_grace_period: 2m redis-cluster-creator: @@ -147,4 +147,4 @@ services: - redis-node-09 - redis-node-10 env_file: - - ./config/redis/docker.env + - ./.env.redis