From 575520a6b2d183dffe688879bbf22aacef8747b4 Mon Sep 17 00:00:00 2001 From: Stanislaw Glogowski Date: Wed, 2 Apr 2025 12:32:33 +0400 Subject: [PATCH] chore(docker): add support for docker-compose override files --- .gitignore | 6 ++++++ README.md | 16 +++++++++++++++- docker-compose.yaml | 18 ++++++++++++------ src/encrypt-config.ts | 4 +++- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 23340766..659af215 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,9 @@ dont-commit/ # Cursor rules .cursorrules + +# JetBrains IDEs +/.idea + +# Docker +docker-compose.override.yaml diff --git a/README.md b/README.md index f934140b..b9db249f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,21 @@ To commit use `yarn commit`. 1. Install Docker, Docker compose and `ts-node` on your local machine 2. Follow the [First setup instructions](src/config/CONFIG.md#πŸ‘ΆπŸ»-first-setup-instructions) to configure the Bundler before running it. -3. Run `docker compose up` and the server and all of it's dependencies should run in the current terminal session without throwing any errors. +3. (optional) Add `docker-compose.override.yaml` for Apple Silicon compatibility: + ```yaml + services: + bundler: + platform: linux/arm64/v8 + redis: + platform: linux/arm64/v8 + mongo: + # see: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-community-with-docker/#about-this-task + image: mongo:4.4 + platform: linux/arm64/v8 + rabbitmq: + platform: linux/arm64/v8 + ``` +4. Run `docker compose up` and the server and all of it's dependencies should run in the current terminal session without throwing any errors. Other useful commands: diff --git a/docker-compose.yaml b/docker-compose.yaml index aeaa1a85..6eb2afdd 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,7 +9,11 @@ services: container_name: bundler env_file: .env ports: - - "0.0.0.0:3000:3000" + - "3000:3000" + links: + - redis + - mongo + - rabbitmq depends_on: mongo: condition: service_started @@ -35,7 +39,7 @@ services: container_name: redis command: ["redis-server", "--appendonly", "yes"] ports: - - "0.0.0.0:6379:6379" + - "6379:6379" volumes: - redis-data:/data restart: always @@ -46,16 +50,18 @@ services: retries: 5 mongo: + # see: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-community-with-docker/#about-this-task + # image: mongo:4.4 image: mongo:latest container_name: mongo restart: always ports: - - "0.0.0.0:27017:27017" + - "27017:27017" volumes: - mongo-data:/data/db rabbitmq: - image: heidiks/rabbitmq-delayed-message-exchange:3.13.0-management + image: heidiks/rabbitmq-delayed-message-exchange:latest container_name: "rabbitmq" healthcheck: test: rabbitmq-diagnostics -q ping @@ -63,8 +69,8 @@ services: timeout: 20s retries: 5 ports: - - "0.0.0.0:5672:5672" - - "0.0.0.0:15672:15672" + - "5672:5672" + - "15672:15672" volumes: - rabbitmq_log:/var/log/rabbitmq - rabbitmq_data:/var/lib/rabbitmq diff --git a/src/encrypt-config.ts b/src/encrypt-config.ts index bc6a75b9..fe30675d 100644 --- a/src/encrypt-config.ts +++ b/src/encrypt-config.ts @@ -50,5 +50,7 @@ const passphrase = process.env.BUNDLER_CONFIG_PASSPHRASE; if (passphrase !== undefined) { encryptConfig(passphrase); } else { - console.error("CONFIG_PASSPHRASE environment variable is not defined"); + console.error( + "BUNDLER_CONFIG_PASSPHRASE environment variable is not defined", + ); }