first commit
This commit is contained in:
34
system/backup.yaml
Normal file
34
system/backup.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- set:
|
||||
variables:
|
||||
- varName: "volume"
|
||||
value: "/Volumes/Backup-1"
|
||||
|
||||
- set:
|
||||
variables:
|
||||
- varName: "volume"
|
||||
value: "/Volumes/Backup-2"
|
||||
when: $(dirExists("/Volumes/Backup-2"))
|
||||
|
||||
- execute:
|
||||
description: "Start backup rp02"
|
||||
exec: "rsync"
|
||||
timeout: 6h
|
||||
dir: "$(volume)"
|
||||
args:
|
||||
- "-a"
|
||||
- "-v"
|
||||
- "root@rp02.localnet:/backup/*"
|
||||
- "."
|
||||
|
||||
- execute:
|
||||
description: "Start backup rp03"
|
||||
exec: "rsync"
|
||||
timeout: 6h
|
||||
dir: "$(volume)"
|
||||
args:
|
||||
- "-a"
|
||||
- "-v"
|
||||
- "root@rp03.localnet:/backup/*"
|
||||
- "."
|
||||
5
system/backup_commands.yaml
Normal file
5
system/backup_commands.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-commands-schema.json
|
||||
commands:
|
||||
- name: "backup"
|
||||
description: "Start system backup"
|
||||
script: "@(system)/backup.yaml"
|
||||
11
system/check-git-repository.yaml
Normal file
11
system/check-git-repository.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- execute:
|
||||
description: "Git Check For Changes"
|
||||
exec: "git"
|
||||
dir: $(path)
|
||||
args:
|
||||
- "status"
|
||||
- "--porcelain"
|
||||
response:
|
||||
name: "gitChanges"
|
||||
9
system/repos.yaml
Normal file
9
system/repos.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- call:
|
||||
script: "@(system)/repos_actions.yaml"
|
||||
args:
|
||||
path: $(target)
|
||||
loop:
|
||||
values: $(dirlist(".", dirlistWithDirsOnly()))
|
||||
as: target
|
||||
47
system/repos_actions.yaml
Normal file
47
system/repos_actions.yaml
Normal file
@@ -0,0 +1,47 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- print:
|
||||
format: "Path: $(path)"
|
||||
|
||||
- return:
|
||||
description: "Not a git repository"
|
||||
when: $(!dirExists(format("%s/.git",path)))
|
||||
|
||||
- execute:
|
||||
description: "Pull git repository"
|
||||
exec: "git"
|
||||
dir: $(path)
|
||||
args:
|
||||
- "pull"
|
||||
|
||||
- execute:
|
||||
description: "Check repository"
|
||||
exec: "git"
|
||||
dir: $(path)
|
||||
args:
|
||||
- "remote"
|
||||
- "-v"
|
||||
matchers:
|
||||
- name: "Check for jesof repository"
|
||||
expression: "^origin.*https://git.jesof.ch/"
|
||||
onError: continue
|
||||
|
||||
- return:
|
||||
description: "Not jesof repository"
|
||||
when: $(lastError() != nil)
|
||||
|
||||
- execute:
|
||||
description: "Push all"
|
||||
exec: "git"
|
||||
dir: $(path)
|
||||
args:
|
||||
- "push"
|
||||
- "--all"
|
||||
|
||||
- execute:
|
||||
description: "Push tags"
|
||||
exec: "git"
|
||||
dir: $(path)
|
||||
args:
|
||||
- "push"
|
||||
- "--tags"
|
||||
5
system/repos_commands.yaml
Normal file
5
system/repos_commands.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-commands-schema.json
|
||||
commands:
|
||||
- name: "repos"
|
||||
description: "Synchronize git repos"
|
||||
script: "@(system)/repos.yaml"
|
||||
28
system/upgrade.yaml
Normal file
28
system/upgrade.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- call:
|
||||
description: 'Upgrade project on "$(target)"'
|
||||
script: "@(system)/upgrade_project.yaml"
|
||||
args:
|
||||
path: $(target)
|
||||
loop:
|
||||
values: $(dirlist("@(projects)", dirlistWithDirsOnly()))
|
||||
as: target
|
||||
|
||||
- call:
|
||||
description: 'Upgrade github application "$(settings.name)"'
|
||||
script: "@(system)/upgrade_github_application.yaml"
|
||||
args:
|
||||
settings: $(settings)
|
||||
loop:
|
||||
values: $(github)
|
||||
as: settings
|
||||
|
||||
- call:
|
||||
description: 'Upgrade orchestra application "$(settings.role)"'
|
||||
script: "@(system)/upgrade_orchestra_application.yaml"
|
||||
args:
|
||||
settings: $(settings)
|
||||
loop:
|
||||
values: $(orchestra)
|
||||
as: settings
|
||||
19
system/upgrade_applications.yaml
Normal file
19
system/upgrade_applications.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- call:
|
||||
description: 'Upgrade github application "$(settings.name)"'
|
||||
script: "@(system)/upgrade_github_application.yaml"
|
||||
args:
|
||||
settings: $(settings)
|
||||
loop:
|
||||
values: $(github)
|
||||
as: settings
|
||||
|
||||
- call:
|
||||
description: 'Upgrade orchestra application "$(settings.role)"'
|
||||
script: "@(system)/upgrade_orchestra_application.yaml"
|
||||
args:
|
||||
settings: $(settings)
|
||||
loop:
|
||||
values: $(orchestra)
|
||||
as: settings
|
||||
56
system/upgrade_applications_config.yaml
Normal file
56
system/upgrade_applications_config.yaml
Normal file
@@ -0,0 +1,56 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-config-schema.json
|
||||
variables:
|
||||
tag_name: ""
|
||||
github:
|
||||
- name: "alertmanager"
|
||||
api_url: "https://api.github.com/repos/prometheus/alertmanager/releases/latest"
|
||||
search: "linux-arm64.tar.gz$"
|
||||
bin_file: ""
|
||||
os_family: "linux"
|
||||
architecture: "arm64"
|
||||
|
||||
- name: "coredns"
|
||||
api_url: "https://api.github.com/repos/coredns/coredns/releases/latest"
|
||||
search: "linux_arm64.tgz$"
|
||||
bin_file: ""
|
||||
os_family: "linux"
|
||||
architecture: "arm64"
|
||||
|
||||
- name: "nodeexporter"
|
||||
api_url: "https://api.github.com/repos/prometheus/node_exporter/releases/latest"
|
||||
search: "linux-arm64.tar.gz$"
|
||||
bin_file: ""
|
||||
os_family: "linux"
|
||||
architecture: "arm64"
|
||||
|
||||
- name: "prometheus"
|
||||
api_url: "https://api.github.com/repos/prometheus/prometheus/releases/latest"
|
||||
search: "linux-arm64.tar.gz$"
|
||||
bin_file: ""
|
||||
os_family: "linux"
|
||||
architecture: "arm64"
|
||||
|
||||
- name: "traefik"
|
||||
api_url: "https://api.github.com/repos/traefik/traefik/releases/latest"
|
||||
search: "linux_arm64.tar.gz$"
|
||||
bin_file: ""
|
||||
os_family: "linux"
|
||||
architecture: "arm64"
|
||||
|
||||
- name: "ttyd"
|
||||
api_url: "https://api.github.com/repos/tsl0922/ttyd/releases/latest"
|
||||
search: "ttyd.arm$"
|
||||
bin_file: "ttyd"
|
||||
os_family: "linux"
|
||||
architecture: "arm64"
|
||||
|
||||
- name: "git"
|
||||
api_url: "https://api.github.com/repos/go-gitea/gitea/releases/latest"
|
||||
health_url: "https://git.jesof.ch/api/healthz"
|
||||
search: "linux-arm64$"
|
||||
bin_file: "gitea"
|
||||
os_family: "linux"
|
||||
architecture: "arm64"
|
||||
|
||||
orchestra:
|
||||
- role: "minio"
|
||||
3
system/upgrade_applications_version.yaml
Normal file
3
system/upgrade_applications_version.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
# Orchestra version variables
|
||||
|
||||
app_version: "{{.version}}"
|
||||
17
system/upgrade_commands.yaml
Normal file
17
system/upgrade_commands.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-commands-schema.json
|
||||
commands:
|
||||
- name: "upgrade"
|
||||
description: "Upgrade projects and applications"
|
||||
script: "@(system)/upgrade.yaml"
|
||||
configs:
|
||||
- "@(system)/upgrade_applications_config.yaml"
|
||||
|
||||
- name: "upgrade-projects"
|
||||
description: "Upgrade projects"
|
||||
script: "@(system)/upgrade_projects.yaml"
|
||||
|
||||
- name: "upgrade-applications"
|
||||
description: "Upgrade applications"
|
||||
script: "@(system)/upgrade_applications.yaml"
|
||||
configs:
|
||||
- "@(system)/upgrade_applications_config.yaml"
|
||||
148
system/upgrade_github_application.yaml
Normal file
148
system/upgrade_github_application.yaml
Normal file
@@ -0,0 +1,148 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- execute:
|
||||
description: "Get URL for latest version"
|
||||
exec: "curl"
|
||||
hideStdout: true
|
||||
args:
|
||||
- "-s"
|
||||
- "$(settings.api_url)"
|
||||
parsers:
|
||||
- name: "Get Download URL"
|
||||
parser: "jq"
|
||||
expression: '.assets[] | select(.name | test("$(settings.search)")) | .browser_download_url'
|
||||
variables:
|
||||
- download_url
|
||||
- name: "Get Tag Name"
|
||||
parser: "jq"
|
||||
expression: ".tag_name"
|
||||
variables:
|
||||
- tag_name
|
||||
|
||||
- set:
|
||||
description: "Set variables"
|
||||
variables:
|
||||
- varName: "new_version"
|
||||
value: '$(trimPrefix(tag_name,"v"))'
|
||||
- varName: "archive_file"
|
||||
value: '$(settings.name)_$(trimPrefix(tag_name,"v"))_$(settings.os_family)-$(settings.architecture).tar.gz'
|
||||
- varName: "sha256_file"
|
||||
value: '$(settings.name)_$(trimPrefix(tag_name,"v"))_$(settings.os_family)-$(settings.architecture).sha256'
|
||||
|
||||
- loadVariables:
|
||||
description: "Load variables for $(settings.name)"
|
||||
url: "@(provisioning)/roles/$(settings.name)/vars/version.yaml"
|
||||
|
||||
- return:
|
||||
description: "Latest version installed $(new_version)"
|
||||
when: $(new_version == app_version)
|
||||
|
||||
- execute:
|
||||
description: "Download application from $(download_url)"
|
||||
exec: "curl"
|
||||
args:
|
||||
- "-L"
|
||||
- "--silent"
|
||||
- "-o"
|
||||
- "$(tempdir())/$(archive_file)"
|
||||
- "$(download_url)"
|
||||
|
||||
- execute:
|
||||
exec: "mv"
|
||||
args:
|
||||
- "$(tempdir())/$(archive_file)"
|
||||
- "$(tempdir())/$(settings.bin_file)"
|
||||
when: '$(settings.bin_file != "")'
|
||||
|
||||
- tar:
|
||||
source: "$(tempdir())/$(settings.bin_file)"
|
||||
archiveFile: "$(tempdir())/$(archive_file)"
|
||||
when: '$(settings.bin_file != "")'
|
||||
|
||||
- sha256:
|
||||
description: "Calculate checksum"
|
||||
file: "$(tempdir())/$(archive_file)"
|
||||
varName: "checkSum"
|
||||
|
||||
- write:
|
||||
description: "Save checksum file $(sha256_file) "
|
||||
file: "$(tempdir())/$(sha256_file)"
|
||||
format: "%s"
|
||||
args:
|
||||
- "$(checkSum)"
|
||||
|
||||
- execute:
|
||||
description: "Upload application $(archive_file)"
|
||||
exec: "mc"
|
||||
args:
|
||||
- "cp"
|
||||
- "--quiet"
|
||||
- "$(tempdir())/$(archive_file)"
|
||||
- "jesof/binaries/$(archive_file)"
|
||||
|
||||
- execute:
|
||||
description: "Upload checksum $(sha256_file)"
|
||||
exec: "mc"
|
||||
args:
|
||||
- "cp"
|
||||
- "--quiet"
|
||||
- "$(tempdir())/$(sha256_file)"
|
||||
- "jesof/binaries/$(sha256_file)"
|
||||
|
||||
- call:
|
||||
script: "@(system)/check-git-repository.yaml"
|
||||
args:
|
||||
path: "@(provisioning)"
|
||||
returns:
|
||||
- gitChanges
|
||||
|
||||
- throw:
|
||||
description: "Check if repository is clean"
|
||||
message: 'Git repository "@(provisioning)" not clean, please commit changes ...'
|
||||
when: $(gitChanges != "")
|
||||
|
||||
- template:
|
||||
templates:
|
||||
- "@(system)/upgrade_applications_version.yaml"
|
||||
target: "@(provisioning)/roles/$(settings.name)/vars/version.yaml"
|
||||
args:
|
||||
version: "$(new_version)"
|
||||
|
||||
- execute:
|
||||
description: "Deploy $(settings.name)"
|
||||
exec: "orchestra"
|
||||
dir: "@(provisioning)"
|
||||
args:
|
||||
- "-roles"
|
||||
- "$(settings.name)"
|
||||
|
||||
- execute:
|
||||
description: "Check health endpoint"
|
||||
exec: "curl"
|
||||
args:
|
||||
- "--retry"
|
||||
- "10"
|
||||
- "--silent"
|
||||
- $(settings.health_url)
|
||||
when: $(has("settings.health_url"))
|
||||
|
||||
- execute:
|
||||
dir: "@(provisioning)"
|
||||
exec: "git"
|
||||
args:
|
||||
- "add"
|
||||
- "."
|
||||
|
||||
- execute:
|
||||
dir: "@(provisioning)"
|
||||
exec: "git"
|
||||
args:
|
||||
- "commit"
|
||||
- "-m"
|
||||
- "New $(settings.name) release"
|
||||
|
||||
- execute:
|
||||
dir: "@(provisioning)"
|
||||
exec: "git"
|
||||
args:
|
||||
- "push"
|
||||
21
system/upgrade_orchestra_application.yaml
Normal file
21
system/upgrade_orchestra_application.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- execute:
|
||||
description: "Deploy $(settings.role)"
|
||||
exec: "orchestra"
|
||||
dir: "@(provisioning)"
|
||||
args:
|
||||
- "-roles"
|
||||
- "$(settings.role)"
|
||||
- "-tags"
|
||||
- "update"
|
||||
|
||||
- execute:
|
||||
description: "Check health endpoint"
|
||||
exec: "curl"
|
||||
args:
|
||||
- "--retry"
|
||||
- "10"
|
||||
- "--silent"
|
||||
- $(settings.health_url)
|
||||
when: $(has("settings.health_url"))
|
||||
78
system/upgrade_project.yaml
Normal file
78
system/upgrade_project.yaml
Normal file
@@ -0,0 +1,78 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- loadVariables:
|
||||
url: $(path)/.mstr.yaml
|
||||
path: "variables"
|
||||
|
||||
- return:
|
||||
when: $(!has("orchestra"))
|
||||
|
||||
- return:
|
||||
when: $(orchestra != "deploy")
|
||||
|
||||
- call:
|
||||
script: "@(system)/check-git-repository.yaml"
|
||||
args:
|
||||
path: $(path)
|
||||
returns:
|
||||
- gitChanges
|
||||
|
||||
- throw:
|
||||
description: "Check if repository is clean"
|
||||
message: 'Git repository "$(path)" not clean, please commit changes ...'
|
||||
when: $(gitChanges != "")
|
||||
|
||||
- execute:
|
||||
description: "Update application $(path)"
|
||||
exec: "mstr"
|
||||
dir: "$(path)"
|
||||
args:
|
||||
- "update"
|
||||
|
||||
- call:
|
||||
script: "@(system)/check-git-repository.yaml"
|
||||
args:
|
||||
path: $(path)
|
||||
returns:
|
||||
- gitChanges
|
||||
|
||||
- return:
|
||||
description: 'Git repository "$(path)" clean, continue ...'
|
||||
when: $(gitChanges == "")
|
||||
|
||||
- execute:
|
||||
description: "Update application $(path)"
|
||||
exec: "mstr"
|
||||
dir: "$(path)"
|
||||
args:
|
||||
- "build"
|
||||
|
||||
- execute:
|
||||
dir: "$(path)"
|
||||
exec: "git"
|
||||
args:
|
||||
- "add"
|
||||
- "."
|
||||
|
||||
- execute:
|
||||
dir: "$(path)"
|
||||
exec: "git"
|
||||
args:
|
||||
- "commit"
|
||||
- "-m"
|
||||
- "Dependency upgrades"
|
||||
|
||||
- execute:
|
||||
dir: "$(path)"
|
||||
exec: "git"
|
||||
args:
|
||||
- "push"
|
||||
|
||||
- execute:
|
||||
description: "Release application $(path)"
|
||||
dir: "$(path)"
|
||||
exec: "mstr"
|
||||
args:
|
||||
- "release"
|
||||
- "minor"
|
||||
- "--deploy"
|
||||
10
system/upgrade_projects.yaml
Normal file
10
system/upgrade_projects.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- call:
|
||||
description: 'Upgrade project on "$(target)"'
|
||||
script: "@(system)/upgrade_project.yaml"
|
||||
args:
|
||||
path: $(target)
|
||||
loop:
|
||||
values: $(dirlist("@(projects)", dirlistWithDirsOnly()))
|
||||
as: target
|
||||
Reference in New Issue
Block a user