Skip to content

Commit e0eaa96

Browse files
committed
Add Docker setup and CI pipeline for n8n and Temporal workflow automation with documentation.
- Added GitHub Actions workflow with Dockerfile linting - Created Dockerfiles for n8n and Temporal services - Added docker-compose.yml for orchestration - Updated .gitignore to exclude volumes - Enhanced README with setup instructions
1 parent 389a18f commit e0eaa96

File tree

6 files changed

+267
-5
lines changed

6 files changed

+267
-5
lines changed

.github/workflows/code-quality.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,31 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- name: Checkout
15+
- name: Checkout code
1616
uses: actions/checkout@v4
17-
- name: Lint
17+
- name: Run linting
1818
run: echo "Linting..."
1919

2020
sonarqube:
2121
name: SonarQube
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v4
24+
- name: Checkout code
25+
uses: actions/checkout@v4
2526
with:
2627
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
27-
- name: SonarQube Scan
28+
- name: Run SonarQube scan
2829
uses: SonarSource/sonarqube-scan-action@v5
2930
env:
3031
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
32+
33+
hadolint:
34+
name: Dockerfile Linting
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
- name: Lint Dockerfile.n8n
40+
run: docker run --rm -i hadolint/hadolint < Dockerfile.n8n
41+
- name: Lint Dockerfile.temporal
42+
run: docker run --rm -i hadolint/hadolint < Dockerfile.temporal

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,4 @@ dist
134134
.yarn/build-state.yml
135135
.yarn/install-state.gz
136136
.pnp.*
137+
volumes

Dockerfile.n8n

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM n8nio/n8n:latest
2+
3+
# Add custom environment variables
4+
ENV N8N_PORT=5678 \
5+
NODE_ENV=production
6+
7+
# Create app directory
8+
WORKDIR /home/node/.n8n
9+
10+
# Add custom healthcheck
11+
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
12+
CMD wget -q --spider http://localhost:5678/healthz || exit 1
13+
14+
# The entrypoint script is already defined in the base image
15+
# Don't override the CMD

Dockerfile.temporal

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM temporalio/auto-setup:1.20
2+
3+
# Set up environment variables for PostgreSQL and Elasticsearch
4+
ENV DB=postgresql \
5+
DB_PORT=5432 \
6+
POSTGRES_USER=temporal \
7+
POSTGRES_PWD=temporal \
8+
POSTGRES_SEEDS=postgresql \
9+
ENABLE_ES=true \
10+
ES_SEEDS=elasticsearch \
11+
ES_VERSION=v7
12+
13+
# Add custom healthcheck
14+
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
15+
CMD temporal operator cluster health | grep -q SERVING || exit 1
16+
17+
# Expose the gRPC port
18+
EXPOSE 7233
19+
20+
# The entrypoint script is already defined in the base image

README.md

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,116 @@
1-
# automatization
1+
# n8n and Temporal Docker Compose Setup
2+
3+
This repository contains a Docker Compose configuration to run n8n and Temporal services together.
4+
5+
## Services
6+
7+
The setup includes:
8+
9+
- **n8n**: An automation tool that allows you to create workflows visually
10+
- **Temporal**: A workflow orchestration platform with the following components:
11+
- Temporal server
12+
- Temporal UI
13+
- PostgreSQL (database)
14+
- Elasticsearch (for visibility features)
15+
16+
## Custom Docker Images
17+
18+
This project uses custom Docker images built from the following Dockerfiles:
19+
20+
- **Dockerfile.n8n**: Extends the official n8n image with custom configurations
21+
- **Dockerfile.temporal**: Extends the official Temporal auto-setup image
22+
23+
## Usage
24+
25+
### Starting the services
26+
27+
```bash
28+
docker compose up -d
29+
```
30+
31+
This will start all services in detached mode.
32+
33+
### Building custom images
34+
35+
If you've made changes to the Dockerfiles, you'll need to rebuild the images:
36+
37+
```bash
38+
docker compose build
39+
```
40+
41+
Or to rebuild and start in one command:
42+
43+
```bash
44+
docker compose down && docker compose build && docker compose up -d
45+
```
46+
47+
### Verifying services are running
48+
49+
Check that all containers are running:
50+
51+
```bash
52+
docker compose ps
53+
```
54+
55+
You should see containers for:
56+
- n8n
57+
- temporal
58+
- temporal-ui
59+
- temporal-postgresql
60+
- temporal-elasticsearch
61+
62+
### Accessing the services
63+
64+
- **n8n**: http://localhost:5678
65+
- **Temporal UI**: http://localhost:8080
66+
67+
You can verify the services are responding with:
68+
69+
```bash
70+
# Check n8n is responding
71+
curl -I http://localhost:5678
72+
73+
# Check Temporal UI is responding
74+
curl -I http://localhost:8080
75+
```
76+
77+
### Stopping the services
78+
79+
```bash
80+
docker compose down
81+
```
82+
83+
To completely remove all data volumes:
84+
85+
```bash
86+
docker compose down -v
87+
```
88+
89+
## Data Persistence
90+
91+
All data is stored in local volumes under the `./volumes/` directory:
92+
93+
- `./volumes/n8n_data` - n8n data and workflows
94+
- `./volumes/elasticsearch-data` - Elasticsearch data for Temporal
95+
- `./volumes/postgresql-data` - PostgreSQL database for Temporal
96+
97+
## Service Ports
98+
99+
- n8n: 5678
100+
- Temporal server: 7233 (gRPC API, not HTTP)
101+
- Temporal UI: 8080
102+
- PostgreSQL: 5432
103+
- Elasticsearch: 9200
104+
105+
## Troubleshooting
106+
107+
If you encounter any issues:
108+
109+
1. Check container logs:
110+
```bash
111+
docker logs temporal
112+
docker logs automatization-n8n-1
113+
```
114+
115+
2. Ensure all required ports are available on your system
116+
3. Make sure Docker has sufficient resources allocated

docker-compose.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
services:
2+
# n8n service
3+
n8n:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile.n8n
7+
ports:
8+
- "5678:5678"
9+
environment:
10+
- WEBHOOK_URL=http://localhost:5678/
11+
volumes:
12+
- ./volumes/n8n_data:/home/node/.n8n
13+
networks:
14+
- app-network
15+
16+
# Temporal services
17+
elasticsearch:
18+
container_name: temporal-elasticsearch
19+
image: opensearchproject/opensearch:2.5.0
20+
environment:
21+
- discovery.type=single-node
22+
- bootstrap.memory_lock=true
23+
- "OPENSEARCH_JAVA_OPTS=-Xms256m -Xmx256m"
24+
- "DISABLE_SECURITY_PLUGIN=true"
25+
- "DISABLE_INSTALL_DEMO_CONFIG=true"
26+
ports:
27+
- 9200:9200
28+
ulimits:
29+
memlock:
30+
soft: -1
31+
hard: -1
32+
volumes:
33+
- ./volumes/elasticsearch-data:/usr/share/opensearch/data
34+
networks:
35+
- app-network
36+
37+
postgresql:
38+
container_name: temporal-postgresql
39+
image: postgres:14
40+
environment:
41+
POSTGRES_USER: temporal
42+
POSTGRES_PASSWORD: temporal
43+
POSTGRES_DB: temporal
44+
ports:
45+
- 5432:5432
46+
volumes:
47+
- ./volumes/postgresql-data:/var/lib/postgresql/data
48+
networks:
49+
- app-network
50+
51+
temporal:
52+
container_name: temporal
53+
build:
54+
context: .
55+
dockerfile: Dockerfile.temporal
56+
depends_on:
57+
- postgresql
58+
- elasticsearch
59+
ports:
60+
- 7233:7233
61+
networks:
62+
- app-network
63+
64+
temporal-ui:
65+
container_name: temporal-ui
66+
image: temporalio/ui:2.10.3
67+
depends_on:
68+
- temporal
69+
environment:
70+
- TEMPORAL_ADDRESS=temporal:7233
71+
- TEMPORAL_PERMIT_WRITE_API=true
72+
ports:
73+
- 8080:8080
74+
networks:
75+
- app-network
76+
77+
volumes:
78+
n8n_data:
79+
driver: local
80+
driver_opts:
81+
type: none
82+
o: bind
83+
device: ${PWD}/volumes/n8n_data
84+
elasticsearch-data:
85+
driver: local
86+
driver_opts:
87+
type: none
88+
o: bind
89+
device: ${PWD}/volumes/elasticsearch-data
90+
postgresql-data:
91+
driver: local
92+
driver_opts:
93+
type: none
94+
o: bind
95+
device: ${PWD}/volumes/postgresql-data
96+
97+
networks:
98+
app-network:
99+
driver: bridge

0 commit comments

Comments
 (0)