From 0779663c15f876ee04df5ce130c382730b25a10d Mon Sep 17 00:00:00 2001 From: Prithvi Date: Sun, 29 Dec 2024 05:40:01 +0100 Subject: [PATCH 1/3] Kestra Service --- svgs/kestra.svg | 24 ++++++++++ templates/compose/kestra.yaml | 82 +++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 svgs/kestra.svg create mode 100644 templates/compose/kestra.yaml diff --git a/svgs/kestra.svg b/svgs/kestra.svg new file mode 100644 index 0000000000..c4341675f0 --- /dev/null +++ b/svgs/kestra.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/compose/kestra.yaml b/templates/compose/kestra.yaml new file mode 100644 index 0000000000..8b96f12470 --- /dev/null +++ b/templates/compose/kestra.yaml @@ -0,0 +1,82 @@ +# documentation: https://kestra.io/docs/ +# slogan: Open Source Declarative Orchestration Platform +# tags: Orchestrate,Workflow,Automate,Schedule,Data Orchestration +# logo: svgs/kestra.svg +# port: 8080 + +services: + postgres: + image: postgres:16 + volumes: + - kestra-postgres-data:/var/lib/postgresql/data + healthcheck: + test: + - CMD-SHELL + - 'pg_isready -U $${SERVICE_USER_POSTGRES} -d kestra' + interval: 10s + timeout: 5s + retries: 5 + environment: + - POSTGRES_USER=${SERVICE_USER_POSTGRES} + - POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES} + - POSTGRES_DB=${POSTGRES_DB:-kestra} + - PGDATA=/var/lib/postgresql/data/pgdata + + kestra: + user: "root" + command: "server standalone --config /etc/config/application.yaml" + image: kestra/kestra:latest + pull_policy: always + environment: + - SERVICE_FQDN_KESTRA_8080 + - PASSWORD_POSTGRES=${SERVICE_PASSWORD_POSTGRES} + - USER_POSTGRES=${SERVICE_USER_POSTGRES} + - DB_NAME=${POSTGRES_DB} + - KESTRA_URL=${SERVICE_FQDN_KESTRA} + - BASIC_AUTH=${BASIC_AUTH:-false} + - BASIC_AUTH_USER=${BASIC_AUTH_EMAIL:-admin@example.com} # Change this to your 'VALID' email address + - BASIC_AUTH_PASSWORD=${SERVICE_PASSWORD_KESTRA} + volumes: + - kestra-data:/app/storage + - /var/run/docker.sock:/var/run/docker.sock + - /tmp/kestra-wd:/tmp/kestra-wd + - type: bind + source: ./application.yml + target: /etc/config/application.yaml + isDirectory: false + content: | + datasources: + postgres: + url: jdbc:postgresql://postgres:5432/${DB_NAME} + driverClassName: org.postgresql.Driver + username: ${USER_POSTGRES} + password: ${PASSWORD_POSTGRES} + kestra: + server: + basicAuth: + enabled: ${BASIC_AUTH} + username: ${BASIC_AUTH_USER} + password: ${BASIC_AUTH_PASSWORD} + repository: + type: postgres + storage: + type: local + local: + basePath: "app/storage" + queue: + type: postgres + tasks: + tempDir: + path: /tmp/kestra-wd/tmp + url: ${KESTRA_URL} + healthcheck: + test: + - CMD-SHELL + - > + curl -f http://localhost:8081/health | grep -q '"status": "UP"' || exit 1 + interval: 30s + timeout: 10s + retries: 5 + depends_on: + postgres: + condition: service_started From e657565220e986563db06938f9f5f230adecff29 Mon Sep 17 00:00:00 2001 From: Prithvi Date: Wed, 1 Jan 2025 22:50:33 +0100 Subject: [PATCH 2/3] Update kestra.yaml Fix service env vars --- templates/compose/kestra.yaml | 48 +++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/templates/compose/kestra.yaml b/templates/compose/kestra.yaml index 8b96f12470..141d001647 100644 --- a/templates/compose/kestra.yaml +++ b/templates/compose/kestra.yaml @@ -6,6 +6,7 @@ services: postgres: + container_name: kestra_postgres image: postgres:16 volumes: - kestra-postgres-data:/var/lib/postgresql/data @@ -23,26 +24,17 @@ services: - PGDATA=/var/lib/postgresql/data/pgdata kestra: + container_name: kestra_server user: "root" - command: "server standalone --config /etc/config/application.yaml" image: kestra/kestra:latest pull_policy: always - environment: - - SERVICE_FQDN_KESTRA_8080 - - PASSWORD_POSTGRES=${SERVICE_PASSWORD_POSTGRES} - - USER_POSTGRES=${SERVICE_USER_POSTGRES} - - DB_NAME=${POSTGRES_DB} - - KESTRA_URL=${SERVICE_FQDN_KESTRA} - - BASIC_AUTH=${BASIC_AUTH:-false} - - BASIC_AUTH_USER=${BASIC_AUTH_EMAIL:-admin@example.com} # Change this to your 'VALID' email address - - BASIC_AUTH_PASSWORD=${SERVICE_PASSWORD_KESTRA} volumes: - kestra-data:/app/storage - /var/run/docker.sock:/var/run/docker.sock - /tmp/kestra-wd:/tmp/kestra-wd - type: bind - source: ./application.yml - target: /etc/config/application.yaml + source: ./application.template.yml + target: /etc/config/application.template.yml isDirectory: false content: | datasources: @@ -69,14 +61,38 @@ services: tempDir: path: /tmp/kestra-wd/tmp url: ${KESTRA_URL} + - type: bind + source: ./docker-entrypoint.sh + target: /docker-entrypoint-mount.sh + isDirectory: false + content: | + #!/bin/bash + + # Install envsubst if not already installed (for runtime installation) + apt-get update && apt-get install -y gettext + + # Replace environment variables in the template with actual values + envsubst < /etc/config/application.template.yml > /etc/config/application.yml + + + # Start Kestra with the newly generated configuration file + /app/kestra server standalone --config /etc/config/application.yml + environment: + - SERVICE_FQDN_KESTRA_8080 + - PASSWORD_POSTGRES=${SERVICE_PASSWORD_POSTGRES} + - USER_POSTGRES=${SERVICE_USER_POSTGRES} + - DB_NAME=${POSTGRES_DB} + - KESTRA_URL=${SERVICE_FQDN_KESTRA} + - BASIC_AUTH=${BASIC_AUTH:-false} + - BASIC_AUTH_USER=${BASIC_AUTH_EMAIL:-admin@example.com} # Change this to your 'VALID' email address + - BASIC_AUTH_PASSWORD=${SERVICE_PASSWORD_KESTRA} healthcheck: - test: - - CMD-SHELL - - > - curl -f http://localhost:8081/health | grep -q '"status": "UP"' || exit 1 + test: ["CMD", "curl", "-f", "http://0.0.0.0:8081/health"] interval: 30s timeout: 10s retries: 5 + start_period: 60s depends_on: postgres: condition: service_started + entrypoint: ["sh", "-c", "cp /docker-entrypoint-mount.sh /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh && /docker-entrypoint.sh"] From b18b695a5eb9cf696164f1ba4f484f1da8138ddd Mon Sep 17 00:00:00 2001 From: Prithvi Date: Sat, 25 Jan 2025 15:02:26 +0100 Subject: [PATCH 3/3] Update kestra.yaml Update with (3/4) requested changes --- templates/compose/kestra.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/templates/compose/kestra.yaml b/templates/compose/kestra.yaml index 141d001647..deaede964c 100644 --- a/templates/compose/kestra.yaml +++ b/templates/compose/kestra.yaml @@ -6,7 +6,6 @@ services: postgres: - container_name: kestra_postgres image: postgres:16 volumes: - kestra-postgres-data:/var/lib/postgresql/data @@ -21,10 +20,8 @@ services: - POSTGRES_USER=${SERVICE_USER_POSTGRES} - POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES} - POSTGRES_DB=${POSTGRES_DB:-kestra} - - PGDATA=/var/lib/postgresql/data/pgdata kestra: - container_name: kestra_server user: "root" image: kestra/kestra:latest pull_policy: always