-
Notifications
You must be signed in to change notification settings - Fork 1
Add Docker setup and CI pipeline for n8n and Temporal workflow automa… #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e0eaa96
Add Docker setup and CI pipeline for n8n and Temporal workflow automa…
killev a33801e
Pin n8n Docker image to version 1.22.0 for improved stability.
killev 4b7a21e
Fix n8n healthcheck to use N8N_PORT environment variable instead of h…
killev e9990be
Update Docker volume configurations to use named volumes
killev 43c47a4
Improve Docker security and introduce service health checks
killev 04932c7
Add service availability check to CI workflow
killev 289c899
Update Docker Buildx action from v2 to v3 in CI workflow
killev 47461d0
Update HEALTHCHECK format to use exec form in Docker configurations
killev 44ae932
Add Docker volume setup script for CI service testing
killev b64c345
Improve CI pipeline with timeout and cleanup enhancements
killev c80b677
Update Temporal and n8n configurations with latest versions and envir…
killev 88e1414
Improve Docker configuration with parameterized builds and better hea…
killev 4d2dbc8
Refactor Docker configuration to use environment variables from .env …
killev 02169cb
Add environment file copy step to GitHub workflow
killev 737eb62
Add N8N_PORT build argument to Dockerfile
killev ce49d6e
Update README.md with improved documentation formatting
killev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # PostgreSQL Configuration | ||
| POSTGRES_USER=temporal | ||
| POSTGRES_PASSWORD=temporal | ||
| POSTGRES_DB=temporal | ||
| POSTGRES_PORT=5432 | ||
|
|
||
| # n8n Configuration | ||
| N8N_WEBHOOK_URL=http://localhost:5678/ | ||
| N8N_ENCRYPTION_KEY=a_random_string_for_encryption | ||
| N8N_PORT=5678 | ||
|
|
||
| # OpenSearch Configuration | ||
| DISABLE_SECURITY_PLUGIN=true | ||
| OPENSEARCH_PORT=9200 | ||
|
|
||
| # Temporal Configuration | ||
| TEMPORAL_PORT=7233 | ||
| TEMPORAL_UI_PORT=8080 | ||
|
|
||
| # Volumes path (you can customize if needed) | ||
| PWD=. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| FROM n8nio/n8n:1.89.2 | ||
|
|
||
| # Define build arguments | ||
| ARG NODE_ENV=production | ||
| ARG N8N_PORT=5678 | ||
| # Environment variables are now defined in docker-compose.yml | ||
|
|
||
| # Create app directory | ||
| WORKDIR /home/node | ||
|
|
||
| # Add custom healthcheck using exec form | ||
| HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=30s \ | ||
| CMD ["/bin/sh", "-c", "wget -q --spider http://0.0.0.0:${N8N_PORT}/healthz || exit 1"] | ||
|
|
||
| # Explicitly set the user to the non-root 'node' user (which is already set up in the base image) | ||
| USER node | ||
|
|
||
| EXPOSE ${N8N_PORT} | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # The entrypoint script is already defined in the base image | ||
| # Don't override the CMD | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| FROM temporalio/auto-setup:1.20.5 | ||
|
|
||
| # Build arguments are still needed for the temporal container setup | ||
| # Keeping only those used in the HEALTHCHECK or other commands | ||
| ARG HOST=temporal | ||
| ARG TEMPORAL_PORT=7233 | ||
|
|
||
| # Environment variables are now defined in docker-compose.yml | ||
|
|
||
| # Add custom healthcheck using exec form | ||
| HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ | ||
| CMD ["/bin/sh", "-c", "temporal operator cluster health --address ${HOST}:${TEMPORAL_PORT} | grep -q SERVING || exit 1"] | ||
|
|
||
| # Explicitly set the user to the non-root 'temporal' user (already defined in the base image) | ||
| USER temporal | ||
|
|
||
| # Expose the gRPC port | ||
| EXPOSE ${TEMPORAL_PORT} | ||
|
|
||
| # The entrypoint script is already defined in the base image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,173 @@ | ||
| # automatization | ||
| # n8n and Temporal Docker Compose Setup | ||
|
|
||
| This repository contains a Docker Compose configuration to run n8n and Temporal services together. | ||
|
|
||
| ## Services | ||
|
|
||
| The setup includes: | ||
|
|
||
| - **n8n**: An automation tool that allows you to create workflows visually | ||
| - **Temporal**: A workflow orchestration platform with the following components: | ||
| - Temporal server | ||
| - Temporal UI | ||
| - PostgreSQL (database) | ||
| - OpenSearch (for visibility features) | ||
|
|
||
| ## Custom Docker Images | ||
|
|
||
| This project uses custom Docker images built from the following Dockerfiles: | ||
|
|
||
| - **Dockerfile.n8n**: Extends the official n8n image with custom configurations | ||
| - **Dockerfile.temporal**: Extends the official Temporal auto-setup image | ||
|
|
||
| ## 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: | ||
|
|
||
| ```bash | ||
| cp .env.example .env | ||
| ``` | ||
|
|
||
| Then edit the `.env` file to set your specific configuration values. | ||
|
|
||
| ### Starting the services | ||
|
|
||
| ```bash | ||
| docker compose up -d | ||
| ``` | ||
|
|
||
| This will start all services in detached mode. | ||
|
|
||
| ### Building custom images | ||
|
|
||
| Rebuild images after modifying the Dockerfiles: | ||
|
|
||
| ```bash | ||
| docker compose build | ||
| ``` | ||
|
|
||
| Or to rebuild and start in one command: | ||
|
|
||
| ```bash | ||
| docker compose down && docker compose build && docker compose up -d | ||
| ``` | ||
|
|
||
| ### Verifying services are running | ||
|
|
||
| Check that all containers are running: | ||
|
|
||
| ```bash | ||
| docker compose ps | ||
| ``` | ||
|
|
||
| You should see containers for: | ||
| - n8n | ||
| - temporal | ||
| - temporal-ui | ||
| - temporal-postgresql | ||
| - opensearch | ||
|
|
||
| ### Checking Service Health | ||
|
|
||
| Use the provided script to verify that all services are accessible: | ||
|
|
||
| ```bash | ||
| scripts/check_services.sh | ||
| ``` | ||
|
|
||
| This will check: | ||
| - n8n health endpoint | ||
| - Temporal UI web interface | ||
| - OpenSearch API | ||
| - Temporal server gRPC port | ||
| - PostgreSQL database connection | ||
|
|
||
| Example output: | ||
| ```text | ||
| Checking service availability... | ||
| Checking n8n at http://localhost:5678/healthz... ACCESSIBLE ✅ (HTTP 200) | ||
| Checking temporal-ui at http://localhost:8080... ACCESSIBLE ✅ (HTTP 200) | ||
| Checking opensearch at http://localhost:9200... ACCESSIBLE ✅ (HTTP 200) | ||
| Checking temporal at localhost:7233... ACCESSIBLE ✅ | ||
| Checking postgresql at localhost:5432... ACCESSIBLE ✅ | ||
|
|
||
| Service URLs: | ||
| - n8n: http://localhost:5678 | ||
| - Temporal UI: http://localhost:8080 | ||
| - OpenSearch: http://localhost:9200 | ||
| ``` | ||
|
|
||
| ### Accessing the services | ||
|
|
||
| - **n8n**: <http://localhost:5678> | ||
| - **Temporal UI**: <http://localhost:8080> | ||
|
|
||
| You can verify the services are responding with: | ||
|
|
||
| ```bash | ||
| # Check n8n is responding | ||
| curl -I http://localhost:5678 | ||
|
|
||
| # Check Temporal UI is responding | ||
| curl -I http://localhost:8080 | ||
| ``` | ||
|
|
||
| ### Stopping the services | ||
|
|
||
| ```bash | ||
| docker compose down | ||
| ``` | ||
|
|
||
| To completely remove all data volumes: | ||
|
|
||
| ```bash | ||
| docker compose down -v | ||
| ``` | ||
|
|
||
| ## Data Persistence | ||
|
|
||
| All data is stored in local volumes under the `./volumes/` directory: | ||
|
|
||
| - `./volumes/n8n_data` - n8n data and workflows | ||
| - `./volumes/opensearch-data` - OpenSearch data for Temporal | ||
| - `./volumes/postgresql-data` - PostgreSQL database for Temporal | ||
|
|
||
| ## Service Ports | ||
|
|
||
| - n8n: 5678 | ||
| - Temporal server: 7233 (gRPC API, not HTTP) | ||
| - Temporal UI: 8080 | ||
| - PostgreSQL: 5432 | ||
| - OpenSearch: 9200 | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| If you encounter any issues: | ||
|
|
||
| 1. Check container logs: | ||
| ```bash | ||
| docker logs temporal | ||
| docker logs automatization-n8n-1 | ||
| ``` | ||
|
|
||
| 2. Ensure all required ports are available on your system | ||
|
|
||
| 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. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.