-
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 7 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
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 |
---|---|---|
|
@@ -134,3 +134,4 @@ dist | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
volumes |
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.22.0 | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Add custom environment variables | ||
ENV N8N_PORT=5678 \ | ||
NODE_ENV=production \ | ||
N8N_METRICS=true \ | ||
N8N_HEALTH_CHECK_ENDPOINT=true | ||
|
||
# Create app directory | ||
WORKDIR /home/node/.n8n | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Add custom healthcheck - using shell form to ensure || works correctly | ||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ | ||
CMD /bin/sh -c "curl -s http://localhost:${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 | ||
|
||
# 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,23 @@ | ||
FROM temporalio/auto-setup:1.20 | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Set up environment variables for PostgreSQL and Elasticsearch | ||
ENV DB=postgresql \ | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
DB_PORT=5432 \ | ||
POSTGRES_USER=temporal \ | ||
POSTGRES_PWD=temporal \ | ||
POSTGRES_SEEDS=postgresql \ | ||
ENABLE_ES=true \ | ||
ES_SEEDS=elasticsearch \ | ||
ES_VERSION=v7 | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Add custom healthcheck - using shell form to ensure || works correctly | ||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ | ||
CMD /bin/sh -c "temporal operator cluster health --address 0.0.0.0:7233 | 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 7233 | ||
|
||
# The entrypoint script is already defined in the base image | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
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,146 @@ | ||
# 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) | ||
- Elasticsearch (for visibility features) | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## 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 | ||
|
||
### Starting the services | ||
|
||
```bash | ||
docker compose up -d | ||
``` | ||
|
||
This will start all services in detached mode. | ||
|
||
### Building custom images | ||
|
||
If you've made changes to the Dockerfiles, you'll need to rebuild the images: | ||
|
||
```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 | ||
- temporal-elasticsearch | ||
|
||
### Checking Service Health | ||
|
||
Use the provided script to verify that all services are accessible: | ||
|
||
```bash | ||
./check_services.sh | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This will check: | ||
- n8n health endpoint | ||
- Temporal UI web interface | ||
- Elasticsearch API | ||
- Temporal server gRPC port | ||
- PostgreSQL database connection | ||
|
||
Example output: | ||
``` | ||
Checking service availability... | ||
Checking n8n at http://localhost:5678/healthz... ACCESSIBLE ✅ (HTTP 200) | ||
Checking temporal-ui at http://localhost:8080... ACCESSIBLE ✅ (HTTP 200) | ||
Checking elasticsearch 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 | ||
- Elasticsearch: 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/elasticsearch-data` - Elasticsearch 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 | ||
- Elasticsearch: 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 |
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,118 @@ | ||
services: | ||
# n8n service | ||
n8n: | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
build: | ||
context: . | ||
dockerfile: Dockerfile.n8n | ||
ports: | ||
- "5678:5678" | ||
environment: | ||
- WEBHOOK_URL=http://localhost:5678/ | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
volumes: | ||
- n8n_data:/home/node/.n8n | ||
networks: | ||
- app-network | ||
user: node | ||
|
||
# Temporal services | ||
elasticsearch: | ||
container_name: temporal-elasticsearch | ||
image: opensearchproject/opensearch:2.5.0 | ||
environment: | ||
- discovery.type=single-node | ||
- bootstrap.memory_lock=true | ||
- "OPENSEARCH_JAVA_OPTS=-Xms256m -Xmx256m" | ||
- "DISABLE_SECURITY_PLUGIN=true" | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- "DISABLE_INSTALL_DEMO_CONFIG=true" | ||
ports: | ||
- 9200:9200 | ||
cap_add: | ||
- IPC_LOCK | ||
ulimits: | ||
memlock: | ||
soft: -1 | ||
hard: -1 | ||
volumes: | ||
- elasticsearch-data:/usr/share/opensearch/data | ||
networks: | ||
- app-network | ||
healthcheck: | ||
test: ["CMD-SHELL", "curl -sSf http://localhost:9200/ || exit 1"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 5 | ||
|
||
postgresql: | ||
container_name: temporal-postgresql | ||
image: postgres:14 | ||
environment: | ||
POSTGRES_USER: temporal | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
POSTGRES_PASSWORD: temporal | ||
POSTGRES_DB: temporal | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
- postgresql-data:/var/lib/postgresql/data | ||
networks: | ||
- app-network | ||
user: postgres | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U temporal"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
start_period: 10s | ||
|
||
temporal: | ||
container_name: temporal | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.temporal | ||
depends_on: | ||
postgresql: | ||
condition: service_healthy | ||
elasticsearch: | ||
condition: service_healthy | ||
ports: | ||
- 7233:7233 | ||
networks: | ||
- app-network | ||
user: temporal | ||
|
||
temporal-ui: | ||
container_name: temporal-ui | ||
image: temporalio/ui:2.10.3 | ||
depends_on: | ||
temporal: | ||
condition: service_started | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
environment: | ||
- TEMPORAL_ADDRESS=temporal:7233 | ||
- TEMPORAL_PERMIT_WRITE_API=true | ||
ports: | ||
- 8080:8080 | ||
networks: | ||
- app-network | ||
|
||
volumes: | ||
n8n_data: | ||
driver: local | ||
driver_opts: | ||
type: none | ||
o: bind | ||
device: ${PWD}/volumes/n8n_data | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
elasticsearch-data: | ||
driver: local | ||
driver_opts: | ||
type: none | ||
o: bind | ||
device: ${PWD}/volumes/elasticsearch-data | ||
postgresql-data: | ||
driver: local | ||
driver_opts: | ||
type: none | ||
o: bind | ||
device: ${PWD}/volumes/postgresql-data | ||
|
||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
networks: | ||
app-network: | ||
driver: bridge | ||
killev marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
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.