Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e0eaa96
Add Docker setup and CI pipeline for n8n and Temporal workflow automa…
killev Apr 18, 2025
a33801e
Pin n8n Docker image to version 1.22.0 for improved stability.
killev Apr 18, 2025
4b7a21e
Fix n8n healthcheck to use N8N_PORT environment variable instead of h…
killev Apr 18, 2025
fbe4ca8
Add Docker Scout security scanning to CI workflow
killev Apr 18, 2025
e9990be
Update Docker volume configurations to use named volumes
killev Apr 18, 2025
43c47a4
Improve Docker security and introduce service health checks
killev Apr 18, 2025
04932c7
Add service availability check to CI workflow
killev Apr 18, 2025
289c899
Update Docker Buildx action from v2 to v3 in CI workflow
killev Apr 18, 2025
47461d0
Update HEALTHCHECK format to use exec form in Docker configurations
killev Apr 18, 2025
44ae932
Add Docker volume setup script for CI service testing
killev Apr 18, 2025
b64c345
Improve CI pipeline with timeout and cleanup enhancements
killev Apr 18, 2025
c2b0281
Merge branch 'add-docker-configuration' into add-docker-security-check
killev Apr 18, 2025
6e5d39f
Remove conflict's artefact
killev Apr 18, 2025
2b9e5fb
Fix Docker Scout formatting and ignore scan results in git
killev Apr 18, 2025
5588b83
Replace direct Docker Scout usage with official docker/scout-action
killev Apr 18, 2025
e7f814e
Add GitHub authentication token to Docker Scout actions
killev Apr 18, 2025
c80b677
Update Temporal and n8n configurations with latest versions and envir…
killev Apr 20, 2025
88e1414
Improve Docker configuration with parameterized builds and better hea…
killev Apr 20, 2025
4d2dbc8
Refactor Docker configuration to use environment variables from .env …
killev Apr 21, 2025
02169cb
Add environment file copy step to GitHub workflow
killev Apr 21, 2025
737eb62
Add N8N_PORT build argument to Dockerfile
killev Apr 21, 2025
ce49d6e
Update README.md with improved documentation formatting
killev Apr 21, 2025
e5e16cb
Merge branch 'add-docker-configuration' into add-docker-security-check
killev Apr 21, 2025
6617ffe
Merge branch 'main' into add-docker-security-check
anatolyshipitz Apr 22, 2025
55144a1
Merge branch 'main' into add-docker-security-check
killev Apr 22, 2025
ba63d0a
Optimize Docker Security Scanning using matrix strategy
killev Apr 22, 2025
b67f654
Add Docker Hub authentication and enhance security scan output
killev Apr 22, 2025
1ec80e2
Remove whitespace in code-quality.yml workflow file
killev Apr 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 56 additions & 4 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,71 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
- name: Checkout code
uses: actions/checkout@v4
- name: Lint
- name: Run linting
run: echo "Linting..."

sonarqube:
name: SonarQube
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarQube Scan
- name: Run SonarQube scan
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

hadolint:
name: Dockerfile Linting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Lint Dockerfile.n8n
run: docker run --rm -i hadolint/hadolint < Dockerfile.n8n
- name: Lint Dockerfile.temporal
run: docker run --rm -i hadolint/hadolint < Dockerfile.temporal

Comment thread
killev marked this conversation as resolved.
Outdated
docker-scout:
name: Docker Security Scanning
runs-on: ubuntu-latest
needs: hadolint
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build n8n image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.n8n
push: false
tags: n8n-test:latest
load: true
- name: Build temporal image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.temporal
push: false
tags: temporal-test:latest
load: true
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- name: Scan n8n image
run: docker scout cves n8n-test:latest --format sarif --output n8n-scan.sarif
- name: Scan temporal image
run: docker scout cves temporal-test:latest --format sarif --output temporal-scan.sarif
- name: Upload n8n scan results
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: n8n-scan.sarif
category: n8n
- name: Upload temporal scan results
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: temporal-scan.sarif
category: temporal
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
volumes
15 changes: 15 additions & 0 deletions Dockerfile.n8n
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM n8nio/n8n:1.22.0

# Add custom environment variables
ENV N8N_PORT=5678 \
NODE_ENV=production

# Create app directory
WORKDIR /home/node/.n8n

# Add custom healthcheck
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD wget -q --spider http://localhost:${N8N_PORT}/healthz || exit 1

# The entrypoint script is already defined in the base image
# Don't override the CMD
20 changes: 20 additions & 0 deletions Dockerfile.temporal
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM temporalio/auto-setup:1.20

# Set up environment variables for PostgreSQL and Elasticsearch
ENV DB=postgresql \
DB_PORT=5432 \
POSTGRES_USER=temporal \
POSTGRES_PWD=temporal \
POSTGRES_SEEDS=postgresql \
ENABLE_ES=true \
ES_SEEDS=elasticsearch \
ES_VERSION=v7

# Add custom healthcheck
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD temporal operator cluster health | grep -q SERVING || exit 1

# Expose the gRPC port
EXPOSE 7233

# The entrypoint script is already defined in the base image
117 changes: 116 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,116 @@
# 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)

## 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

### 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
99 changes: 99 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
services:
# n8n service
n8n:
build:
context: .
dockerfile: Dockerfile.n8n
ports:
- "5678:5678"
environment:
- WEBHOOK_URL=http://localhost:5678/
volumes:
- ./volumes/n8n_data:/home/node/.n8n
networks:
- app-network

# 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"
- "DISABLE_INSTALL_DEMO_CONFIG=true"
ports:
- 9200:9200
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ./volumes/elasticsearch-data:/usr/share/opensearch/data
networks:
- app-network

postgresql:
container_name: temporal-postgresql
image: postgres:14
environment:
POSTGRES_USER: temporal
POSTGRES_PASSWORD: temporal
POSTGRES_DB: temporal
ports:
- 5432:5432
volumes:
- ./volumes/postgresql-data:/var/lib/postgresql/data
networks:
- app-network

temporal:
container_name: temporal
build:
context: .
dockerfile: Dockerfile.temporal
depends_on:
- postgresql
- elasticsearch
ports:
- 7233:7233
networks:
- app-network

temporal-ui:
container_name: temporal-ui
image: temporalio/ui:2.10.3
depends_on:
- temporal
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
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

networks:
app-network:
driver: bridge