Moving Dagu from Rinoa to Aranea.

This commit is contained in:
2026-05-12 07:45:00 -04:00
parent 39eeb029ae
commit 618909ad4b
9 changed files with 0 additions and 189 deletions
@@ -0,0 +1,2 @@
# This file indicates that example DAGs have been created.
# Delete this file to re-create examples on next startup.
@@ -0,0 +1,11 @@
# 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"
@@ -0,0 +1,41 @@
# 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
@@ -0,0 +1,21 @@
# 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"
@@ -0,0 +1,24 @@
# 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"
@@ -0,0 +1,18 @@
# 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())"
@@ -0,0 +1,40 @@
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 --
@@ -0,0 +1,34 @@
{% 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
-189
View File
@@ -1,189 +0,0 @@
#######################################################################################
# ______ #
# / _____) #
# ( (____ ____ _____ ____ ___ _____ ____ _ _ _____ ____ #
# \____ \ | _ \ (____ || _ \ /___)| ___ | / ___)| | | || ___ | / ___) #
# _____) )| | | |/ ___ || |_| ||___ || ____|| | \ V / | ____|| | #
# (______/ |_| |_|\_____|| __/ (___/ |_____)|_| \_/ |_____)|_| #
# |_| #
# #
# Snapserver config file #
# #
# Source: https://github.com/badaix/snapcast/blob/develop/server/etc/snapserver.conf # #
# #
#######################################################################################
# default values are commented
# uncomment and edit to change them
# Settings can be overwritten on command line with:
# "--<section>.<name>=<value>", e.g. --server.threads=4
# General server settings #####################################################
#
[server]
# Number of additional worker threads to use
# - For values < 0 the number of threads will be 2 (on single and dual cores)
# or 4 (for quad and more cores)
# - 0 will utilize just the processes main thread and might cause audio drops
# in case there are a couple of longer running tasks, such as encoding
# multiple audio streams
#threads = -1
# the pid file when running as daemon
#pidfile = /var/run/snapserver/pid
# the user to run as when daemonized
#user = snapserver
# the group to run as when daemonized
#group = snapserver
# directory where persistent data is stored (server.json)
# if empty, data dir will be
# - "/var/lib/snapserver/" when running as daemon
# - "$HOME/.config/snapserver/" when not running as daemon
datadir = /data/
#
###############################################################################
# HTTP RPC ####################################################################
#
[http]
# enable HTTP Json RPC (HTTP POST and websockets)
enabled = true
# address to listen on, can be specified multiple times
# use "0.0.0.0" to bind to any IPv4 address or :: to bind to any IPv6 address
# or "127.0.0.1" or "::1" to bind to localhost IPv4 or IPv6, respectively
# use the address of a specific network interface to just listen to and accept
# connections from that interface
bind_to_address = 0.0.0.0
# which port the server should listen to
port = 1780
# serve a website from the doc_root location
# disabled if commented or empty
doc_root = /usr/share/snapweb
# Hostname or IP under which clients can reach this host
# used to serve cached cover art
# use <hostname> as placeholder for your actual host name
#host = <hostname>
#
###############################################################################
# TCP RPC #####################################################################
#
[tcp]
# enable TCP Json RPC
enabled = true
# address to listen on, can be specified multiple times
# use "0.0.0.0" to bind to any IPv4 address or :: to bind to any IPv6 address
# or "127.0.0.1" or "::1" to bind to localhost IPv4 or IPv6, respectively
# use the address of a specific network interface to just listen to and accept
# connections from that interface
bind_to_address = 0.0.0.0
# which port the server should listen to
port = 1705
#
###############################################################################
# Stream settings #############################################################
#
[stream]
# address to listen on, can be specified multiple times
# use "0.0.0.0" to bind to any IPv4 address or :: to bind to any IPv6 address
# or "127.0.0.1" or "::1" to bind to localhost IPv4 or IPv6, respectively
# use the address of a specific network interface to just listen to and accept
# connections from that interface
bind_to_address = 0.0.0.0
# which port the server should listen to
port = 1704
# source URI of the PCM input stream, can be configured multiple times
# The following notation is used in this paragraph:
# <angle brackets>: the whole expression must be replaced with your specific setting
# [square brackets]: the whole expression is optional and can be left out
# [key=value]: if you leave this option out, "value" will be the default for "key"
#
# Format: TYPE://host/path?name=<name>[&codec=<codec>][&sampleformat=<sampleformat>][&chunk_ms=<chunk ms>][&controlscript=<control script filename>[&controlscriptparams=<control script command line arguments>]]
# parameters have the form "key=value", they are concatenated with an "&" character
# parameter "name" is mandatory for all sources, while codec, sampleformat and chunk_ms are optional
# and will override the default codec, sampleformat or chunk_ms settings
# Non blocking sources support the dryout_ms parameter: when no new data is read from the source, send silence to the clients
# Available types are:
# pipe: pipe:///<path/to/pipe>?name=<name>[&mode=create][&dryout_ms=2000], mode can be "create" or "read"
# librespot: librespot:///<path/to/librespot>?name=<name>[&dryout_ms=2000][&username=<my username>&password=<my password>][&devicename=Snapcast][&bitrate=320][&wd_timeout=7800][&volume=100][&onevent=""][&nomalize=false][&autoplay=false][&params=<generic librepsot process arguments>]
# note that you need to have the librespot binary on your machine
# sampleformat will be set to "44100:16:2"
# file: file:///<path/to/PCM/file>?name=<name>
# process: process:///<path/to/process>?name=<name>[&dryout_ms=2000][&wd_timeout=0][&log_stderr=false][&params=<process arguments>]
# airplay: airplay:///<path/to/airplay>?name=<name>[&dryout_ms=2000][&port=5000]
# note that you need to have the airplay binary on your machine
# sampleformat will be set to "44100:16:2"
# tcp server: tcp://<listen IP, e.g. 127.0.0.1>:<port>?name=<name>[&mode=server]
# tcp client: tcp://<server IP, e.g. 127.0.0.1>:<port>?name=<name>&mode=client
# alsa: alsa:///?name=<name>&device=<alsa device>[&send_silence=false][&idle_threshold=100][&silence_threshold_percent=0.0]
# meta: meta:///<name of source#1>/<name of source#2>/.../<name of source#N>?name=<name>
#
# librespot: forcing zeroconf advertised port to 22382 via librespot custom params (URL encoded): `--zeroconf-port 22382`
# see:
# - https://github.com/badaix/snapcast/blob/develop/doc/configuration.md#librespot
source = librespot://librespot?name=LibreSpot&devicename=LibreSpot&bitrate=320&sampleformat=44100:16:2&cache=%2Fvar%2Fcache%2Flibrespot%2F&params=--zeroconf-port%2022382
# source = airplay:///usr/bin/shairport-sync?name=shairport[&dryout_ms=2000&devicename=Snapcast&port=5000
source = pipe:////audio/snapcast_fifo?name=Mopidy
# Default sample format: <sample rate>:<bits per sample>:<channels>
sampleformat = 48000:16:2
# Default transport codec
# (flac|ogg|opus|pcm)[:options]
# Start Snapserver with "--stream:codec=<codec>:?" to get codec specific options
codec = pcm
# Default source stream read chunk size [ms].
# The server will continously read this number of milliseconds from the source into buffer and pass this buffer to the encoder.
# The encoded buffer is sent to the clients. Some codecs have a higher latency and will need more data, e.g. Flac will need ~26ms chunks
#chunk_ms = 20
# Buffer [ms]
# The end-to-end latency, from capturing a sample on the server until the sample is played-out on the client
buffer = 1000
# Send audio to muted clients
send_to_muted = false
# Streaming client options ####################################################
#
[streaming_client]
# Volume assigned to new snapclients [percent]
# Defaults to 100 if unset
initial_volume = 100
#
###############################################################################
# Logging options #############################################################
#
[logging]
# log sink [null,system,stdout,stderr,file:<filename>]
# when left empty: if running as daemon "system" else "stdout"
#sink =
# log filter <tag>:<level>[,<tag>:<level>]*
# with tag = * or <log tag> and level = [trace,debug,info,notice,warning,error,fatal]
#filter = *:info
#
###############################################################################