Moving Dagu from Rinoa to Aranea.
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
# This file indicates that example DAGs have been created.
|
||||
# Delete this file to re-create examples on next startup.
|
||||
@@ -1,11 +0,0 @@
|
||||
# Basic Sequential Execution
|
||||
# Steps execute one after another in order
|
||||
|
||||
description: Execute steps one after another
|
||||
|
||||
steps:
|
||||
- command: echo "Step 1 - Starting workflow"
|
||||
|
||||
- command: echo "Step 2 - Processing data"
|
||||
|
||||
- command: echo "Step 3 - Workflow complete"
|
||||
@@ -1,41 +0,0 @@
|
||||
# Parallel Execution
|
||||
# Run multiple tasks simultaneously
|
||||
|
||||
description: Execute multiple tasks in parallel
|
||||
|
||||
steps:
|
||||
- name: setup
|
||||
command: echo "Setting up environment"
|
||||
|
||||
# These steps run in parallel after setup
|
||||
- name: task-a
|
||||
command: |
|
||||
echo "Task A starting"
|
||||
sleep 2
|
||||
echo "Task A complete"
|
||||
depends:
|
||||
- setup
|
||||
|
||||
- name: task-b
|
||||
command: |
|
||||
echo "Task B starting"
|
||||
sleep 2
|
||||
echo "Task B complete"
|
||||
depends:
|
||||
- setup
|
||||
|
||||
- name: task-c
|
||||
command: |
|
||||
echo "Task C starting"
|
||||
sleep 2
|
||||
echo "Task C complete"
|
||||
depends:
|
||||
- setup
|
||||
|
||||
# Wait for all parallel tasks to complete
|
||||
- name: merge-results
|
||||
command: echo "All parallel tasks completed"
|
||||
depends:
|
||||
- task-a
|
||||
- task-b
|
||||
- task-c
|
||||
@@ -1,21 +0,0 @@
|
||||
# Scheduled Workflows
|
||||
# Run workflows automatically on a schedule
|
||||
|
||||
description: Example of a scheduled workflow
|
||||
# Uncomment to run daily at 2:00 AM
|
||||
# schedule: "0 2 * * *"
|
||||
|
||||
# Schedule examples:
|
||||
# "0 * * * *" - Every hour
|
||||
# "*/5 * * * *" - Every 5 minutes
|
||||
# "0 9 * * 1-5" - Weekdays at 9 AM
|
||||
# "0 0 1 * *" - First day of each month
|
||||
|
||||
histRetentionDays: 7 # Keep 7 days of history
|
||||
|
||||
steps:
|
||||
- command: |
|
||||
echo "Running scheduled task"
|
||||
echo "Current time: $(date)"
|
||||
|
||||
- command: echo "Cleaning up old data"
|
||||
@@ -1,24 +0,0 @@
|
||||
# Nested Workflows
|
||||
# Call other workflows as sub-workflows
|
||||
|
||||
description: Example of nested workflows
|
||||
|
||||
steps:
|
||||
- command: echo "Preparing data for sub-workflows"
|
||||
|
||||
- run: sub-workflow
|
||||
params: "TASK_ID=123"
|
||||
|
||||
- command: echo "Main workflow completed"
|
||||
|
||||
---
|
||||
# Sub-workflow definition
|
||||
name: sub-workflow
|
||||
description: Sub-workflow that gets called by main
|
||||
params:
|
||||
- TASK_ID: "000"
|
||||
|
||||
steps:
|
||||
- command: echo "Sub-workflow executing with TASK_ID=${TASK_ID}"
|
||||
|
||||
- command: echo "Sub-workflow step 2"
|
||||
@@ -1,18 +0,0 @@
|
||||
# Container-based Workflow
|
||||
# Using a container for all steps
|
||||
|
||||
description: Run workflow steps in a Python container
|
||||
|
||||
container:
|
||||
image: python:3.13
|
||||
volumes:
|
||||
- /tmp/data:/data
|
||||
|
||||
steps:
|
||||
- # write data to a file
|
||||
command: |
|
||||
python -c "with open('/data/output.txt', 'w') as f: f.write('Hello from Dagu!')"
|
||||
|
||||
- # read data from the file
|
||||
command: |
|
||||
python -c "with open('/data/output.txt') as f: print(f.read())"
|
||||
@@ -1,40 +0,0 @@
|
||||
name: home-assistant-backup-sync
|
||||
description: "Daily rsync of latest Home Assistant .tar backup and prune older archives"
|
||||
schedule: "30 5 * * *"
|
||||
|
||||
ssh:
|
||||
user: pi
|
||||
host: 192.168.1.252
|
||||
key: /dagu/ssh/dagu_id_rsa
|
||||
strictHostKey: true
|
||||
knownHostFile: /dagu/ssh/known_hosts
|
||||
|
||||
steps:
|
||||
- name: find-latest-backup
|
||||
executor:
|
||||
type: ssh
|
||||
command: >
|
||||
ls -t /home/pi/.config/docker/homeassistant/backups/*.tar |
|
||||
head -n 1
|
||||
output: LATEST_TAR
|
||||
|
||||
- name: rsync-to-destination
|
||||
depends: find-latest-backup
|
||||
command: >
|
||||
rsync -avz --progress
|
||||
$(echo ${LATEST_TAR})
|
||||
charish@192.168.1.254:/rinoa-storage/backups/home-assistant
|
||||
|
||||
- name: prune-old-backups
|
||||
depends: rsync-to-destination
|
||||
executor:
|
||||
type: ssh
|
||||
config:
|
||||
user: charish
|
||||
host: 192.168.1.254
|
||||
key: /dagu/ssh/dagu_id_rsa
|
||||
knownHostFile: /dagu/ssh/known_hosts
|
||||
strictHostKey: true
|
||||
command: >
|
||||
cd /rinoa-storage/backups/home-assistant &&
|
||||
ls -t *.tar | tail -n +8 | xargs -r rm --
|
||||
@@ -1,34 +0,0 @@
|
||||
{% set vault_addr = 'https://vault.trez.wtf' %}
|
||||
{% set secrets_path = 'rinoa-docker/env' %}
|
||||
name: mariadb-backup
|
||||
description: "Backup of all databases from MariaDB container"
|
||||
schedule: "30 23 * * *"
|
||||
|
||||
env:
|
||||
MARIADB_ROOT_PASSWORD: {{ lookup('community.hashi_vault.vault_kv2_get', 'env', engine_mount_point='rinoa-docker', url=vault_addr, token=vault_token)['secret']['MARIADB_ENVIRONMENT_MYSQL_ROOT_PASSWORD'] }}
|
||||
|
||||
steps:
|
||||
- name: list-all-databases
|
||||
shell: nix-shell
|
||||
shellPackages: [mariadb]
|
||||
command: |
|
||||
mariadb -h mariadb -u root -p"${MARIADB_ROOT_PASSWORD}" -Nse "SHOW DATABASES;" | egrep -v '(information|performance)_schema|mysql|sys'
|
||||
output: RINOA_MADB_LIST
|
||||
|
||||
- name: db-folder-check-creation-backup
|
||||
depends: list-all-databases
|
||||
shell: nix-shell
|
||||
shellPackages: [mariadb]
|
||||
workingDir: /backups/dbs/mariadb
|
||||
script: |
|
||||
for mdatabase in $(echo ${RINOA_MADB_LIST}) ; do
|
||||
mkdir -p ${mdatabase}
|
||||
mariadb_dump --u root --p"${MARIADB_ROOT_PASSWORD}" --databases ${madb} > ${mdatabase}/dump-$(date +%Y%m%d)-$(cat /proc/sys/kernel/random/uuid).sql
|
||||
done
|
||||
|
||||
- name: db-backup-cleanup
|
||||
depends:
|
||||
- db-folder-check-creation-backup
|
||||
workingDir: /backups/dbs/mariadb
|
||||
command: >
|
||||
find $(pwd) -type f -name "*.sql" -ctime +7 | xargs rm -fv
|
||||
Reference in New Issue
Block a user