migrate infra from single server to multi-server cluster

This commit is contained in:
Marcel Arndt
2025-12-12 11:41:32 +01:00
parent b1a70673a4
commit 156733f65a
63 changed files with 2219 additions and 3 deletions
@@ -0,0 +1,47 @@
---
- name: KESTRA | Ensure data directory
ansible.builtin.file:
path: '{{ data_dir }}/data/data'
state: directory
mode: '0755'
run_once: true
delegate_to: "{{ groups['managers'][0] }}"
- name: KESTRA | Ensure db directory
ansible.builtin.file:
path: '{{ data_dir }}/data/db'
state: directory
mode: '0755'
run_once: true
delegate_to: "{{ groups['managers'][0] }}"
- name: KESTRA | Konfigurationsdatei für tmpfiles.d erstellen
ansible.builtin.copy:
content: "d /tmp/kestra-wd 0755 root root -"
dest: /etc/tmpfiles.d/kestra-wd.conf
owner: root
group: root
mode: '0644'
- name: KESTRA | Create Kestra working directory
ansible.builtin.file:
path: /tmp/kestra-wd
state: directory
mode: '0755'
- name: KESTRA | Generate Compose file
ansible.builtin.template:
src: docker-compose.yml.j2
dest: '{{ data_dir }}/kestra.yml'
mode: 0644
run_once: true
delegate_to: "{{ groups['managers'][0] }}"
- name: KESTRA | Deploy stack
community.docker.docker_stack:
state: present
name: kestra
compose:
- /mnt/cephfs/kestra/kestra.yml
delegate_to: "{{ groups['managers'][0] }}"
run_once: true
@@ -0,0 +1,92 @@
networks:
internal:
{{ traefik_public_net }}:
external: true
services:
postgres:
image: postgres:17
volumes:
- {{ data_dir }}/data/db:/var/lib/postgresql/data
environment:
POSTGRES_DB: kestra
POSTGRES_USER: kestra
POSTGRES_PASSWORD: k3str4
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
interval: 30s
timeout: 10s
retries: 10
networks:
- internal
deploy:
mode: replicated
replicas: 1
kestra:
image: kestra/kestra:v0.24.2
entrypoint: /bin/bash
# Note that this is meant for development only. Refer to the documentation for production deployments of Kestra which runs without a root user.
user: "root"
command:
- -c
- /app/kestra server standalone --worker-thread=128
volumes:
- {{ data_dir }}/data/data:/app/storage
- /var/run/docker.sock:/var/run/docker.sock
- /tmp/kestra-wd:/tmp/kestra-wd
environment:
KESTRA_CONFIGURATION: |
datasources:
postgres:
url: jdbc:postgresql://postgres:5432/kestra
driverClassName: org.postgresql.Driver
username: kestra
password: k3str4
kestra:
tutorialFlows:
enabled: false
traces:
root: DEFAULT
micronaut:
metrics:
export:
otlp:
enabled: true
url: http://signoz_otel-collector:4318/v1/metrics
otel:
traces:
exporter: otlp
exporter:
otlp:
endpoint: http://signoz_otel-collector:4318
server:
basic-auth:
username: ma@coachhamburg.com
password: "igyozi9B87yTeiQ6z2sbe8Y4aQLJV58jdaCNu"
repository:
type: postgres
storage:
type: local
local:
base-path: "/app/storage"
queue:
type: postgres
tasks:
tmp-dir:
path: /tmp/kestra-wd/tmp
url: http://localhost:8080/
networks:
- {{ traefik_public_net }}
- internal
deploy:
mode: replicated
replicas: 1
labels:
- "traefik.enable=true"
- "traefik.swarm.network={{ traefik_public_net }}"
- "traefik.http.routers.kestra.rule=Host(`{{ subdomain }}.{{ main_domain }}`)"
- "traefik.http.routers.kestra.entrypoints=https"
- "traefik.http.routers.kestra.tls=true"
- "traefik.http.routers.kestra.tls.certresolver=main"
- "traefik.http.services.kestra.loadbalancer.server.port=8080"
@@ -0,0 +1,2 @@
subdomain: workflow
data_dir: "{{ ceph_volume }}/kestra"