mirror of
https://asciireactor.com/otho/stashapp
synced 2024-11-22 01:55:08 +00:00
83 lines
3.3 KiB
YAML
83 lines
3.3 KiB
YAML
|
---
|
||
|
version: '3'
|
||
|
|
||
|
silent: false
|
||
|
|
||
|
vars:
|
||
|
CONFIG_PATHS: |
|
||
|
/zroot/vm/.templates/alpine.conf
|
||
|
SERVICES: "haproxy apache24 nginx plexmediaserver"
|
||
|
SERVICE_PORTS: 80 443 22 32400
|
||
|
command: 'echo $(whoami)@$(hostname -f)'
|
||
|
|
||
|
dotenv:
|
||
|
- .env
|
||
|
env:
|
||
|
GITLAB_PROJECT_ID: '{{ .stashapp_project_id }}'
|
||
|
GITLAB_PROJECT_SLUG: stashapp
|
||
|
|
||
|
tasks:
|
||
|
default:
|
||
|
- task: services
|
||
|
|
||
|
run: ssh -tt "$stashapp_domain" '{{.command}}'
|
||
|
run-root: ssh -qtt "$stashapp_domain" 'su -l root -c "{{.command}}"'
|
||
|
host-run: ssh -tt "$stashbox_domain" '{{.command}}'
|
||
|
host-run-root: ssh -qtt "$stashbox_domain" 'su -l root -c "{{.command}}"'
|
||
|
|
||
|
exec:
|
||
|
- task: run
|
||
|
vars:
|
||
|
command: "{{.CLI_ARGS}}"
|
||
|
exec-root:
|
||
|
- task: run-root
|
||
|
vars:
|
||
|
command: "{{.CLI_ARGS}}"
|
||
|
exec-host:
|
||
|
- task: host-run
|
||
|
vars:
|
||
|
command: "{{.CLI_ARGS}}"
|
||
|
exec-host-root:
|
||
|
- task: host-run-root
|
||
|
vars:
|
||
|
command: "{{.CLI_ARGS}}"
|
||
|
|
||
|
services:
|
||
|
- task: run
|
||
|
vars:
|
||
|
command: docker ps
|
||
|
host-services:
|
||
|
- task: host-run-root
|
||
|
vars:
|
||
|
command: vm list
|
||
|
|
||
|
# Terraform
|
||
|
plan:
|
||
|
- task: tf
|
||
|
vars:
|
||
|
CLI_ARGS: plan
|
||
|
apply:
|
||
|
- task: tf
|
||
|
vars:
|
||
|
CLI_ARGS: apply
|
||
|
tf: source .env; terraform init; terraform {{.CLI_ARGS}}
|
||
|
|
||
|
# Utilities
|
||
|
printenv: source .env; printenv
|
||
|
path-update: echo scp "{{.local_path}}" "$stashapp_domain:{{.remote_path}}"
|
||
|
path-backup: scp "$stashapp_domain:{{.remote_path}}" "./.$(basename {{.remote_path}})-$(date +%s)" || echo "No file found."
|
||
|
path-diff:
|
||
|
- task: path-backup
|
||
|
vars:
|
||
|
remote_path: "{{.remote_path}}"
|
||
|
- diff "$(ls -c .$(basename {{.remote_path}})-*|head -n1)" "$(basename {{.remote_path}})" || [ "$?" == "1" ]
|
||
|
safe-update:
|
||
|
- task: path-backup
|
||
|
vars:
|
||
|
remote_path: "{{.remote_path}}"
|
||
|
- echo scp "$(basename {{.remote_path}})" "$stashapp_domain:{{.remote_path}}"
|
||
|
- task: path-diff
|
||
|
vars:
|
||
|
remote_path: "{{.remote_path}}"
|
||
|
|