Initial commit (for later deployment after hardware acquisition).
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
name: List of Services README Generation
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: 30 */2 * * *
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
readme-services:
|
||||||
|
name: Generate Services List
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
with:
|
||||||
|
ref: 'main'
|
||||||
|
|
||||||
|
- name: Install yq
|
||||||
|
uses: dcarbone/install-yq-action@4075b4dca348d74bd83f2bf82d30f25d7c54539b # v1.3.1
|
||||||
|
|
||||||
|
- name: Generate service list
|
||||||
|
run: |
|
||||||
|
yq '.services | to_entries | map({"service": .key, "image": .value.image, "description": (.value.labels."homepage.description" // "")})' docker-compose.yml > services.yml
|
||||||
|
|
||||||
|
- name: Generate Markdown Table
|
||||||
|
uses: gazab/create-markdown-table@6686233d7008e8d8b9d4bbdbfd1fb1ae510019f0 # v1.0.7
|
||||||
|
id: service-table
|
||||||
|
with:
|
||||||
|
file: ./services.yml
|
||||||
|
|
||||||
|
- name: Regenerate README
|
||||||
|
run: |
|
||||||
|
echo "# List of Services" > README.md
|
||||||
|
echo -e "\n\n" >> README.md
|
||||||
|
echo "${{ steps.service-table.outputs.table }}" >> README.md
|
||||||
|
|
||||||
|
- name: Add/Commit README.md
|
||||||
|
id: commit-readme
|
||||||
|
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
|
||||||
|
with:
|
||||||
|
message: "chore: Update README"
|
||||||
|
add: "README.md"
|
||||||
@@ -0,0 +1,330 @@
|
|||||||
|
name: Docker Compose Deployment
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- "main"
|
||||||
|
- "renovate/**"
|
||||||
|
paths:
|
||||||
|
- "**/docker-compose.yml"
|
||||||
|
|
||||||
|
env:
|
||||||
|
HC_VAULT_VERSION: "1.20.4"
|
||||||
|
TEA_VERSION: "0.10.1"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-and-create-pr:
|
||||||
|
if: github.ref != 'refs/heads/main'
|
||||||
|
name: Check and Create PR
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: "${{ secrets.RUNNER_GOTIFY_URL }}"
|
||||||
|
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||||
|
notification_title: "GITEA: PR Check @ Rikku"
|
||||||
|
notification_message: "Checking for existing PR... 🔍"
|
||||||
|
|
||||||
|
- name: PR Check/Creation
|
||||||
|
uses: https://git.trez.wtf/Trez/gitea-auto-pr@main
|
||||||
|
with:
|
||||||
|
url: ${{ secrets.TREZ_GITEA_URL }}
|
||||||
|
token: ${{ secrets.BOT_GITEA_TOKEN }}
|
||||||
|
pr-label: docker-compose,manual
|
||||||
|
assignee: ${{ github.actor }}
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: "${{ secrets.RUNNER_GOTIFY_URL }}"
|
||||||
|
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||||
|
notification_title: "GITEA: PR Check @ Rikku"
|
||||||
|
notification_message: "PR Check done 🎟️"
|
||||||
|
|
||||||
|
generate-service-list:
|
||||||
|
name: Generate list of added/modified/deleted services
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [check-and-create-pr]
|
||||||
|
outputs:
|
||||||
|
svc_deploy_list: ${{ steps.detect_services.outputs.docker_svc_list }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
|
||||||
|
- name: Fetch base branch
|
||||||
|
run: |
|
||||||
|
git fetch origin ${{ github.event.pull_request.base.ref }}
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: "${{ secrets.RUNNER_GOTIFY_URL }}"
|
||||||
|
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||||
|
notification_title: "GITEA: Services TBD"
|
||||||
|
notification_message: "Generating list of services to deploy..."
|
||||||
|
|
||||||
|
- name: Save both versions of docker-compose.yml
|
||||||
|
run: |
|
||||||
|
git show origin/main:docker-compose.yml > docker-compose-main.yml || touch docker-compose-main.yml
|
||||||
|
cp docker-compose.yml docker-compose-head.yml
|
||||||
|
|
||||||
|
- name: Detect added, deleted, and modified services
|
||||||
|
id: detect_services
|
||||||
|
run: |
|
||||||
|
echo "Getting services from main and ${{ github.ref_name }}"
|
||||||
|
yq '.services | keys | .[]' docker-compose-main.yml | sort > services_main.txt
|
||||||
|
yq '.services | keys | .[]' docker-compose-head.yml | sort > services_head.txt
|
||||||
|
|
||||||
|
echo "Creating list of modified services..."
|
||||||
|
touch service_changes.txt
|
||||||
|
|
||||||
|
comm -13 services_main.txt services_head.txt | while read service; do
|
||||||
|
echo "$service: added" >> service_changes.txt
|
||||||
|
done
|
||||||
|
|
||||||
|
comm -12 services_main.txt services_head.txt | while read service; do
|
||||||
|
yq ".services[\"$service\"]" docker-compose-main.yml > tmp_main.yml
|
||||||
|
yq ".services[\"$service\"]" docker-compose-head.yml > tmp_head.yml
|
||||||
|
if ! diff -q tmp_main.yml tmp_head.yml > /dev/null; then
|
||||||
|
echo "$service: modified" >> service_changes.txt
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Detected service changes:"
|
||||||
|
cat service_changes.txt
|
||||||
|
|
||||||
|
mod_svcs=$(cut -d':' -f1 service_changes.txt | sort | uniq | tr '\n' ' ' | sed 's/ *$//')
|
||||||
|
echo "docker_svc_list<<EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "$mod_svcs" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: List of Services for (Re)Deployment
|
||||||
|
run: |
|
||||||
|
echo -e "${{ steps.detect_services.outputs.docker_svc_list }}"
|
||||||
|
|
||||||
|
docker-compose-dry-run:
|
||||||
|
name: Docker Compose Dry Run
|
||||||
|
needs: [generate-service-list]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
VAULT_ADDR: ${{ secrets.TREZ_VAULT_ADDR }}
|
||||||
|
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
||||||
|
VAULT_NAMESPACE: ""
|
||||||
|
RIKKU_REGISTRY_PASSWORD: ${{ secrets.BOT_GITEA_PASSWORD }}
|
||||||
|
DOCKER_SVC_LIST: ${{ needs.generate-service-list.outputs.svc_deploy_list }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USER }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ secrets.GHCR_USER }}
|
||||||
|
password: ${{ secrets.GHCR_LOGIN_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Private Gitea Registry
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
registry: git.trez.wtf
|
||||||
|
username: ${{ secrets.BOT_GITEA_USER }}
|
||||||
|
password: ${{ secrets.BOT_GITEA_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: "${{ secrets.RUNNER_GOTIFY_URL }}"
|
||||||
|
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||||
|
notification_title: "GITEA: Docker Compose Dry Run @ Rikku"
|
||||||
|
notification_message: "Starting Docker Compose dry run..."
|
||||||
|
|
||||||
|
- name: Generate .env from Hashicorp Vault
|
||||||
|
uses: https://git.trez.wtf/Trez/hc-vault-env@main
|
||||||
|
with:
|
||||||
|
HC_VAULT_VERSION: ${{ env.HC_VAULT_VERSION }}
|
||||||
|
HC_VAULT_ADDR: ${{ secrets.TREZ_VAULT_ADDR }}
|
||||||
|
HC_VAULT_USERNAME: ${{ secrets.VAULT_GITEA_USER }}
|
||||||
|
HC_VAULT_PASSWORD: ${{ secrets.VAULT_GITEA_PASSWORD }}
|
||||||
|
HC_VAULT_SECRETS_PATH: rikku-docker/env
|
||||||
|
|
||||||
|
- name: Pre-pull/build service images in parallel
|
||||||
|
uses: https://git.trez.wtf/Trez/docker-select-image-pull@main
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
services: ${{ env.DOCKER_SVC_LIST }}
|
||||||
|
|
||||||
|
- name: Docker Compose Dry Run
|
||||||
|
uses: cssnr/stack-deploy-action@d58b92bcd776afc57ef12f55bafff71200fd218e # v1.4.0
|
||||||
|
with:
|
||||||
|
mode: compose
|
||||||
|
file: docker-compose.yml
|
||||||
|
name: "rikku"
|
||||||
|
host: 192.168.1.249
|
||||||
|
user: pi
|
||||||
|
ssh_key: ${{ secrets.RUNNER_SSH_PRIVATE_KEY }}
|
||||||
|
args: --remove-orphans -d --dry-run ${{ needs.generate-service-list.outputs.svc_deploy_list }}
|
||||||
|
env_file: ".env"
|
||||||
|
summary: true
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: "${{ secrets.RUNNER_GOTIFY_URL }}"
|
||||||
|
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||||
|
notification_title: "GITEA: Docker Compose Dry Run @ Rikku"
|
||||||
|
notification_message: "Docker Compose dry run completed successfully."
|
||||||
|
|
||||||
|
pr-merge:
|
||||||
|
name: PR Merge
|
||||||
|
needs:
|
||||||
|
[
|
||||||
|
generate-service-list,
|
||||||
|
docker-compose-dry-run,
|
||||||
|
regenerate-readme-modified-services,
|
||||||
|
]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
|
||||||
|
- name: Cache tea CLI
|
||||||
|
id: cache-tea
|
||||||
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
||||||
|
with:
|
||||||
|
path: /opt/hostedtoolcache/tea/${{ env.TEA_VERSION }}/x64
|
||||||
|
key: tea-${{ runner.os }}-${{ env.TEA_VERSION }}
|
||||||
|
|
||||||
|
- name: Install tea
|
||||||
|
uses: supplypike/setup-bin@8e3f88b4f143d9b5c3497f0fc12d45c83c123787 # v4.0.1
|
||||||
|
with:
|
||||||
|
uri: https://gitea.com/gitea/tea/releases/download/v${{ env.TEA_VERSION }}/tea-${{ env.TEA_VERSION }}-linux-amd64
|
||||||
|
name: tea
|
||||||
|
version: ${{ env.TEA_VERSION }}
|
||||||
|
|
||||||
|
- name: PR Merge
|
||||||
|
id: pr_merge
|
||||||
|
run: |
|
||||||
|
tea login add --name gitea-rinoa --url ${{ secrets.TREZ_GITEA_URL }} --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }}
|
||||||
|
tea login default gitea-rinoa
|
||||||
|
echo "Merging PR..."
|
||||||
|
pr_index=$(tea pr ls --repo ${{ github.repository }} --state open --fields index,title,head,state --output csv | egrep ${{ github.ref_name }} | awk -F"," '{print $1}' | sed -e 's|"||g')
|
||||||
|
tea pr m --repo ${{ github.repository }} --title "Auto Merge of PR ${pr_index} - ${{ github.ref_name }}" --message "Merged by ${{ github.actor }}" ${pr_index}
|
||||||
|
echo "pr_index=${pr_index}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: "${{ secrets.RUNNER_GOTIFY_URL }}"
|
||||||
|
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||||
|
notification_title: "GITEA: PR Merge Successful"
|
||||||
|
notification_message: "PR #${{ steps.pr_merge.outputs.pr_index }} merged."
|
||||||
|
|
||||||
|
docker-compose-deploy:
|
||||||
|
name: Docker Compose Deployment
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [pr-merge]
|
||||||
|
env:
|
||||||
|
VAULT_ADDR: ${{ secrets.TREZ_VAULT_ADDR }}
|
||||||
|
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
||||||
|
RIKKU_REGISTRY_PASSWORD: ${{ secrets.BOT_GITEA_PASSWORD }}
|
||||||
|
DOCKER_SVC_LIST: ${{ needs.generate-service-list.outputs.svc_deploy_list }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
with:
|
||||||
|
ref: main
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USER }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ secrets.GHCR_USER }}
|
||||||
|
password: ${{ secrets.GHCR_LOGIN_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Private Gitea Registry
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
registry: git.trez.wtf
|
||||||
|
username: ${{ secrets.BOT_GITEA_USER }}
|
||||||
|
password: ${{ secrets.BOT_GITEA_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: "${{ secrets.RUNNER_GOTIFY_URL }}"
|
||||||
|
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||||
|
notification_title: "GITEA: Docker Compose Deployment @ Rikku"
|
||||||
|
notification_message: "Starting Docker Compose run..."
|
||||||
|
|
||||||
|
- name: Generate .env from Hashicorp Vault
|
||||||
|
uses: https://git.trez.wtf/Trez/hc-vault-env@main
|
||||||
|
with:
|
||||||
|
HC_VAULT_VERSION: ${{ env.HC_VAULT_VERSION }}
|
||||||
|
HC_VAULT_ADDR: ${{ secrets.TREZ_VAULT_ADDR }}
|
||||||
|
HC_VAULT_USERNAME: ${{ secrets.VAULT_GITEA_USER }}
|
||||||
|
HC_VAULT_PASSWORD: ${{ secrets.VAULT_GITEA_PASSWORD }}
|
||||||
|
HC_VAULT_SECRETS_PATH: rikku-docker/env
|
||||||
|
|
||||||
|
- name: Docker Compose Deployment
|
||||||
|
uses: cssnr/stack-deploy-action@d58b92bcd776afc57ef12f55bafff71200fd218e # v1.4.0
|
||||||
|
with:
|
||||||
|
mode: compose
|
||||||
|
file: docker-compose.yml
|
||||||
|
name: "rikku"
|
||||||
|
host: 192.168.1.249
|
||||||
|
user: pi
|
||||||
|
ssh_key: ${{ secrets.RUNNER_SSH_PRIVATE_KEY }}
|
||||||
|
args: --remove-orphans -d ${{ needs.generate-service-list.outputs.svc_deploy_list }}
|
||||||
|
env_file: ".env"
|
||||||
|
summary: true
|
||||||
|
|
||||||
|
- name: Docker Compose Healthcheck
|
||||||
|
uses: jaracogmbh/docker-compose-health-check-action@973fbdccf7c8e396b652d3501984c8e530a9fa80 # v1.0.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
max-retries: 30
|
||||||
|
retry-interval: 10
|
||||||
|
compose-file: "docker-compose.yml"
|
||||||
|
skip-exited: "true"
|
||||||
|
skip-no-healthcheck: "true"
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: "${{ secrets.RUNNER_GOTIFY_URL }}"
|
||||||
|
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||||
|
notification_title: "GITEA: Docker Compose Deployment @ Rikku"
|
||||||
|
notification_message: "Deployment completed successfully."
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
name: Renovate PR Deployment
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "**/docker-compose.yml"
|
||||||
|
|
||||||
|
env:
|
||||||
|
HC_VAULT_VERSION: "1.20.4"
|
||||||
|
VAULT_ADDR: ${{ secrets.TREZ_VAULT_ADDR }}
|
||||||
|
VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Renovate PR Deployment
|
||||||
|
if: |
|
||||||
|
github.event.pull_request.merged == true &&
|
||||||
|
github.event.pull_request.user.login == 'renovate-bot'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Save docker-compose.yml before merge (old)
|
||||||
|
run: |
|
||||||
|
git fetch origin main
|
||||||
|
if git ls-tree -r origin/main^1 --name-only | grep -q '^docker-compose.yml$'; then
|
||||||
|
git show origin/main^1:docker-compose.yml > docker-compose-old.yml
|
||||||
|
else
|
||||||
|
echo "services: {}" > docker-compose-old.yml
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Save docker-compose.yml after merge (new)
|
||||||
|
run: |
|
||||||
|
git show origin/main:docker-compose.yml > docker-compose-new.yml
|
||||||
|
|
||||||
|
- name: Detect services with image tag/digest changes
|
||||||
|
id: detect_services
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo "Flattening docker-compose files..."
|
||||||
|
yq eval '... comments=""' docker-compose-old.yml > docker-compose-old-flat.yml
|
||||||
|
yq eval '... comments=""' docker-compose-new.yml > docker-compose-new-flat.yml
|
||||||
|
|
||||||
|
echo "Getting service names..."
|
||||||
|
yq eval '.services | keys | .[]' docker-compose-old-flat.yml | sort > services_old.txt
|
||||||
|
yq eval '.services | keys | .[]' docker-compose-new-flat.yml | sort > services_new.txt
|
||||||
|
|
||||||
|
echo "Checking for image changes..."
|
||||||
|
: > service_changes.txt
|
||||||
|
|
||||||
|
comm -12 services_old.txt services_new.txt | while read service; do
|
||||||
|
old_image=$(yq eval-all --yaml-fix-merge-anchor-to-spec=true ".services[\"$service\"].image // \"\"" docker-compose-old-flat.yml)
|
||||||
|
new_image=$(yq eval-all --yaml-fix-merge-anchor-to-spec=true ".services[\"$service\"].image // \"\"" docker-compose-new-flat.yml)
|
||||||
|
|
||||||
|
if [ "$old_image" != "$new_image" ]; then
|
||||||
|
echo "$service" >> service_changes.txt
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Detected services with changed images:"
|
||||||
|
cat service_changes.txt || true
|
||||||
|
|
||||||
|
# Prepare multiline output for GitHub Actions
|
||||||
|
echo "docker_svc_list<<EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
sort -u service_changes.txt >> "$GITHUB_OUTPUT"
|
||||||
|
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Stop if no image changes
|
||||||
|
if: steps.detect_services.outputs.docker_svc_list == ''
|
||||||
|
run: |
|
||||||
|
echo "No image tag/digest changes detected. Exiting."
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USER }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ secrets.GHCR_USER }}
|
||||||
|
password: ${{ secrets.GHCR_LOGIN_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Private Gitea Registry
|
||||||
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
registry: git.trez.wtf
|
||||||
|
username: ${{ secrets.BOT_GITEA_USER }}
|
||||||
|
password: ${{ secrets.BOT_GITEA_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: "${{ secrets.RUNNER_GOTIFY_URL }}"
|
||||||
|
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||||
|
notification_title: "GITEA: [RENOVATE] Docker Compose Deployment @ Rikku"
|
||||||
|
notification_message: "Starting Docker Compose run..."
|
||||||
|
|
||||||
|
- name: Generate .env from Hashicorp Vault
|
||||||
|
uses: https://git.trez.wtf/Trez/hc-vault-env@main
|
||||||
|
with:
|
||||||
|
HC_VAULT_VERSION: ${{ env.HC_VAULT_VERSION }}
|
||||||
|
HC_VAULT_ADDR: ${{ secrets.TREZ_VAULT_ADDR }}
|
||||||
|
HC_VAULT_USERNAME: ${{ secrets.VAULT_GITEA_USER }}
|
||||||
|
HC_VAULT_PASSWORD: ${{ secrets.VAULT_GITEA_PASSWORD }}
|
||||||
|
HC_VAULT_SECRETS_PATH: rikku-docker/env
|
||||||
|
|
||||||
|
- name: Docker Compose Deployment
|
||||||
|
uses: cssnr/stack-deploy-action@d58b92bcd776afc57ef12f55bafff71200fd218e # v1.4.0
|
||||||
|
with:
|
||||||
|
mode: compose
|
||||||
|
file: docker-compose.yml
|
||||||
|
name: "rikku"
|
||||||
|
host: 192.168.1.249
|
||||||
|
user: pi
|
||||||
|
ssh_key: ${{ secrets.RUNNER_SSH_PRIVATE_KEY }}
|
||||||
|
args: --remove-orphans -d ${{ needs.generate-service-list.outputs.svc_deploy_list }}
|
||||||
|
env_file: ".env"
|
||||||
|
summary: true
|
||||||
|
|
||||||
|
- name: Docker Compose Healthcheck
|
||||||
|
uses: jaracogmbh/docker-compose-health-check-action@973fbdccf7c8e396b652d3501984c8e530a9fa80 # v1.0.0
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://192.168.1.249:2375
|
||||||
|
with:
|
||||||
|
max-retries: 30
|
||||||
|
retry-interval: 10
|
||||||
|
compose-file: "docker-compose.yml"
|
||||||
|
skip-exited: "true"
|
||||||
|
skip-no-healthcheck: "true"
|
||||||
|
|
||||||
|
- name: Gotify Notification
|
||||||
|
uses: eikendev/gotify-action@master
|
||||||
|
with:
|
||||||
|
gotify_api_base: "${{ secrets.RUNNER_GOTIFY_URL }}"
|
||||||
|
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||||
|
notification_title: "GITEA: [RENOVATE] Docker Compose Deployment @ Rikku"
|
||||||
|
notification_message: "Deployment completed successfully."
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
name: Renovate
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0/30 * * * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
RENOVATE_VERSION: "41.138.4"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
renovate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
|
||||||
|
- name: Renovate Run
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://dockerproxy:2375
|
||||||
|
run: |
|
||||||
|
docker run --rm \
|
||||||
|
-e RENOVATE_PLATFORM=gitea \
|
||||||
|
-e RENOVATE_ENDPOINT=https://git.trez.wtf/api/v1 \
|
||||||
|
-e RENOVATE_TOKEN=${{ secrets.RENOVATE_BOT_TOKEN }} \
|
||||||
|
-e LOG_LEVEL=${{ vars.RENOVATE_LOG_LEVEL }} \
|
||||||
|
-e RENOVATE_GITHUB_COM_TOKEN=${{ secrets.RENOVATE_GITHUB_TOKEN }} \
|
||||||
|
-e RENOVATE_CONFIG_FILE=renovate.json \
|
||||||
|
-e RENOVATE_REPOSITORIES=trez/rikku-home-assistant \
|
||||||
|
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
|
||||||
|
-w ${GITHUB_WORKSPACE} \
|
||||||
|
renovate/renovate:${{ env.RENOVATE_VERSION }}-full
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
name: ultima
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
name: ultima_default
|
||||||
|
services:
|
||||||
|
beszel-agent:
|
||||||
|
container_name: beszel-agent
|
||||||
|
environment:
|
||||||
|
PORT: 45876
|
||||||
|
# Do not remove quotes around the key
|
||||||
|
KEY: "${BESZEL_RINOA_AGENT_KEY}"
|
||||||
|
TOKEN: ${BESZEL_ULTIMA_TOKEN}
|
||||||
|
HUB_URL: http://192.168.1.254:22220
|
||||||
|
expose:
|
||||||
|
- 45876
|
||||||
|
image: henrygd/beszel-agent:0.13.1@sha256:17fe8c1bf093bc65fba8808093de6b3a3a8ed915bc59eef9815ea42c889aab6a
|
||||||
|
network_mode: host
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ${ULTIMA_DOCKER_DIR}/beszel-agent:/var/lib/beszel-agent
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
docker-socket-proxy:
|
||||||
|
container_name: dockerproxy
|
||||||
|
environment:
|
||||||
|
AUTH: 1
|
||||||
|
BUILD: 1
|
||||||
|
COMMIT: 1
|
||||||
|
CONFIGS: 1
|
||||||
|
CONTAINERS: 1
|
||||||
|
DISTRIBUTION: 1
|
||||||
|
EVENTS: 1
|
||||||
|
EXEC: 1
|
||||||
|
GPRC: 1
|
||||||
|
IMAGES: 1
|
||||||
|
INFO: 1
|
||||||
|
NETWORKS: 1
|
||||||
|
NODES: 1
|
||||||
|
POST: 1
|
||||||
|
PLUGINS: 1
|
||||||
|
SERVICES: 1
|
||||||
|
SESSION: 1
|
||||||
|
SYSTEM: 1
|
||||||
|
TASKS: 1
|
||||||
|
VOLUMES: 1
|
||||||
|
LOG_LEVEL: debug
|
||||||
|
image: ghcr.io/tecnativa/docker-socket-proxy:latest@sha256:3400c429c5f9e1b21d62130fb93b16e2e772d4fb7695bd52fc2b743800b9fe9e
|
||||||
|
ports:
|
||||||
|
- 2375:2375
|
||||||
|
privileged: true
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
meilisearch:
|
||||||
|
container_name: meilisearch
|
||||||
|
environment:
|
||||||
|
MEILI_HOST: http://meilisearch:7700
|
||||||
|
MEILI_NO_ANALYTICS: true
|
||||||
|
MEILI_MASTER_KEY: ${MEILISEARCH_MASTER_KEY}
|
||||||
|
image: getmeili/meilisearch:v1.22@sha256:14ef9f50add5243fb8dfd13b60df82a76f3c653f0f03b8fee7b5464ab2f0f303
|
||||||
|
ports:
|
||||||
|
- 7700:7700
|
||||||
|
restart: always
|
||||||
|
user: ${PUID}:${PGID}
|
||||||
|
volumes:
|
||||||
|
- ${DOCKER_VOLUME_CONFIG}/meilisearch:/meili_data
|
||||||
|
ollama:
|
||||||
|
container_name: ollama
|
||||||
|
image: ollama/ollama:0.12.3@sha256:c622a7adec67cf5bd7fe1802b7e26aa583a955a54e91d132889301f50c3e0bd0
|
||||||
|
ports:
|
||||||
|
- 11434:11434
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ollama:/root/.ollama
|
||||||
|
portainer-agent:
|
||||||
|
container_name: portainer_agent
|
||||||
|
image: portainer/agent:latest@sha256:a454c023f4b79ae308e372e5a4ab0d37961d6d8ad88fe5945544435203ded198
|
||||||
|
volumes:
|
||||||
|
- /:/host
|
||||||
|
- /var/lib/docker/volumes:/var/lib/docker/volumes
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 9001:9001
|
||||||
|
stable-diffusion-webui:
|
||||||
|
container_name: stable-diffusion-webui
|
||||||
|
image: ghcr.io/neggles/sd-webui-docker:latest@sha256:1795fe796e1dad0d8d3baa9ef7c38a255b69c0878b76869feecc617bfd015e53
|
||||||
|
environment:
|
||||||
|
CLI_ARGS: "--api --use-cpu all --precision full --no-half --skip-torch-cuda-test --ckpt /empty.pt --do-not-download-clip --disable-nan-check --disable-opt-split-attention" # will have to be changed for new hardware
|
||||||
|
PYTHONUNBUFFERED: "1"
|
||||||
|
TERM: "vt100"
|
||||||
|
SD_WEBUI_VARIANT: "default"
|
||||||
|
ports:
|
||||||
|
- 7860:7860
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ${DOCKER_VOLUME_CONFIG}/stable-diffusion-webui/data:/data
|
||||||
|
- ${DOCKER_VOLUME_CONFIG}/stable-diffusion-webui/output:/output
|
||||||
|
volumes:
|
||||||
|
ollama:
|
||||||
|
name: ollama
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": ["local>trez/renovate-config"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user