This guide provides a full Ansible playbook to deploy Automatisch with Docker Compose on Debian 10+, Ubuntu LTS, and RHEL 9+ compatible hosts.
- name: Deploy Automatisch
hosts: automatisch
become: true
vars:
app_root: /opt/automatisch
app_host: automatisch.example.com
app_protocol: https
app_port: 3000
encryption_key: "{{ vault_automatisch_encryption_key }}"
webhook_secret_key: "{{ vault_automatisch_webhook_secret }}"
app_secret_key: "{{ vault_automatisch_app_secret }}"
postgres_password: "{{ vault_automatisch_db_password }}"
timezone: UTC
tasks:
- name: Install Docker on Debian/Ubuntu
apt:
name:
- docker.io
- docker-compose-plugin
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Install Docker on RHEL family
dnf:
name:
- docker
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable and start Docker
service:
name: docker
state: started
enabled: true
- name: Create application directory
file:
path: "{{ app_root }}"
state: directory
mode: "0755"
- name: Write Docker Compose file
copy:
dest: "{{ app_root }}/docker-compose.yml"
mode: "0644"
content: |
services:
main:
image: ghcr.io/automatisch/automatisch:latest
ports:
- "{{ app_port }}:3000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
environment:
- HOST={{ app_host }}
- PROTOCOL={{ app_protocol }}
- PORT={{ app_port }}
- APP_ENV=production
- ENCRYPTION_KEY={{ encryption_key }}
- WEBHOOK_SECRET_KEY={{ webhook_secret_key }}
- APP_SECRET_KEY={{ app_secret_key }}
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_DATABASE=automatisch
- POSTGRES_USERNAME=automatisch
- POSTGRES_PASSWORD={{ postgres_password }}
- REDIS_HOST=redis
- REDIS_PORT=6379
- TZ={{ timezone }}
volumes:
- automatisch_storage:/automatisch/storage
restart: unless-stopped
worker:
image: ghcr.io/automatisch/automatisch:latest
depends_on:
- postgres
- redis
- main
environment:
- WORKER=true
- APP_ENV=production
- ENCRYPTION_KEY={{ encryption_key }}
- WEBHOOK_SECRET_KEY={{ webhook_secret_key }}
- APP_SECRET_KEY={{ app_secret_key }}
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_DATABASE=automatisch
- POSTGRES_USERNAME=automatisch
- POSTGRES_PASSWORD={{ postgres_password }}
- REDIS_HOST=redis
- REDIS_PORT=6379
- TZ={{ timezone }}
volumes:
- automatisch_storage:/automatisch/storage
restart: unless-stopped
postgres:
image: postgres:16-alpine
environment:
- POSTGRES_DB=automatisch
- POSTGRES_USER=automatisch
- POSTGRES_PASSWORD={{ postgres_password }}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U automatisch -d automatisch"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
image: redis:7-alpine
volumes:
- redis_data:/data
restart: unless-stopped
volumes:
automatisch_storage:
postgres_data:
redis_data:
- name: Start Automatisch stack
command: docker compose up -d
args:
chdir: "{{ app_root }}"
ghcr.io/automatisch/automatisch:latest from GitHub Container Registry.Before running the playbook, generate secure keys:
# Generate ENCRYPTION_KEY
openssl rand -base64 36
# Generate WEBHOOK_SECRET_KEY
openssl rand -base64 36
# Generate APP_SECRET_KEY
openssl rand -base64 36
http://YOUR-SERVER:3000We develop tailored automation solutions for:
Let’s discuss your requirements: office@linux-server-admin.com | Contact