From 4c59381f86c150121d5e00ab935ab2277326495d Mon Sep 17 00:00:00 2001 From: "anatoly.shipitz" Date: Mon, 28 Apr 2025 14:19:30 +0200 Subject: [PATCH 1/3] feat(docker): add production compose file, update README, and remove setup_volumes.sh - Introduced a new docker-compose.prod.yml file for production configuration. - Updated README to reflect changes in volume management and service startup instructions. - Removed the setup_volumes.sh script as volume directories are now managed directly in the docker-compose files. --- README.md | 37 ++++++++++++++++--------------------- docker-compose.prod.yml | 19 +++++++++++++++++++ docker-compose.yml | 15 --------------- scripts/setup_volumes.sh | 15 --------------- 4 files changed, 35 insertions(+), 51 deletions(-) create mode 100644 docker-compose.prod.yml delete mode 100755 scripts/setup_volumes.sh diff --git a/README.md b/README.md index 4ced15e..557db24 100644 --- a/README.md +++ b/README.md @@ -22,16 +22,6 @@ This project uses custom Docker images built from the following Dockerfiles: ## Usage -### Prepare volume directories - -Before starting the services, run the setup script to create the necessary volume directories: - -```bash -./scripts/setup_volumes.sh -``` - -This prevents volume mount errors that may occur if the directories don't exist. - ### Create environment file Create a `.env` file in the root directory of the project with your environment variables: @@ -44,11 +34,19 @@ Then edit the `.env` file to set your specific configuration values. ### Starting the services +You can start the services in two ways, depending on your environment: + +#### 1. Development + ```bash docker compose up -d ``` -This will start all services in detached mode. +#### 2. Production + +```bash +docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d +``` ### Building custom images @@ -138,11 +136,14 @@ docker compose down -v ## Data Persistence -All data is stored in local volumes under the `./volumes/` directory: +Data for all services is persisted using Docker volumes. The storage location depends on the environment: + +- **Development (default, using `docker-compose.yml`)**: Docker uses anonymous volumes for each service. These are managed by Docker and are not bound to any directory in your project. Data persists as long as the volume exists, but is not directly accessible from the project folder. -- `./volumes/n8n_data` - n8n data and workflows -- `./volumes/opensearch-data` - OpenSearch data for Temporal -- `./volumes/postgresql-data` - PostgreSQL database for Temporal +- **Production (using `docker-compose.prod.yml`)**: Volumes are explicitly bound to host directories under `/data/` for persistent storage and easier backup/restore. + +> **Note:** +> - Removing volumes with `docker compose down -v` will delete all persisted data. ## Service Ports @@ -166,12 +167,6 @@ If you encounter any issues: 3. Make sure Docker has sufficient resources allocated -4. If you encounter volume mount errors (e.g., "failed to mount local volume ... no such file or directory"), run the setup script: - ```bash - ./scripts/setup_volumes.sh - ``` - This creates the necessary volume directories in the `./volumes/` folder. - ## GitHub MCP Configuration To use GitHub-related functions with Cursor's Machine Coding Protocol (MCP), you need to configure a GitHub Personal Access Token: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..a886b8d --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,19 @@ +volumes: + n8n_data: + driver: local + driver_opts: + type: none + o: bind + device: /data/n8n + opensearch-data: + driver: local + driver_opts: + type: none + o: bind + device: /data/opensearch + postgresql-data: + driver: local + driver_opts: + type: none + o: bind + device: /data/postgresql \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index d3e1cdb..45e9f32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -129,23 +129,8 @@ services: volumes: n8n_data: - driver: local - driver_opts: - type: none - o: bind - device: ${PWD}/volumes/n8n_data opensearch-data: - driver: local - driver_opts: - type: none - o: bind - device: ${PWD}/volumes/opensearch-data postgresql-data: - driver: local - driver_opts: - type: none - o: bind - device: ${PWD}/volumes/postgresql-data networks: app-network: diff --git a/scripts/setup_volumes.sh b/scripts/setup_volumes.sh deleted file mode 100755 index c5c2c84..0000000 --- a/scripts/setup_volumes.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# Create volume directories for Docker Compose -echo "Setting up volume directories..." -mkdir -p volumes/opensearch-data -mkdir -p volumes/postgresql-data -mkdir -p volumes/n8n_data - -# Set broader permissions to ensure Docker can access these directories -echo "Setting permissions for Docker access..." -chmod -R 777 volumes/opensearch-data -chmod -R 777 volumes/postgresql-data -chmod -R 777 volumes/n8n_data - -echo "Volume directories created successfully with Docker-accessible permissions." \ No newline at end of file From fbac4381283fcfee457f8b344f5921cbedb9c8f3 Mon Sep 17 00:00:00 2001 From: "anatoly.shipitz" Date: Mon, 28 Apr 2025 14:35:00 +0200 Subject: [PATCH 2/3] fix(docker): add missing newline at end of docker-compose.prod.yml --- docker-compose.prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index a886b8d..b253a3b 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -16,4 +16,4 @@ volumes: driver_opts: type: none o: bind - device: /data/postgresql \ No newline at end of file + device: /data/postgresql From 2be75ebddcbaf24a33db51ce07d7f702e443cc2e Mon Sep 17 00:00:00 2001 From: "anatoly.shipitz" Date: Mon, 28 Apr 2025 17:49:12 +0200 Subject: [PATCH 3/3] refactor(workflow): remove setup_volumes.sh from code quality workflow - Eliminated the step to create volume directories as it is no longer necessary. - Updated the workflow to streamline the setup process for Docker. --- .github/workflows/code-quality.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index f8559c3..39b5536 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -98,8 +98,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Create volume directories - run: bash scripts/setup_volumes.sh - name: Copy .env file run: cp .env.example .env - name: Set up Docker Buildx