From 8855c647fbedf9e087586684452654d7aea384b0 Mon Sep 17 00:00:00 2001 From: "anatoly.shipitz" Date: Thu, 23 Oct 2025 15:38:15 +0200 Subject: [PATCH 1/2] Add local development configuration with docker-compose.local.yml - Introduced a new docker-compose.local.yml file for local development, enabling SSH tunneling for Redmine and MongoDB services. - Updated README.md to include instructions for using the new local development configuration, clarifying the usage of different docker-compose files for various environments. These changes enhance the development workflow by providing a dedicated configuration for local setups. --- README.md | 28 ++++++++++++++++++++++++---- docker-compose.local.yml | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 docker-compose.local.yml diff --git a/README.md b/README.md index a45e707..f38a5f4 100644 --- a/README.md +++ b/README.md @@ -54,18 +54,26 @@ 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: +You can start the services in different ways, depending on your environment: -#### 1. Development +#### 1. Local Development + +Use `docker-compose.local.yml` for local development overrides: + +```bash +docker compose -f docker-compose.yml -f docker-compose.local.yml up -d +``` + +#### 2. Development (Default) ```bash docker compose up -d ``` -#### 2. Production +#### 3. Production ```bash -docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d +docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d ``` ### Building custom images @@ -91,6 +99,7 @@ docker compose ps ``` You should see containers for: + - n8n - temporal - temporal-ui @@ -106,6 +115,7 @@ scripts/check_services.sh ``` This will check: + - n8n health endpoint - Temporal UI web interface - OpenSearch API @@ -113,6 +123,7 @@ This will check: - PostgreSQL database connection Example output: + ```text Checking service availability... Checking n8n at http://localhost:5678/healthz... ACCESSIBLE ✅ (HTTP 200) @@ -158,11 +169,15 @@ docker compose down -v Data for all services is persisted using Docker volumes. The storage location depends on the environment: +- **Local Development (using `docker-compose.local.yml`)**: Local-specific overrides and configurations. Must be explicitly specified with `-f` flag. This file is not automatically loaded. + - **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. - **Production (using `docker-compose.prod.yml`)**: Volumes are explicitly bound to host directories under `/data/` for persistent storage and easier backup/restore. > **Note:** +> +> - `docker-compose.local.yml` is only used when explicitly specified with `-f` flag > - Removing volumes with `docker compose down -v` will delete all persisted data. ## Service Ports @@ -178,6 +193,7 @@ Data for all services is persisted using Docker volumes. The storage location de If you encounter any issues: 1. Check container logs: + ```bash docker logs temporal docker logs automatization-n8n-1 @@ -192,16 +208,19 @@ If you encounter any issues: To use GitHub-related functions with Cursor's Model Context Protocol (MCP), you need to configure a GitHub Personal Access Token: 1. Create the secrets directory if it doesn't exist: + ```bash mkdir -p ~/.cursor/mcp ``` 2. Copy or edit the `.env` file in this directory: + ```bash cp mcp.env.example ~/.cursor/mcp/.env ``` 3. Update your GitHub Personal Access Token to the `~/.cursor/mcp/.env`: + ``` GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here ``` @@ -211,6 +230,7 @@ To use GitHub-related functions with Cursor's Model Context Protocol (MCP), you To get access to a GitHub Personal Access Token: Ask @killev or + 1. Go to GitHub Settings > Developer settings > Personal access tokens 2. Generate a new token with appropriate permissions (repo, workflow, etc.) 3. Copy the token and add it to the `.env` file as shown above diff --git a/docker-compose.local.yml b/docker-compose.local.yml new file mode 100644 index 0000000..5f06d06 --- /dev/null +++ b/docker-compose.local.yml @@ -0,0 +1,38 @@ +services: + redmine-tunnel: + container_name: redmine-tunnel + image: alpine:latest + command: > + sh -c "apk add --no-cache openssh && + ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa ubuntu@staging.forecasting-v2.gluzdov.com -N -L 0.0.0.0:3306:redmine-pr-rds-db-read.c1kaki1qbk4o.us-east-1.rds.amazonaws.com:3306 -L 0.0.0.0:31000:10.4.3.184:31000" + volumes: + - ~/.ssh:/root/.ssh:ro + ports: + - '3306:3306' + networks: + - app-network + environment: + - SSH_KEY=/root/.ssh/id_rsa + + mongo-tunnel: + container_name: mongo-tunnel + image: alpine:latest + command: > + sh -c "apk add --no-cache openssh && + ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa ubuntu@forecasting-v2.gluzdov.com -N -L 0.0.0.0:31000:10.4.3.184:31000" + volumes: + - ~/.ssh:/root/.ssh:ro + ports: + - '31000:31000' + networks: + - app-network + environment: + - SSH_KEY=/root/.ssh/id_rsa + + temporal-worker-main: + env_file: + - .env + extra_hosts: + - 'mongo1:host-gateway' + - 'mongo2:host-gateway' + - 'mongo3:host-gateway' From 8b253f4125f508fbd73fdd53e8469334249ad019 Mon Sep 17 00:00:00 2001 From: "anatoly.shipitz" Date: Thu, 23 Oct 2025 15:45:13 +0200 Subject: [PATCH 2/2] Enhance test reliability with fake timers in index.test.ts - Implemented fake timers using vi.useFakeTimers() to control setTimeout behavior during tests. - Restored real timers and cleared pending timers in afterEach to ensure a clean test environment. These changes improve the reliability of tests by preventing unintended delays and ensuring proper timer management. --- workers/main/src/index.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/workers/main/src/index.test.ts b/workers/main/src/index.test.ts index a42c242..848405d 100644 --- a/workers/main/src/index.test.ts +++ b/workers/main/src/index.test.ts @@ -6,6 +6,8 @@ describe('handleRunError', () => { let processExitSpy: ReturnType; beforeEach(() => { + vi.useFakeTimers(); + // Mock process.exit to prevent actual process termination during tests processExitSpy = vi.spyOn(process, 'exit').mockImplementation(() => { throw new Error('process.exit called'); @@ -14,6 +16,8 @@ describe('handleRunError', () => { afterEach(() => { processExitSpy.mockRestore(); + vi.clearAllTimers(); + vi.useRealTimers(); }); it('should log the error', () => {