Compare commits
120 Commits
v0.6.0
...
55ef8e1733
| Author | SHA1 | Date | |
|---|---|---|---|
| 55ef8e1733 | |||
| 075fc16ec9 | |||
| 0d6a13c1cf | |||
| e57939f858 | |||
| d45b1562fc | |||
| 7fe07f86a9 | |||
| 14c81a00a7 | |||
| 3eced64453 | |||
| c284d928fd | |||
| dd9da9452b | |||
| 11d5121954 | |||
| 66d622b474 | |||
| 47b2aabd9f | |||
| b91cf18b04 | |||
| 305b504ca1 | |||
| 7be2679b91 | |||
| 3c6e3ed914 | |||
| 02bc040e2a | |||
| 9f1f36215a | |||
| ff75f4bbcd | |||
| 5f40713e98 | |||
| cd5f7611a9 | |||
| b542711078 | |||
| 52dbc353e5 | |||
| 6bef0c3e5b | |||
| 4d705d78fb | |||
| 62d47ecfa7 | |||
| 32444ff82e | |||
| a5a7c05640 | |||
| bfb81e11b2 | |||
| fd4c83f9c0 | |||
| fe27c6396a | |||
| c89dde186a | |||
| 18a64de0de | |||
| 99c622b69f | |||
| 95e85e8b45 | |||
| 1a48c7bca5 | |||
| 5d21764ef1 | |||
| c7302f0e17 | |||
| fb1c8ec4fb | |||
| fe9462dac0 | |||
| d8453d1fb0 | |||
| 65c46a1e26 | |||
| f859b5961f | |||
| 25ddd65f25 | |||
| bcba6b2086 | |||
| 753b03861f | |||
| 80a45cd595 | |||
| 551c8ad441 | |||
| 3823b1bf44 | |||
| f777c78aad | |||
| bb693dbb97 | |||
| 7beda281e0 | |||
| 1143d2850b | |||
| 8900bd70a4 | |||
| 6db5f73bc0 | |||
| a163c11129 | |||
| 2b4d191271 | |||
| 417088c32b | |||
| 4fa5efa5b6 | |||
| a0bf51636c | |||
| 684edd7985 | |||
| 3acb20a40f | |||
| 0007c8696a | |||
| cf2baf3601 | |||
| e6b9f8e6e6 | |||
| 2eefc59cf7 | |||
| 98d8b8e8f2 | |||
| 1ad50ebcf8 | |||
| c483a1056f | |||
| 3b9f569310 | |||
| 843be7968b | |||
| d477d850ac | |||
| 8eb3229af7 | |||
| d89a208bbd | |||
| 0d28d6afcf | |||
| 7c42a9a7cd | |||
| 31339fb4d8 | |||
| c642e827f5 | |||
| a328239021 | |||
| 4ee60184bf | |||
| 161ad31577 | |||
| 7c5f4a95da | |||
| 4981acbf9d | |||
| 932d5c380f | |||
| f84d76badf | |||
| 6ee6e10621 | |||
| 127d38c076 | |||
| 0218dee76d | |||
| 67a1eab908 | |||
| c618ca33f8 | |||
| 6e7d912fa2 | |||
| b90d1958b2 | |||
| c187fbb735 | |||
| c3de4386ab | |||
| e20141043c | |||
| 11ec1a98d8 | |||
| 8788d473a5 | |||
| edc669b340 | |||
| 086835453b | |||
| 5d3c265ce9 | |||
| 8c633fd4b2 | |||
| a664edaed7 | |||
| e88773e289 | |||
| 5c2bfcc940 | |||
| aee513f786 | |||
| 6b99cfa196 | |||
| c24e8086e9 | |||
| c12bbe3bee | |||
| 33febd662e | |||
| 5635c1edd0 | |||
| e169778c82 | |||
| c838bfe815 | |||
| e81a5def47 | |||
| 18884c640d | |||
| ee2256bfb2 | |||
| 82d79c520a | |||
| c30ae2ac3e | |||
| fc738597ff | |||
| aebef21eb4 |
0
.changes/0.2.4.md
Normal file → Executable file
0
.changes/0.2.4.md
Normal file → Executable file
0
.changes/header.tpl.md
Normal file → Executable file
0
.changes/header.tpl.md
Normal file → Executable file
1
.changes/unreleased/.gitkeep
Normal file → Executable file
1
.changes/unreleased/.gitkeep
Normal file → Executable file
@@ -0,0 +1 @@
|
|||||||
|
*.yaml
|
||||||
3
.changes/unreleased/Added-20250409-174528.yaml
Executable file
3
.changes/unreleased/Added-20250409-174528.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Added
|
||||||
|
body: 'feat: Package operation `versionCheck` supports regular expressions (see [regexp](https://pkg.go.dev/regexp) package for docs)'
|
||||||
|
time: 2025-04-09T17:45:28.836497149-05:00
|
||||||
3
.changes/unreleased/Added-20250501-110745.yaml
Executable file
3
.changes/unreleased/Added-20250501-110745.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Added
|
||||||
|
body: 'Command lists: added `cmdLists.[name].notify` object'
|
||||||
|
time: 2025-05-01T11:07:45.96164753-05:00
|
||||||
3
.changes/unreleased/Added-20250704-085917.yaml
Executable file
3
.changes/unreleased/Added-20250704-085917.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Added
|
||||||
|
body: Testing setup with Docker
|
||||||
|
time: 2025-07-04T08:59:17.430373451-05:00
|
||||||
3
.changes/unreleased/Added-20250704-102126.yaml
Executable file
3
.changes/unreleased/Added-20250704-102126.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Added
|
||||||
|
body: 'CLI: add global flag --hostsConfig that allows hosts to be dynamic in relation to the main config'
|
||||||
|
time: 2025-07-04T10:21:26.864635558-05:00
|
||||||
3
.changes/unreleased/Added-20250715-202303.yaml
Executable file
3
.changes/unreleased/Added-20250715-202303.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Added
|
||||||
|
body: 'CLI: Exec subcommand `hosts`. See documentation for more details.'
|
||||||
|
time: 2025-07-15T20:23:03.647128713-05:00
|
||||||
3
.changes/unreleased/Added-20250723-220340.yaml
Executable file
3
.changes/unreleased/Added-20250723-220340.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Added
|
||||||
|
body: 'CLI: added `exec hosts` subcommand `list`'
|
||||||
|
time: 2025-07-23T22:03:40.24191927-05:00
|
||||||
3
.changes/unreleased/Changed-20250321-090849.yaml
Executable file
3
.changes/unreleased/Changed-20250321-090849.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Changed
|
||||||
|
body: 'Commands: `host` can now be `localhost` or `127.0.0.1` to run commands locally'
|
||||||
|
time: 2025-03-21T09:08:49.871021144-05:00
|
||||||
3
.changes/unreleased/Changed-20250325-003357.yaml
Executable file
3
.changes/unreleased/Changed-20250325-003357.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Changed
|
||||||
|
body: lists loaded from external files only if no list config present in current file
|
||||||
|
time: 2025-03-25T00:33:57.039431409-05:00
|
||||||
3
.changes/unreleased/Changed-20250407-223020.yaml
Executable file
3
.changes/unreleased/Changed-20250407-223020.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Changed
|
||||||
|
body: "`PackageManager.Parse` renamed to `ParseRemotePackageManagerVersionOutput`. This now returns arrays of PackageManagerCommon.Package and errors."
|
||||||
|
time: 2025-04-07T22:30:20.342177323-05:00
|
||||||
3
.changes/unreleased/Changed-20250418-133440.yaml
Executable file
3
.changes/unreleased/Changed-20250418-133440.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Changed
|
||||||
|
body: 'Internal: refactoring and renaming functions'
|
||||||
|
time: 2025-04-18T13:34:40.842541658-05:00
|
||||||
3
.changes/unreleased/Changed-20250501-110534.yaml
Executable file
3
.changes/unreleased/Changed-20250501-110534.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Changed
|
||||||
|
body: 'Commands: moved output-prefixed keys to the `commands.[name].output` object'
|
||||||
|
time: 2025-05-01T11:05:34.90130087-05:00
|
||||||
3
.changes/unreleased/Changed-20250609-072601.yaml
Executable file
3
.changes/unreleased/Changed-20250609-072601.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Changed
|
||||||
|
body: Change internal method name for better understanding
|
||||||
|
time: 2025-06-09T07:26:01.819927627-05:00
|
||||||
3
.changes/unreleased/Changed-20250709-231919.yaml
Executable file
3
.changes/unreleased/Changed-20250709-231919.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Changed
|
||||||
|
body: Improved error message for remote version package output
|
||||||
|
time: 2025-07-09T23:19:19.431960446-05:00
|
||||||
3
.changes/unreleased/Fixed-20250418-095747.yaml
Executable file
3
.changes/unreleased/Fixed-20250418-095747.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: 'Command Lists: hooks now run correctly when commands finish'
|
||||||
|
time: 2025-04-18T09:57:47.39035092-05:00
|
||||||
3
.changes/unreleased/Fixed-20250424-225711.yaml
Executable file
3
.changes/unreleased/Fixed-20250424-225711.yaml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: Log file passed using `--log-file` correctly used
|
||||||
|
time: 2025-04-24T22:57:11.592829277-05:00
|
||||||
3
.changes/unreleased/Fixed-20251115-173206.yaml
Normal file
3
.changes/unreleased/Fixed-20251115-173206.yaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: Cmd Type `script` now correctly appends arguments
|
||||||
|
time: 2025-11-15T17:32:06.86128885-06:00
|
||||||
16
.changes/v0.10.0.md
Executable file
16
.changes/v0.10.0.md
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
## v0.10.0 - 2025-03-08
|
||||||
|
### Added
|
||||||
|
* Hooks: improved logging when executing
|
||||||
|
* User commands: adding SSH keys using config key `userSshPubKeys`
|
||||||
|
* directives: added support for fetching values using directive `%{externalSource:key}%`
|
||||||
|
### Changed
|
||||||
|
* Commands: if dir is not specified, run in config dir
|
||||||
|
* FileDirective: use the config directory if path is not absolute
|
||||||
|
* Host: changes to case of some keys
|
||||||
|
* Notifications: added external directive to sensitive keys
|
||||||
|
### Fixed
|
||||||
|
* LocalFetcher: return fetch error
|
||||||
|
* Lists: load file key before attempting to load from current file
|
||||||
|
* fix: host not in config file, but in ssh config, properly added to hosts struct
|
||||||
|
* SSH: password authentication bugs
|
||||||
|
* User commands: change user password works
|
||||||
8
.changes/v0.10.1.md
Executable file
8
.changes/v0.10.1.md
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
## v0.10.1 - 2025-03-11
|
||||||
|
### Added
|
||||||
|
* UserCommands: add ssh public keys when running locally
|
||||||
|
* UserCommands: add field CreateUserHome
|
||||||
|
### Changed
|
||||||
|
* UserCommands: create temp file when modifing password over SSH
|
||||||
|
* UserCommands: change field name
|
||||||
|
* Vault: keys are now referenced by `name`, and the actual data by `data`
|
||||||
6
.changes/v0.10.2.md
Executable file
6
.changes/v0.10.2.md
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
## v0.10.2 - 2025-03-19
|
||||||
|
### Added
|
||||||
|
* Notifications: http service added
|
||||||
|
* Variable support. Can be referenced with `%{var:nameOfVar}%` in select string fields.
|
||||||
|
### Changed
|
||||||
|
* vault: initialize vault before validating config
|
||||||
0
.changes/v0.3.0.md
Normal file → Executable file
0
.changes/v0.3.0.md
Normal file → Executable file
0
.changes/v0.3.1.md
Normal file → Executable file
0
.changes/v0.3.1.md
Normal file → Executable file
0
.changes/v0.4.0.md
Normal file → Executable file
0
.changes/v0.4.0.md
Normal file → Executable file
0
.changes/v0.5.0.md
Normal file → Executable file
0
.changes/v0.5.0.md
Normal file → Executable file
0
.changes/v0.6.0.md
Normal file → Executable file
0
.changes/v0.6.0.md
Normal file → Executable file
3
.changes/v0.6.1.md
Executable file
3
.changes/v0.6.1.md
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
## v0.6.1 - 2025-01-04
|
||||||
|
### Fixed
|
||||||
|
* When running a list, hooks now run explicitly after the command executes. Fixed panic due to improper logic.
|
||||||
16
.changes/v0.7.0.md
Executable file
16
.changes/v0.7.0.md
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
## v0.7.0 - 2025-02-11
|
||||||
|
### Added
|
||||||
|
* [feat]: package `packageOperation` option `checkVersion` implemented
|
||||||
|
* user management added - see docs
|
||||||
|
* Support for remote config sources. Only config file and list can be used for now.
|
||||||
|
* Cache functionality - still a WIP
|
||||||
|
* Flag `--s3-endpoint` for config file fetching from S3
|
||||||
|
### Changed
|
||||||
|
* Internal refactoring of config setup
|
||||||
|
* Formatting and sending for notifications
|
||||||
|
* name of `configfetcher` to `remotefetcher`
|
||||||
|
* Flags that took comma-separated lists now have to be passed multiple times for each argument.
|
||||||
|
* Hosts passed to `exec host` now checked against default SSH config files
|
||||||
|
### Fixed
|
||||||
|
* Parsing of remote URLs when determining list config file path
|
||||||
|
* Incorrect error notification template value
|
||||||
3
.changes/v0.7.1.md
Executable file
3
.changes/v0.7.1.md
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
## v0.7.1 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* Incorrect local config file loading logic caused files to not be detected
|
||||||
3
.changes/v0.7.2.md
Executable file
3
.changes/v0.7.2.md
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
## v0.7.2 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* CI configs
|
||||||
3
.changes/v0.7.3.md
Executable file
3
.changes/v0.7.3.md
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
## v0.7.3 - 2025-02-14
|
||||||
|
### Changed
|
||||||
|
* GoReleaser configs
|
||||||
5
.changes/v0.7.4.md
Executable file
5
.changes/v0.7.4.md
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
## v0.7.4 - 2025-02-14
|
||||||
|
### Changed
|
||||||
|
* CI configs
|
||||||
|
### Fixed
|
||||||
|
* v0.7.1: Incorrect local config file loading logic caused files to not be detected
|
||||||
5
.changes/v0.7.5.md
Executable file
5
.changes/v0.7.5.md
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
## v0.7.5 - 2025-02-14
|
||||||
|
### Changed
|
||||||
|
* CI configs
|
||||||
|
### Fixed
|
||||||
|
* v0.7.1: Incorrect local config file loading logic caused files to not be detected
|
||||||
4
.changes/v0.7.6.md
Executable file
4
.changes/v0.7.6.md
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
## v0.7.6 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* v0.7.1: Incorrect local config file loading logic caused files to not be detected
|
||||||
|
* CI configs
|
||||||
4
.changes/v0.7.7.md
Executable file
4
.changes/v0.7.7.md
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
## v0.7.7 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* v0.7.1: Incorrect local config file loading logic caused files to not be detected
|
||||||
|
* CI configs
|
||||||
4
.changes/v0.7.8.md
Executable file
4
.changes/v0.7.8.md
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
## v0.7.8 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* Github CI config
|
||||||
|
* v0.7.1: Incorrect local config file loading logic caused files to not be detected
|
||||||
6
.changes/v0.8.0.md
Executable file
6
.changes/v0.8.0.md
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
## v0.8.0 - 2025-02-15
|
||||||
|
### Changed
|
||||||
|
* Breaking: `cmd-lists` key changed to `cmdLists`
|
||||||
|
* Properly load list config
|
||||||
|
* Config file loading properly errors
|
||||||
|
* CI Configs
|
||||||
12
.changes/v0.9.0.md
Executable file
12
.changes/v0.9.0.md
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
## v0.9.0 - 2025-02-28
|
||||||
|
### Added
|
||||||
|
* `list` command with subcommands `cmds` and `lists`
|
||||||
|
* Deprecation and unsupported warnings for old config keys
|
||||||
|
* CLI flag `--cmdStdOut` to output command's stdout/stderr to stdout
|
||||||
|
* Command type `remoteScript`. See docs for more info.
|
||||||
|
### Changed
|
||||||
|
* change to enums for Command type
|
||||||
|
* Cache now stores resources by URL hash for ease-of-lookup
|
||||||
|
* Changed PackageOperation to enums
|
||||||
|
### Fixed
|
||||||
|
* Local command's `dir` full path is now found with home directory
|
||||||
3
.changes/v0.9.1.md
Executable file
3
.changes/v0.9.1.md
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
## v0.9.1 - 2025-03-01
|
||||||
|
### Changed
|
||||||
|
* Use EnvVar AWS_PROFILE to get S3 profile
|
||||||
0
.changie.yaml
Normal file → Executable file
0
.changie.yaml
Normal file → Executable file
0
.frontmatter/database/mediaDb.json
Normal file → Executable file
0
.frontmatter/database/mediaDb.json
Normal file → Executable file
0
.frontmatter/database/taxonomyDb.json
Normal file → Executable file
0
.frontmatter/database/taxonomyDb.json
Normal file → Executable file
22
.github/workflows/release.yml
vendored
Normal file → Executable file
22
.github/workflows/release.yml
vendored
Normal file → Executable file
@@ -15,26 +15,26 @@ jobs:
|
|||||||
goreleaser:
|
goreleaser:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- run: git fetch --force --tags
|
- run: git fetch --force --tags
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.20'
|
go-version: '1.23'
|
||||||
cache: true
|
cache: true
|
||||||
# More assembly might be required: Docker logins, GPG, etc. It all depends
|
# More assembly might be required: Docker logins, GPG, etc. It all depends
|
||||||
# on your needs.
|
# on your needs.
|
||||||
- name: Get tag
|
- uses: olegtarasov/get-tag@v2.1.4
|
||||||
id: tag
|
id: tagName
|
||||||
uses: dawidd6/action-get-tag@v1
|
|
||||||
with:
|
with:
|
||||||
# Optionally strip `v` prefix
|
# tagRegex: "foobar-(.*)" # Optional. Returns specified group text as tag name. Full tag string is returned if regex is not defined.
|
||||||
strip_v: false
|
tagRegexGroup: 1 # Optional. Default is 1.
|
||||||
- uses: goreleaser/goreleaser-action@v4
|
- uses: goreleaser/goreleaser-action@v6
|
||||||
with:
|
with:
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: latest
|
version: 2.7.0
|
||||||
args: release --release-notes=".changes/${{steps.tag.outputs.tag}}.md" -f .goreleaser/github.yml --clean
|
args: release --release-notes=".changes/${{ env.GIT_TAG_NAME }}.md" -f .goreleaser/github.yml --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
|
||||||
|
GIT_TAG_NAME: ${{ steps.tagName.outputs.tag }}
|
||||||
|
|||||||
8
.gitignore
vendored
Normal file → Executable file
8
.gitignore
vendored
Normal file → Executable file
@@ -1,2 +1,10 @@
|
|||||||
|
!.changie.yaml
|
||||||
|
!.changes/**
|
||||||
|
|
||||||
dist/
|
dist/
|
||||||
|
.codegpt
|
||||||
|
|
||||||
|
*.log
|
||||||
|
/*.sh
|
||||||
|
/*.yaml
|
||||||
|
/*.yml
|
||||||
|
|||||||
0
.gitmodules
vendored
Normal file → Executable file
0
.gitmodules
vendored
Normal file → Executable file
5
.goreleaser/gitea.yml
Normal file → Executable file
5
.goreleaser/gitea.yml
Normal file → Executable file
@@ -6,7 +6,6 @@ before:
|
|||||||
builds:
|
builds:
|
||||||
- env:
|
- env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
- GOPROXY=https://goproxy.io
|
|
||||||
goos:
|
goos:
|
||||||
- freebsd
|
- freebsd
|
||||||
- linux
|
- linux
|
||||||
@@ -16,7 +15,7 @@ builds:
|
|||||||
- arm64
|
- arm64
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- format: tar.gz
|
- formats: tar.gz
|
||||||
# this name template makes the OS and Arch compatible with the results of uname.
|
# this name template makes the OS and Arch compatible with the results of uname.
|
||||||
name_template: >-
|
name_template: >-
|
||||||
{{ .ProjectName }}_{{ .Version }}_
|
{{ .ProjectName }}_{{ .Version }}_
|
||||||
@@ -28,7 +27,7 @@ archives:
|
|||||||
# use zip for windows archives
|
# use zip for windows archives
|
||||||
format_overrides:
|
format_overrides:
|
||||||
- goos: windows
|
- goos: windows
|
||||||
format: zip
|
formats: [zip]
|
||||||
checksum:
|
checksum:
|
||||||
name_template: 'checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
snapshot:
|
snapshot:
|
||||||
|
|||||||
5
.goreleaser/github.yml
Normal file → Executable file
5
.goreleaser/github.yml
Normal file → Executable file
@@ -1,4 +1,3 @@
|
|||||||
# This is an example .goreleaser.yml file with some sensible defaults.
|
|
||||||
# Make sure to check the documentation at https://goreleaser.com
|
# Make sure to check the documentation at https://goreleaser.com
|
||||||
version: 2
|
version: 2
|
||||||
before:
|
before:
|
||||||
@@ -17,7 +16,7 @@ builds:
|
|||||||
- arm64
|
- arm64
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- format: tar.gz
|
- formats: tar.gz
|
||||||
# this name template makes the OS and Arch compatible with the results of uname.
|
# this name template makes the OS and Arch compatible with the results of uname.
|
||||||
name_template: >-
|
name_template: >-
|
||||||
{{ .ProjectName }}_{{ .Version }}_
|
{{ .ProjectName }}_{{ .Version }}_
|
||||||
@@ -29,7 +28,7 @@ archives:
|
|||||||
# use zip for windows archives
|
# use zip for windows archives
|
||||||
format_overrides:
|
format_overrides:
|
||||||
- goos: windows
|
- goos: windows
|
||||||
format: zip
|
formats: [zip]
|
||||||
checksum:
|
checksum:
|
||||||
name_template: 'checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
snapshot:
|
snapshot:
|
||||||
|
|||||||
0
.goreleaser/vern.yml
Normal file → Executable file
0
.goreleaser/vern.yml
Normal file → Executable file
4
.vscode/settings.json
vendored
Normal file → Executable file
4
.vscode/settings.json
vendored
Normal file → Executable file
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"Cmds",
|
"Cmds",
|
||||||
|
"remotefetcher",
|
||||||
"knadh",
|
"knadh",
|
||||||
"koanf",
|
"koanf",
|
||||||
"mattn",
|
"mattn",
|
||||||
@@ -8,5 +9,6 @@
|
|||||||
"mautrix",
|
"mautrix",
|
||||||
"nikoksr",
|
"nikoksr",
|
||||||
"Strs"
|
"Strs"
|
||||||
]
|
],
|
||||||
|
"CodeGPT.apiKey": "CodeGPT Plus Beta"
|
||||||
}
|
}
|
||||||
13
.woodpecker/gitea.yml
Normal file → Executable file
13
.woodpecker/gitea.yml
Normal file → Executable file
@@ -1,11 +1,18 @@
|
|||||||
steps:
|
steps:
|
||||||
release:
|
golang:
|
||||||
image: goreleaser/goreleaser
|
image: golang:1.23
|
||||||
commands:
|
commands:
|
||||||
|
- go install github.com/goreleaser/goreleaser/v2@v2.7.0
|
||||||
- goreleaser release -f .goreleaser/gitea.yml --release-notes=".changes/$(go run backy.go version -V).md"
|
- goreleaser release -f .goreleaser/gitea.yml --release-notes=".changes/$(go run backy.go version -V).md"
|
||||||
secrets: [ gitea_token ]
|
environment:
|
||||||
|
GITEA_TOKEN:
|
||||||
|
from_secret: gitea_token
|
||||||
|
|
||||||
when:
|
when:
|
||||||
event: tag
|
event: tag
|
||||||
|
# release:
|
||||||
|
# image: goreleaser/goreleaser
|
||||||
|
# commands:
|
||||||
|
|
||||||
when:
|
when:
|
||||||
- event: tag
|
- event: tag
|
||||||
|
|||||||
2
.woodpecker/go-lint.yml
Normal file → Executable file
2
.woodpecker/go-lint.yml
Normal file → Executable file
@@ -5,7 +5,7 @@ steps:
|
|||||||
- go build
|
- go build
|
||||||
- go test
|
- go test
|
||||||
release:
|
release:
|
||||||
image: golangci/golangci-lint:v1.53.3
|
image: golangci/golangci-lint:v1.64.7
|
||||||
commands:
|
commands:
|
||||||
- golangci-lint run -v --timeout 5m
|
- golangci-lint run -v --timeout 5m
|
||||||
|
|
||||||
|
|||||||
24
.woodpecker/publish-docs.yml
Normal file → Executable file
24
.woodpecker/publish-docs.yml
Normal file → Executable file
@@ -1,15 +1,12 @@
|
|||||||
steps:
|
steps:
|
||||||
build:
|
build:
|
||||||
image: klakegg/hugo:ext-debian-ci
|
image: hugomods/hugo:debian-ci-0.146.0
|
||||||
commands:
|
commands:
|
||||||
- git submodule foreach 'git fetch origin; git checkout $(git describe --tags `git rev-list --tags --max-count=1`);'
|
- git submodule foreach 'git fetch origin; git checkout $(git describe --tags `git rev-list --tags --max-count=1`);'
|
||||||
- cd docs
|
- cd docs
|
||||||
- hugo mod get -u ./...
|
- hugo mod get -u github.com/divinerites/plausible-hugo
|
||||||
|
- hugo mod get -u github.com/McShelby/hugo-theme-relearn@8.2.0
|
||||||
- hugo
|
- hugo
|
||||||
when:
|
|
||||||
- event: push
|
|
||||||
branch: master
|
|
||||||
path: "docs/*"
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
image: codingkoopa/git-rsync-openssh
|
image: codingkoopa/git-rsync-openssh
|
||||||
@@ -26,9 +23,14 @@ steps:
|
|||||||
- echo "$SSH_DEPLOY_KEY" | tr -d '\r' | DISPLAY=":0.0" SSH_ASKPASS=~/.ssh/.print_ssh_password setsid ssh-add -
|
- echo "$SSH_DEPLOY_KEY" | tr -d '\r' | DISPLAY=":0.0" SSH_ASKPASS=~/.ssh/.print_ssh_password setsid ssh-add -
|
||||||
- rsync -atv --delete --progress public/ backy@backy.cybershell.xyz:docs
|
- rsync -atv --delete --progress public/ backy@backy.cybershell.xyz:docs
|
||||||
- rsync -atv --delete --progress vangen/ backy@backy.cybershell.xyz:vangen-go
|
- rsync -atv --delete --progress vangen/ backy@backy.cybershell.xyz:vangen-go
|
||||||
secrets: [ ssh_host_key, ssh_deploy_key, ssh_passphrase ]
|
environment:
|
||||||
|
SSH_HOST_KEY:
|
||||||
|
from_secret: ssh_host_key
|
||||||
|
SSH_DEPLOY_KEY:
|
||||||
|
from_secret: ssh_deploy_key
|
||||||
|
SSH_PASSPHRASE:
|
||||||
|
from_secret: ssh_passphrase
|
||||||
|
|
||||||
when:
|
when:
|
||||||
- event: push
|
- branch: master
|
||||||
branch: master
|
- path: 'docs/**'
|
||||||
path: "docs/*"
|
|
||||||
121
CHANGELOG.md
Normal file → Executable file
121
CHANGELOG.md
Normal file → Executable file
@@ -6,6 +6,127 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
|||||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.10.2 - 2025-03-19
|
||||||
|
### Added
|
||||||
|
* Notifications: http service added
|
||||||
|
* Variable support. Can be referenced with `%{var:nameOfVar}%` in select string fields.
|
||||||
|
### Changed
|
||||||
|
* vault: initialize vault before validating config
|
||||||
|
|
||||||
|
## v0.10.1 - 2025-03-11
|
||||||
|
### Added
|
||||||
|
* UserCommands: add ssh public keys when running locally
|
||||||
|
* UserCommands: add field CreateUserHome
|
||||||
|
### Changed
|
||||||
|
* UserCommands: create temp file when modifing password over SSH
|
||||||
|
* UserCommands: change field name
|
||||||
|
* Vault: keys are now referenced by `name`, and the actual data by `data`
|
||||||
|
|
||||||
|
## v0.10.0 - 2025-03-08
|
||||||
|
### Added
|
||||||
|
* Hooks: improved logging when executing
|
||||||
|
* User commands: adding SSH keys using config key `userSshPubKeys`
|
||||||
|
* directives: added support for fetching values using directive `%{externalSource:key}%`
|
||||||
|
### Changed
|
||||||
|
* Commands: if dir is not specified, run in config dir
|
||||||
|
* FileDirective: use the config directory if path is not absolute
|
||||||
|
* Host: changes to case of some keys
|
||||||
|
* Notifications: added external directive to sensitive keys
|
||||||
|
### Fixed
|
||||||
|
* LocalFetcher: return fetch error
|
||||||
|
* Lists: load file key before attempting to load from current file
|
||||||
|
* fix: host not in config file, but in ssh config, properly added to hosts struct
|
||||||
|
* SSH: password authentication bugs
|
||||||
|
* User commands: change user password works
|
||||||
|
|
||||||
|
## v0.9.1 - 2025-03-01
|
||||||
|
### Changed
|
||||||
|
* Use EnvVar AWS_PROFILE to get S3 profile
|
||||||
|
|
||||||
|
## v0.9.0 - 2025-02-28
|
||||||
|
### Added
|
||||||
|
* `list` command with subcommands `cmds` and `lists`
|
||||||
|
* Deprecation and unsupported warnings for old config keys
|
||||||
|
* CLI flag `--cmdStdOut` to output command's stdout/stderr to stdout
|
||||||
|
* Command type `remoteScript`. See docs for more info.
|
||||||
|
### Changed
|
||||||
|
* change to enums for Command type
|
||||||
|
* Cache now stores resources by URL hash for ease-of-lookup
|
||||||
|
* Changed PackageOperation to enums
|
||||||
|
### Fixed
|
||||||
|
* Local command's `dir` full path is now found with home directory
|
||||||
|
|
||||||
|
## v0.8.0 - 2025-02-15
|
||||||
|
### Changed
|
||||||
|
* Breaking: `cmd-lists` key changed to `cmdLists`
|
||||||
|
* Properly load list config
|
||||||
|
* Config file loading properly errors
|
||||||
|
* CI Configs
|
||||||
|
|
||||||
|
## v0.7.8 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* Github CI config
|
||||||
|
* v0.7.1: Incorrect local config file loading logic caused files to not be detected
|
||||||
|
|
||||||
|
## v0.7.7 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* v0.7.1: Incorrect local config file loading logic caused files to not be detected
|
||||||
|
* CI configs
|
||||||
|
|
||||||
|
## v0.7.6 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* v0.7.1: Incorrect local config file loading logic caused files to not be detected
|
||||||
|
* CI configs
|
||||||
|
|
||||||
|
## v0.7.5 - 2025-02-14
|
||||||
|
### Changed
|
||||||
|
* CI configs
|
||||||
|
### Fixed
|
||||||
|
* v0.7.1: Incorrect local config file loading logic caused files to not be detected
|
||||||
|
|
||||||
|
## v0.7.4 - 2025-02-14
|
||||||
|
### Changed
|
||||||
|
* CI configs
|
||||||
|
### Fixed
|
||||||
|
* v0.7.1: Incorrect local config file loading logic caused files to not be detected
|
||||||
|
|
||||||
|
## v0.7.3 - 2025-02-14
|
||||||
|
### Changed
|
||||||
|
* GoReleaser configs
|
||||||
|
|
||||||
|
## v0.7.2 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* CI configs
|
||||||
|
|
||||||
|
## v0.7.1 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* Incorrect local config file loading logic caused files to not be detected
|
||||||
|
|
||||||
|
## v0.7.0 - 2025-02-11
|
||||||
|
### Added
|
||||||
|
* [feat]: package `packageOperation` option `checkVersion` implemented
|
||||||
|
* user management added - see docs
|
||||||
|
* Support for remote config sources. Only config file and list can be used for now.
|
||||||
|
* Cache functionality - still a WIP
|
||||||
|
* Flag `--s3-endpoint` for config file fetching from S3
|
||||||
|
### Changed
|
||||||
|
* Internal refactoring of config setup
|
||||||
|
* Formatting and sending for notifications
|
||||||
|
* name of `configfetcher` to `remotefetcher`
|
||||||
|
* Flags that took comma-separated lists now have to be passed multiple times for each argument.
|
||||||
|
* Hosts passed to `exec host` now checked against default SSH config files
|
||||||
|
### Fixed
|
||||||
|
* Parsing of remote URLs when determining list config file path
|
||||||
|
* Incorrect error notification template value
|
||||||
|
|
||||||
|
## v0.6.1 - 2025-01-04
|
||||||
|
### Fixed
|
||||||
|
* When running a list, hooks now run explicitly after the command executes. Fixed panic due to improper logic.
|
||||||
|
## v0.6.0 - 2025-01-04
|
||||||
|
### Added
|
||||||
|
* Command Type Package - allows one to perform package operations [docs](https://backy.cybershell.xyz/config/packages/)
|
||||||
|
* Exec subcommand `host` allows for parallel execution of commands on hosts. [See docs](https://backy.cybershell.xyz/cli/exec)
|
||||||
|
|
||||||
## v0.5.0 - 2024-11-19
|
## v0.5.0 - 2024-11-19
|
||||||
### Added
|
### Added
|
||||||
* Lists can now go in a file. See docs for more information.
|
* Lists can now go in a file. See docs for more information.
|
||||||
|
|||||||
27
backy.code-workspace
Executable file
27
backy.code-workspace
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"name": "backy",
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"cSpell.words": [
|
||||||
|
"Autorestic",
|
||||||
|
"changie",
|
||||||
|
"Cmds",
|
||||||
|
"CMDSTDOUT",
|
||||||
|
"goreleaser",
|
||||||
|
"knadh",
|
||||||
|
"koanf",
|
||||||
|
"mattn",
|
||||||
|
"maunium",
|
||||||
|
"mautrix",
|
||||||
|
"nikoksr",
|
||||||
|
"packagemanagercommon",
|
||||||
|
"rawbytes",
|
||||||
|
"remotefetcher",
|
||||||
|
"Strs"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
0
cmd/.gitignore
vendored
Normal file → Executable file
0
cmd/.gitignore
vendored
Normal file → Executable file
17
cmd/backup.go
Normal file → Executable file
17
cmd/backup.go
Normal file → Executable file
@@ -12,8 +12,8 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
backupCmd = &cobra.Command{
|
backupCmd = &cobra.Command{
|
||||||
Use: "backup [--lists=list1,list2,... | -l list1, list2,...]",
|
Use: "backup [--lists=list1 --lists list2 ... | -l list1 -l list2 ...]",
|
||||||
Short: "Runs commands defined in config file.",
|
Short: "Runs commands defined in config file. Use -l flag multiple times to run multiple lists.",
|
||||||
Long: "Backup executes commands defined in config file.\nUse the --lists or -l flag to execute the specified lists. If not flag is not given, all lists will be executed.",
|
Long: "Backup executes commands defined in config file.\nUse the --lists or -l flag to execute the specified lists. If not flag is not given, all lists will be executed.",
|
||||||
Run: Backup,
|
Run: Backup,
|
||||||
}
|
}
|
||||||
@@ -23,16 +23,21 @@ var (
|
|||||||
var cmdLists []string
|
var cmdLists []string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
parseS3Config()
|
||||||
|
|
||||||
backupCmd.Flags().StringSliceVarP(&cmdLists, "lists", "l", nil, "Accepts comma-separated names of command lists to execute.")
|
backupCmd.Flags().StringArrayVarP(&cmdLists, "lists", "l", nil, "Accepts comma-separated names of command lists to execute.")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Backup(cmd *cobra.Command, args []string) {
|
func Backup(cmd *cobra.Command, args []string) {
|
||||||
backyConfOpts := backy.NewOpts(cfgFile, backy.AddCommandLists(cmdLists))
|
backyConfOpts := backy.NewConfigOptions(configFile,
|
||||||
backyConfOpts.InitConfig()
|
backy.AddCommandLists(cmdLists),
|
||||||
|
backy.SetLogFile(logFile),
|
||||||
|
backy.EnableCommandStdOut(cmdStdOut),
|
||||||
|
backy.SetHostsConfigFile(hostsConfigFile))
|
||||||
|
|
||||||
backy.ReadConfig(backyConfOpts)
|
backyConfOpts.InitConfig()
|
||||||
|
backyConfOpts.ParseConfigurationFile()
|
||||||
|
|
||||||
backyConfOpts.RunListConfig("")
|
backyConfOpts.RunListConfig("")
|
||||||
for _, host := range backyConfOpts.Hosts {
|
for _, host := range backyConfOpts.Hosts {
|
||||||
|
|||||||
54
cmd/backup_test.go
Executable file
54
cmd/backup_test.go
Executable file
@@ -0,0 +1,54 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
// import (
|
||||||
|
// "bufio"
|
||||||
|
// "encoding/json"
|
||||||
|
// "os"
|
||||||
|
// "os/exec"
|
||||||
|
// "strings"
|
||||||
|
// "testing"
|
||||||
|
|
||||||
|
// "github.com/stretchr/testify/assert"
|
||||||
|
// )
|
||||||
|
|
||||||
|
// // TestConfigOptions tests the configuration options for the backy package.
|
||||||
|
// func Test_ErrorHook(t *testing.T) {
|
||||||
|
// configFile := "-f ../../tests/ErrorHook.yml"
|
||||||
|
// logFile := "--log-file=ErrorHook.log"
|
||||||
|
// backyCommand := exec.Command("go", "run", "../../backy.go", configFile, logFile, "backup")
|
||||||
|
// backyCommand.Stderr = os.Stdout
|
||||||
|
// backyCommand.Stdout = os.Stdout
|
||||||
|
// err := backyCommand.Run()
|
||||||
|
// assert.Nil(t, err)
|
||||||
|
// os.Remove("ErrorHook.log")
|
||||||
|
// logFileData, logFileErr := os.ReadFile("ErrorHook.log")
|
||||||
|
// if logFileErr != nil {
|
||||||
|
// assert.FailNow(t, logFileErr.Error())
|
||||||
|
|
||||||
|
// }
|
||||||
|
// var JsonData []map[string]interface{}
|
||||||
|
// jsonScanner := bufio.NewScanner(strings.NewReader(string(logFileData)))
|
||||||
|
|
||||||
|
// for jsonScanner.Scan() {
|
||||||
|
// var jsonDataLine map[string]interface{}
|
||||||
|
// err = json.Unmarshal(jsonScanner.Bytes(), &jsonDataLine)
|
||||||
|
// assert.Nil(t, err)
|
||||||
|
// JsonData = append(JsonData, jsonDataLine)
|
||||||
|
// }
|
||||||
|
// for _, v := range JsonData {
|
||||||
|
// _, ok := v["error"]
|
||||||
|
// if !ok {
|
||||||
|
// assert.FailNow(t, "error does not exist\n")
|
||||||
|
// // return
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// // t.Logf("%s", logFileData)
|
||||||
|
// // t.Logf("%v", JsonData)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// func TestBackupErrorHook(t *testing.T) {
|
||||||
|
// logFile = "ErrorHook.log"
|
||||||
|
|
||||||
|
// configFile = "../tests/ErrorHook.yml"
|
||||||
|
|
||||||
|
// }
|
||||||
2
cmd/config.go
Normal file → Executable file
2
cmd/config.go
Normal file → Executable file
@@ -20,7 +20,7 @@ package cmd
|
|||||||
|
|
||||||
// func config(cmd *cobra.Command, args []string) {
|
// func config(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// opts := backy.NewOpts(cfgFile, backy.cronEnabled())
|
// opts := backy.NewConfigOptions(configFile, backy.cronEnabled())
|
||||||
// opts.InitConfig()
|
// opts.InitConfig()
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|||||||
11
cmd/cron.go
Normal file → Executable file
11
cmd/cron.go
Normal file → Executable file
@@ -16,9 +16,16 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func cron(cmd *cobra.Command, args []string) {
|
func cron(cmd *cobra.Command, args []string) {
|
||||||
|
parseS3Config()
|
||||||
|
|
||||||
|
opts := backy.NewConfigOptions(configFile,
|
||||||
|
backy.EnableCron(),
|
||||||
|
backy.SetLogFile(logFile),
|
||||||
|
backy.EnableCommandStdOut(cmdStdOut),
|
||||||
|
backy.SetHostsConfigFile(hostsConfigFile))
|
||||||
|
|
||||||
opts := backy.NewOpts(cfgFile, backy.CronEnabled())
|
|
||||||
opts.InitConfig()
|
opts.InitConfig()
|
||||||
backy.ReadConfig(opts)
|
opts.ParseConfigurationFile()
|
||||||
|
|
||||||
opts.Cron()
|
opts.Cron()
|
||||||
}
|
}
|
||||||
|
|||||||
17
cmd/exec.go
Normal file → Executable file
17
cmd/exec.go
Normal file → Executable file
@@ -21,20 +21,23 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
execCmd.AddCommand(hostExecCommand)
|
execCmd.AddCommand(hostExecCommand, hostsExecCommand)
|
||||||
|
|
||||||
hostExecCommand.Flags().StringSliceVarP(&hostsList, "hosts", "m", nil, "Accepts comma-separated names of hosts.")
|
|
||||||
hostExecCommand.Flags().StringSliceVarP(&cmdList, "commands", "c", nil, "Accepts comma-separated names of commands.")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func execute(cmd *cobra.Command, args []string) {
|
func execute(cmd *cobra.Command, args []string) {
|
||||||
|
parseS3Config()
|
||||||
|
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
logging.ExitWithMSG("Please provide a command to run. Pass --help to see options.", 1, nil)
|
logging.ExitWithMSG("Please provide a command to run. Pass --help to see options.", 1, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := backy.NewOpts(cfgFile, backy.AddCommands(args))
|
opts := backy.NewConfigOptions(configFile,
|
||||||
|
backy.AddCommands(args),
|
||||||
|
backy.SetLogFile(logFile),
|
||||||
|
backy.EnableCommandStdOut(cmdStdOut),
|
||||||
|
backy.SetHostsConfigFile(hostsConfigFile))
|
||||||
opts.InitConfig()
|
opts.InitConfig()
|
||||||
// opts.InitMongo()
|
opts.ParseConfigurationFile()
|
||||||
backy.ReadConfig(opts).ExecuteCmds(opts)
|
opts.ExecuteCmds()
|
||||||
}
|
}
|
||||||
|
|||||||
35
cmd/host.go
Normal file → Executable file
35
cmd/host.go
Normal file → Executable file
@@ -8,19 +8,25 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
hostExecCommand = &cobra.Command{
|
hostExecCommand = &cobra.Command{
|
||||||
Use: "host [--commands=command1,command2, ... | -c command1,command2, ...] [--hosts=host1,hosts2, ... | -m host1,host2, ...] ",
|
Use: "host [--command=command1 --command=command2 ... | -c command1 -c command2 ...] [--hosts=host1 --hosts=hosts2 ... | -m host1 -m host2 ...] ",
|
||||||
Short: "Runs command defined in config file on the hosts in order specified.",
|
Short: "Runs command defined in config file on the hosts in order specified.",
|
||||||
Long: "Host executes specified commands on the hosts defined in config file.\nUse the --commands or -c flag to choose the commands.",
|
Long: "Host executes specified commands on the hosts defined in config file.\nUse the --commands or -c flag to choose the commands.",
|
||||||
Run: Host,
|
Run: Host,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// Holds command list to run
|
// Holds list of hosts to run commands on
|
||||||
var hostsList []string
|
var hostsList []string
|
||||||
|
|
||||||
|
// Holds command list to run
|
||||||
var cmdList []string
|
var cmdList []string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
||||||
|
hostExecCommand.Flags().StringArrayVarP(&hostsList, "hosts", "m", nil, "Accepts space-separated names of hosts. Specify multiple times for multiple hosts.")
|
||||||
|
hostExecCommand.Flags().StringArrayVarP(&cmdList, "command", "c", nil, "Accepts space-separated names of commands. Specify multiple times for multiple commands.")
|
||||||
|
parseS3Config()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// cli input should be hosts and commands. Hosts are defined in config files.
|
// cli input should be hosts and commands. Hosts are defined in config files.
|
||||||
@@ -29,22 +35,37 @@ func init() {
|
|||||||
// 2. stdin (on command line) (TODO)
|
// 2. stdin (on command line) (TODO)
|
||||||
|
|
||||||
func Host(cmd *cobra.Command, args []string) {
|
func Host(cmd *cobra.Command, args []string) {
|
||||||
backyConfOpts := backy.NewOpts(cfgFile)
|
backyConfOpts := backy.NewConfigOptions(configFile,
|
||||||
|
backy.SetLogFile(logFile),
|
||||||
|
backy.EnableCommandStdOut(cmdStdOut),
|
||||||
|
backy.SetHostsConfigFile(hostsConfigFile))
|
||||||
backyConfOpts.InitConfig()
|
backyConfOpts.InitConfig()
|
||||||
|
|
||||||
backy.ReadConfig(backyConfOpts)
|
backyConfOpts.ParseConfigurationFile()
|
||||||
|
|
||||||
// check CLI input
|
// check CLI input
|
||||||
if hostsList == nil {
|
if hostsList == nil {
|
||||||
logging.ExitWithMSG("error: hosts must be specified", 1, &backyConfOpts.Logger)
|
logging.ExitWithMSG("error: hosts must be specified", 1, &backyConfOpts.Logger)
|
||||||
}
|
}
|
||||||
// host is only checked when we read the SSH File
|
|
||||||
// so a check may not be needed here
|
|
||||||
for _, h := range hostsList {
|
for _, h := range hostsList {
|
||||||
|
if backy.IsHostLocal(h) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// check if h exists in the config file
|
||||||
_, hostFound := backyConfOpts.Hosts[h]
|
_, hostFound := backyConfOpts.Hosts[h]
|
||||||
if !hostFound {
|
if !hostFound {
|
||||||
|
// check if h exists in the SSH config file
|
||||||
|
hostFoundInConfig, s := backy.DoesHostHaveHostName(h)
|
||||||
|
if !hostFoundInConfig {
|
||||||
logging.ExitWithMSG("host "+h+" not found", 1, &backyConfOpts.Logger)
|
logging.ExitWithMSG("host "+h+" not found", 1, &backyConfOpts.Logger)
|
||||||
}
|
}
|
||||||
|
if backyConfOpts.Hosts == nil {
|
||||||
|
backyConfOpts.Hosts = make(map[string]*backy.Host)
|
||||||
|
}
|
||||||
|
// create host with hostname and host
|
||||||
|
backyConfOpts.Hosts[h] = &backy.Host{Host: h, HostName: s}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if cmdList == nil {
|
if cmdList == nil {
|
||||||
logging.ExitWithMSG("error: commands must be specified", 1, &backyConfOpts.Logger)
|
logging.ExitWithMSG("error: commands must be specified", 1, &backyConfOpts.Logger)
|
||||||
@@ -56,5 +77,5 @@ func Host(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
backyConfOpts.ExecCmdsSSH(cmdList, hostsList)
|
backyConfOpts.ExecCmdsOnHosts(cmdList, hostsList)
|
||||||
}
|
}
|
||||||
|
|||||||
93
cmd/hosts.go
Executable file
93
cmd/hosts.go
Executable file
@@ -0,0 +1,93 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"maps"
|
||||||
|
"slices"
|
||||||
|
|
||||||
|
"git.andrewnw.xyz/CyberShell/backy/pkg/backy"
|
||||||
|
"git.andrewnw.xyz/CyberShell/backy/pkg/logging"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
runCommandsInParallel bool
|
||||||
|
|
||||||
|
hostsExecCommand = &cobra.Command{
|
||||||
|
Use: "hosts [--command=command1 --command=command2 ... | -c command1 -c command2 ...]",
|
||||||
|
Short: "Runs command defined in config file on the hosts in order specified.",
|
||||||
|
Long: "Hosts executes specified commands on all the hosts defined in config file.\nUse the --commands or -c flag to choose the commands.",
|
||||||
|
Run: Hosts,
|
||||||
|
}
|
||||||
|
|
||||||
|
hostsListExecCommand = &cobra.Command{
|
||||||
|
Use: "list list1 list2 ...",
|
||||||
|
Short: "Runs lists in order specified defined in config file on all hosts.",
|
||||||
|
Long: "Lists executes specified lists on all the hosts defined in hosts config.\nPass the names of lists as arguments after command.",
|
||||||
|
Run: HostsList,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
hostsExecCommand.AddCommand(hostsListExecCommand)
|
||||||
|
hostsListExecCommand.Flags().BoolVarP(&runCommandsInParallel, "parallel", "p", false, "Run commands in parallel on hosts")
|
||||||
|
parseS3Config()
|
||||||
|
}
|
||||||
|
|
||||||
|
// cli input should be hosts and commands. Hosts are defined in config files.
|
||||||
|
// commands can be passed by the following mutually exclusive options:
|
||||||
|
// 1. as a list of commands defined in the config file
|
||||||
|
// 2. stdin (on command line) (TODO)
|
||||||
|
|
||||||
|
func Hosts(cmd *cobra.Command, args []string) {
|
||||||
|
backyConfOpts := backy.NewConfigOptions(configFile,
|
||||||
|
backy.SetLogFile(logFile),
|
||||||
|
backy.EnableCommandStdOut(cmdStdOut),
|
||||||
|
backy.SetHostsConfigFile(hostsConfigFile))
|
||||||
|
backyConfOpts.InitConfig()
|
||||||
|
|
||||||
|
backyConfOpts.ParseConfigurationFile()
|
||||||
|
|
||||||
|
for _, h := range backyConfOpts.Hosts {
|
||||||
|
|
||||||
|
hostsList = append(hostsList, h.Host)
|
||||||
|
}
|
||||||
|
|
||||||
|
if cmdList == nil {
|
||||||
|
logging.ExitWithMSG("error: commands must be specified", 1, &backyConfOpts.Logger)
|
||||||
|
}
|
||||||
|
for _, c := range cmdList {
|
||||||
|
_, cmdFound := backyConfOpts.Cmds[c]
|
||||||
|
if !cmdFound {
|
||||||
|
logging.ExitWithMSG("cmd "+c+" not found", 1, &backyConfOpts.Logger)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
backyConfOpts.ExecCmdsOnHosts(cmdList, hostsList)
|
||||||
|
}
|
||||||
|
|
||||||
|
func HostsList(cmd *cobra.Command, args []string) {
|
||||||
|
backyConfOpts := backy.NewConfigOptions(configFile,
|
||||||
|
backy.SetLogFile(logFile),
|
||||||
|
backy.EnableCommandStdOut(cmdStdOut),
|
||||||
|
backy.SetHostsConfigFile(hostsConfigFile))
|
||||||
|
backyConfOpts.InitConfig()
|
||||||
|
|
||||||
|
backyConfOpts.ParseConfigurationFile()
|
||||||
|
|
||||||
|
if len(args) == 0 {
|
||||||
|
logging.ExitWithMSG("error: no lists specified", 1, &backyConfOpts.Logger)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, l := range args {
|
||||||
|
_, listFound := backyConfOpts.CmdConfigLists[l]
|
||||||
|
if !listFound {
|
||||||
|
logging.ExitWithMSG("list "+l+" not found", 1, &backyConfOpts.Logger)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
maps.DeleteFunc(backyConfOpts.CmdConfigLists, func(k string, v *backy.CmdList) bool {
|
||||||
|
return !slices.Contains(args, k)
|
||||||
|
})
|
||||||
|
|
||||||
|
backyConfOpts.ExecuteListOnHosts(args, runCommandsInParallel)
|
||||||
|
}
|
||||||
71
cmd/list.go
Normal file → Executable file
71
cmd/list.go
Normal file → Executable file
@@ -6,16 +6,29 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"git.andrewnw.xyz/CyberShell/backy/pkg/backy"
|
"git.andrewnw.xyz/CyberShell/backy/pkg/backy"
|
||||||
|
"git.andrewnw.xyz/CyberShell/backy/pkg/logging"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
listCmd = &cobra.Command{
|
listCmd = &cobra.Command{
|
||||||
Use: "list [--list=list1,list2,... | -l list1, list2,...] [ -cmd cmd1 cmd2 cmd3...]",
|
Use: "list [command]",
|
||||||
Short: "Lists commands, lists, or hosts defined in config file.",
|
Short: "List commands, lists, or hosts defined in config file.",
|
||||||
Long: "Backup lists commands or groups defined in config file.\nUse the --lists or -l flag to list the specified lists. If not flag is not given, all lists will be executed.",
|
Long: "List commands, lists, or hosts defined in config file",
|
||||||
Run: List,
|
}
|
||||||
|
|
||||||
|
listCmds = &cobra.Command{
|
||||||
|
Use: "cmds [cmd1 cmd2 cmd3...]",
|
||||||
|
Short: "List commands defined in config file.",
|
||||||
|
Long: "List commands defined in config file",
|
||||||
|
Run: ListCommands,
|
||||||
|
}
|
||||||
|
listCmdLists = &cobra.Command{
|
||||||
|
Use: "lists [list1 list2 ...]",
|
||||||
|
Short: "List lists defined in config file.",
|
||||||
|
Long: "List lists defined in config file",
|
||||||
|
Run: ListCommandLists,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -23,27 +36,55 @@ var listsToList []string
|
|||||||
var cmdsToList []string
|
var cmdsToList []string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
listCmd.AddCommand(listCmds, listCmdLists)
|
||||||
listCmd.Flags().StringSliceVarP(&listsToList, "lists", "l", nil, "Accepts comma-separated names of command lists to list.")
|
|
||||||
listCmd.Flags().StringSliceVarP(&cmdsToList, "cmds", "c", nil, "Accepts comma-separated names of commands to list.")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func List(cmd *cobra.Command, args []string) {
|
func ListCommands(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// settup based on whats passed in:
|
// setup based on whats passed in:
|
||||||
// - cmds
|
// - cmds
|
||||||
// - lists
|
// - lists
|
||||||
// - if none, list all commands
|
// - if none, list all commands
|
||||||
if cmdLists != nil {
|
if len(args) > 0 {
|
||||||
|
cmdsToList = args
|
||||||
|
} else {
|
||||||
|
logging.ExitWithMSG("Error: list cmds subcommand needs commands to list", 1, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := backy.NewOpts(cfgFile)
|
parseS3Config()
|
||||||
|
|
||||||
|
opts := backy.NewConfigOptions(configFile,
|
||||||
|
backy.SetLogFile(logFile),
|
||||||
|
backy.SetHostsConfigFile(hostsConfigFile))
|
||||||
|
|
||||||
opts.InitConfig()
|
opts.InitConfig()
|
||||||
|
opts.ParseConfigurationFile()
|
||||||
|
|
||||||
|
for _, v := range cmdsToList {
|
||||||
|
opts.ListCommand(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ListCommandLists(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
|
parseS3Config()
|
||||||
|
|
||||||
|
if len(args) > 0 {
|
||||||
|
listsToList = args
|
||||||
|
} else {
|
||||||
|
logging.ExitWithMSG("Error: lists subcommand needs lists", 1, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
opts := backy.NewConfigOptions(configFile,
|
||||||
|
backy.SetLogFile(logFile),
|
||||||
|
backy.SetHostsConfigFile(hostsConfigFile))
|
||||||
|
|
||||||
|
opts.InitConfig()
|
||||||
|
opts.ParseConfigurationFile()
|
||||||
|
|
||||||
|
for _, v := range listsToList {
|
||||||
|
opts.ListCommandList(v)
|
||||||
|
}
|
||||||
|
|
||||||
opts = backy.ReadConfig(opts)
|
|
||||||
|
|
||||||
opts.ListCommand("rm-sn-db")
|
|
||||||
}
|
}
|
||||||
|
|||||||
19
cmd/root.go
Normal file → Executable file
19
cmd/root.go
Normal file → Executable file
@@ -13,8 +13,12 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// Used for flags.
|
// Used for flags.
|
||||||
cfgFile string
|
configFile string
|
||||||
|
hostsConfigFile string
|
||||||
verbose bool
|
verbose bool
|
||||||
|
cmdStdOut bool
|
||||||
|
logFile string
|
||||||
|
s3Endpoint string
|
||||||
|
|
||||||
rootCmd = &cobra.Command{
|
rootCmd = &cobra.Command{
|
||||||
Use: "backy",
|
Use: "backy",
|
||||||
@@ -32,9 +36,18 @@ func Execute() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
rootCmd.PersistentFlags().StringVar(&logFile, "logFile", "", "log file to write to")
|
||||||
|
rootCmd.PersistentFlags().BoolVar(&cmdStdOut, "cmdStdOut", false, "Pass to print command output to stdout")
|
||||||
|
|
||||||
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "f", "", "config file to read from")
|
rootCmd.PersistentFlags().StringVarP(&configFile, "config", "f", "", "config file to read from")
|
||||||
|
rootCmd.PersistentFlags().StringVar(&hostsConfigFile, "hostsConfig", "", "yaml hosts file to read from")
|
||||||
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Sets verbose level")
|
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Sets verbose level")
|
||||||
|
rootCmd.PersistentFlags().StringVar(&s3Endpoint, "s3Endpoint", "", "Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.")
|
||||||
rootCmd.AddCommand(backupCmd, execCmd, cronCmd, versionCmd, listCmd)
|
rootCmd.AddCommand(backupCmd, execCmd, cronCmd, versionCmd, listCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parseS3Config() {
|
||||||
|
if s3Endpoint != "" {
|
||||||
|
os.Setenv("S3_ENDPOINT", s3Endpoint)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
2
cmd/version.go
Normal file → Executable file
2
cmd/version.go
Normal file → Executable file
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
const versionStr = "0.6.0"
|
const versionStr = "0.10.2"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
versionCmd = &cobra.Command{
|
versionCmd = &cobra.Command{
|
||||||
|
|||||||
0
docs/.gitignore
vendored
Normal file → Executable file
0
docs/.gitignore
vendored
Normal file → Executable file
0
docs/.hugo_build.lock
Normal file → Executable file
0
docs/.hugo_build.lock
Normal file → Executable file
0
docs/archetypes/default.md
Normal file → Executable file
0
docs/archetypes/default.md
Normal file → Executable file
137
docs/config.toml
137
docs/config.toml
@@ -1,137 +0,0 @@
|
|||||||
baseURL = 'http://backy.cybershell.xyz/'
|
|
||||||
languageCode = 'en-us'
|
|
||||||
title = 'A tool for commands'
|
|
||||||
|
|
||||||
# Change the default theme to be use when building the site with Hugo
|
|
||||||
theme = [ "hugo-theme-relearn", "plausible-hugo"] # Add this theme to your already existing other themes
|
|
||||||
|
|
||||||
# For search functionality
|
|
||||||
[outputs]
|
|
||||||
home = [ "HTML", "RSS", "PRINT"]
|
|
||||||
|
|
||||||
[module]
|
|
||||||
[[module.imports]]
|
|
||||||
path = "github.com/divinerites/plausible-hugo"
|
|
||||||
|
|
||||||
[params]
|
|
||||||
# This controls whether submenus will be expanded (true), or collapsed (false) in the
|
|
||||||
# menu; if no setting is given, the first menu level is set to false, all others to true;
|
|
||||||
# this can be overridden in the pages frontmatter
|
|
||||||
alwaysopen = false
|
|
||||||
# Prefix URL to edit current page. Will display an "Edit" button on top right hand corner of every page.
|
|
||||||
# Useful to give opportunity to people to create merge request for your doc.
|
|
||||||
# See the config.toml file from this documentation site to have an example.
|
|
||||||
editURL = ""
|
|
||||||
# Description of the site, will be used in meta information
|
|
||||||
description = ""
|
|
||||||
# Shows a checkmark for visited pages on the menu
|
|
||||||
showVisitedLinks = false
|
|
||||||
# Disable search function. It will hide search bar
|
|
||||||
disableSearch = false
|
|
||||||
# Disable search in hidden pages, otherwise they will be shown in search box
|
|
||||||
disableSearchHiddenPages = false
|
|
||||||
# Disables hidden pages from showing up in the sitemap and on Google (et all), otherwise they may be indexed by search engines
|
|
||||||
disableSeoHiddenPages = false
|
|
||||||
# Disables hidden pages from showing up on the tags page although the tag term will be displayed even if all pages are hidden
|
|
||||||
disableTagHiddenPages = false
|
|
||||||
# Javascript and CSS cache are automatically busted when new version of site is generated.
|
|
||||||
# Set this to true to disable this behavior (some proxies don't handle well this optimization)
|
|
||||||
disableAssetsBusting = false
|
|
||||||
# Set this to true if you want to disable generation for generator version meta tags of hugo and the theme;
|
|
||||||
# don't forget to also set Hugo's disableHugoGeneratorInject=true, otherwise it will generate a meta tag into your home page
|
|
||||||
disableGeneratorVersion = false
|
|
||||||
# Set this to true to disable copy-to-clipboard button for inline code.
|
|
||||||
disableInlineCopyToClipBoard = false
|
|
||||||
# A title for shortcuts in menu is set by default. Set this to true to disable it.
|
|
||||||
disableShortcutsTitle = false
|
|
||||||
# If set to false, a Home button will appear below the search bar on the menu.
|
|
||||||
# It is redirecting to the landing page of the current language if specified. (Default is "/")
|
|
||||||
disableLandingPageButton = true
|
|
||||||
# When using mulitlingual website, disable the switch language button.
|
|
||||||
disableLanguageSwitchingButton = false
|
|
||||||
# Hide breadcrumbs in the header and only show the current page title
|
|
||||||
disableBreadcrumb = true
|
|
||||||
# If set to true, hide table of contents menu in the header of all pages
|
|
||||||
disableToc = false
|
|
||||||
# If set to false, load the MathJax module on every page regardless if a MathJax shortcode is present
|
|
||||||
math = true
|
|
||||||
# Specifies the remote location of the MathJax js
|
|
||||||
customMathJaxURL = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
|
|
||||||
# Initialization parameter for MathJax, see MathJax documentation
|
|
||||||
mathJaxInitialize = "{}"
|
|
||||||
# If set to false, load the Mermaid module on every page regardless if a Mermaid shortcode or Mermaid codefence is present
|
|
||||||
mermaid = true
|
|
||||||
# Specifies the remote location of the Mermaid js
|
|
||||||
customMermaidURL = "https://unpkg.com/mermaid/dist/mermaid.min.js"
|
|
||||||
# Initialization parameter for Mermaid, see Mermaid documentation
|
|
||||||
mermaidInitialize = "{ \"theme\": \"default\" }"
|
|
||||||
# If set to false, load the Swagger module on every page regardless if a Swagger shortcode is present
|
|
||||||
disableSwagger = false
|
|
||||||
# Specifies the remote location of the RapiDoc js
|
|
||||||
customSwaggerURL = "https://unpkg.com/rapidoc/dist/rapidoc-min.js"
|
|
||||||
# Initialization parameter for Swagger, see RapiDoc documentation
|
|
||||||
swaggerInitialize = "{ \"theme\": \"light\" }"
|
|
||||||
# Hide Next and Previous page buttons normally displayed full height beside content
|
|
||||||
disableNextPrev = true
|
|
||||||
# Order sections in menu by "weight" or "title". Default to "weight";
|
|
||||||
# this can be overridden in the pages frontmatter
|
|
||||||
ordersectionsby = "weight"
|
|
||||||
|
|
||||||
[[params.themeVariant]]
|
|
||||||
auto = []
|
|
||||||
identifier = 'relearn-auto'
|
|
||||||
name = 'Relearn Light/Dark'
|
|
||||||
|
|
||||||
[[params.themeVariant]]
|
|
||||||
identifier = 'relearn-light'
|
|
||||||
|
|
||||||
[[params.themeVariant]]
|
|
||||||
identifier = 'relearn-dark'
|
|
||||||
|
|
||||||
[[params.themeVariant]]
|
|
||||||
identifier = 'relearn-bright'
|
|
||||||
|
|
||||||
[[params.themeVariant]]
|
|
||||||
auto = ['zen-light', 'zen-dark']
|
|
||||||
identifier = 'zen-auto'
|
|
||||||
name = 'Zen Light/Dark'
|
|
||||||
|
|
||||||
[[params.themeVariant]]
|
|
||||||
identifier = 'zen-light'
|
|
||||||
|
|
||||||
[[params.themeVariant]]
|
|
||||||
identifier = 'zen-dark'
|
|
||||||
|
|
||||||
[[params.themeVariant]]
|
|
||||||
auto = ['learn', 'neon']
|
|
||||||
identifier = 'retro-auto'
|
|
||||||
name = 'Retro Learn/Neon'
|
|
||||||
|
|
||||||
[[params.themeVariant]]
|
|
||||||
identifier = 'neon'
|
|
||||||
|
|
||||||
[[params.themeVariant]]
|
|
||||||
identifier = 'learn'
|
|
||||||
# Change the title separator. Default to "::".
|
|
||||||
titleSeparator = "-"
|
|
||||||
# If set to true, the menu in the sidebar will be displayed in a collapsible tree view. Although the functionality works with old browsers (IE11), the display of the expander icons is limited to modern browsers
|
|
||||||
collapsibleMenu = true
|
|
||||||
# If a single page can contain content in multiple languages, add those here
|
|
||||||
additionalContentLanguage = [ "en" ]
|
|
||||||
# If set to true, no index.html will be appended to prettyURLs; this will cause pages not
|
|
||||||
# to be servable from the file system
|
|
||||||
disableExplicitIndexURLs = false
|
|
||||||
# For external links you can define how they are opened in your browser; this setting will only be applied to the content area but not the shortcut menu
|
|
||||||
externalLinkTarget = "_blank"
|
|
||||||
# Author of the site, will be used in meta information
|
|
||||||
[params.author]
|
|
||||||
name = "Andrew Woodlee"
|
|
||||||
|
|
||||||
|
|
||||||
[params.plausible]
|
|
||||||
enable = true # Whether to enable plausible tracking
|
|
||||||
domain = "backy.cybershell.xyz" # Plausible "domain" name/id in your dashboard
|
|
||||||
outbound_link = true
|
|
||||||
gitstar = false
|
|
||||||
selfhosted_domain = "stats.andrewnw.com" # Self-hosted plausible domain
|
|
||||||
|
|
||||||
80
docs/config.yaml
Executable file
80
docs/config.yaml
Executable file
@@ -0,0 +1,80 @@
|
|||||||
|
baseURL: https://backy.cybershell.xyz/
|
||||||
|
languageCode: en-us
|
||||||
|
title: A tool for commands
|
||||||
|
ignoreLogs: 'warning-partial-superfluous-prefix'
|
||||||
|
theme:
|
||||||
|
- hugo-theme-relearn
|
||||||
|
- plausible-hugo
|
||||||
|
outputs:
|
||||||
|
home:
|
||||||
|
- HTML
|
||||||
|
- RSS
|
||||||
|
- PRINT
|
||||||
|
module:
|
||||||
|
imports:
|
||||||
|
- path: github.com/divinerites/plausible-hugo
|
||||||
|
- path: github.com/McShelby/hugo-theme-relearn
|
||||||
|
version: "v8.2.0"
|
||||||
|
params:
|
||||||
|
themeVariant:
|
||||||
|
- auto: []
|
||||||
|
identifier: relearn-auto
|
||||||
|
name: Relearn Light/Dark
|
||||||
|
- identifier: relearn-light
|
||||||
|
- identifier: relearn-dark
|
||||||
|
- identifier: relearn-bright
|
||||||
|
- auto:
|
||||||
|
- zen-light
|
||||||
|
- zen-dark
|
||||||
|
identifier: zen-auto
|
||||||
|
name: Zen Light/Dark
|
||||||
|
- identifier: zen-light
|
||||||
|
- identifier: zen-dark
|
||||||
|
- auto:
|
||||||
|
- learn
|
||||||
|
- neon
|
||||||
|
identifier: retro-auto
|
||||||
|
name: Retro Learn/Neon
|
||||||
|
- identifier: neon
|
||||||
|
- identifier: learn
|
||||||
|
plausible:
|
||||||
|
enable: true
|
||||||
|
domain: backy.cybershell.xyz
|
||||||
|
outbound_link: true
|
||||||
|
gitstar: false
|
||||||
|
selfhosted_domain: stats.andrewnw.com
|
||||||
|
author:
|
||||||
|
name: Andrew Woodlee
|
||||||
|
alwaysopen: false
|
||||||
|
editURL: ""
|
||||||
|
description: ""
|
||||||
|
showVisitedLinks: false
|
||||||
|
disableSearch: false
|
||||||
|
disableSearchHiddenPages: false
|
||||||
|
disableSeoHiddenPages: false
|
||||||
|
disableTagHiddenPages: false
|
||||||
|
disableAssetsBusting: false
|
||||||
|
disableGeneratorVersion: false
|
||||||
|
disableInlineCopyToClipBoard: false
|
||||||
|
disableShortcutsTitle: false
|
||||||
|
disableLandingPageButton: true
|
||||||
|
disableLanguageSwitchingButton: false
|
||||||
|
disableBreadcrumb: true
|
||||||
|
disableToc: false
|
||||||
|
math: true
|
||||||
|
customMathJaxURL: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
|
||||||
|
mathJaxInitialize: "{}"
|
||||||
|
mermaid: true
|
||||||
|
customMermaidURL: https://unpkg.com/mermaid/dist/mermaid.min.js
|
||||||
|
mermaidInitialize: '{ "theme": "default" }'
|
||||||
|
disableSwagger: false
|
||||||
|
customSwaggerURL: https://unpkg.com/rapidoc/dist/rapidoc-min.js
|
||||||
|
swaggerInitialize: '{ "theme": "light" }'
|
||||||
|
disableNextPrev: true
|
||||||
|
ordersectionsby: weight
|
||||||
|
titleSeparator: "-"
|
||||||
|
collapsibleMenu: true
|
||||||
|
additionalContentLanguage:
|
||||||
|
- en
|
||||||
|
disableExplicitIndexURLs: false
|
||||||
|
externalLinkTarget: _blank
|
||||||
4
docs/content/_index.md
Normal file → Executable file
4
docs/content/_index.md
Normal file → Executable file
@@ -17,6 +17,10 @@ Feel free to open a [PR](https://git.andrewnw.xyz/CyberShell/backy/pulls), raise
|
|||||||
|
|
||||||
- Allows easy configuration of executable commands
|
- Allows easy configuration of executable commands
|
||||||
|
|
||||||
|
- Allows for running package operations
|
||||||
|
|
||||||
|
- Allows configuring failure, success, and final hooks
|
||||||
|
|
||||||
- Allows for commands to be run on many hosts over SSH
|
- Allows for commands to be run on many hosts over SSH
|
||||||
|
|
||||||
- Commands can be grouped in list to run in specific order
|
- Commands can be grouped in list to run in specific order
|
||||||
|
|||||||
94
docs/content/cli/_index.md
Normal file → Executable file
94
docs/content/cli/_index.md
Normal file → Executable file
@@ -14,17 +14,21 @@ Usage:
|
|||||||
backy [command]
|
backy [command]
|
||||||
|
|
||||||
Available Commands:
|
Available Commands:
|
||||||
backup Runs commands defined in config file.
|
backup Runs commands defined in config file. Use -l flag multiple times to run multiple lists.
|
||||||
completion Generate the autocompletion script for the specified shell
|
completion Generate the autocompletion script for the specified shell
|
||||||
cron Starts a scheduler that runs lists defined in config file.
|
cron Starts a scheduler that runs lists defined in config file.
|
||||||
exec Runs commands defined in config file in order given.
|
exec Runs commands defined in config file in order given.
|
||||||
help Help about any command
|
help Help about any command
|
||||||
list Lists commands, lists, or hosts defined in config file.
|
list List commands, lists, or hosts defined in config file.
|
||||||
version Prints the version and exits
|
version Prints the version and exits
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
|
--cmdStdOut Pass to print command output to stdout
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
-h, --help help for backy
|
-h, --help help for backy
|
||||||
|
--hostsConfig string yaml hosts file to read from
|
||||||
|
--logFile string log file to write to
|
||||||
|
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
-v, --verbose Sets verbose level
|
-v, --verbose Sets verbose level
|
||||||
|
|
||||||
Use "backy [command] --help" for more information about a command.
|
Use "backy [command] --help" for more information about a command.
|
||||||
@@ -39,14 +43,18 @@ Backup executes commands defined in config file.
|
|||||||
Use the --lists or -l flag to execute the specified lists. If not flag is not given, all lists will be executed.
|
Use the --lists or -l flag to execute the specified lists. If not flag is not given, all lists will be executed.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
backy backup [--lists=list1,list2,... | -l list1, list2,...] [flags]
|
backy backup [--lists=list1 --lists list2 ... | -l list1 -l list2 ...] [flags]
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-h, --help help for backup
|
-h, --help help for backup
|
||||||
-l, --lists strings Accepts comma-separated names of command lists to execute.
|
-l, --lists stringArray Accepts comma-separated names of command lists to execute.
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
|
--cmdStdOut Pass to print command output to stdout
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
|
--hostsConfig string yaml hosts file to read from
|
||||||
|
--logFile string log file to write to
|
||||||
|
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
-v, --verbose Sets verbose level
|
-v, --verbose Sets verbose level
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -62,7 +70,11 @@ Flags:
|
|||||||
-h, --help help for cron
|
-h, --help help for cron
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
|
--cmdStdOut Pass to print command output to stdout
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
|
--hostsConfig string yaml hosts file to read from
|
||||||
|
--logFile string log file to write to
|
||||||
|
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
-v, --verbose Sets verbose level
|
-v, --verbose Sets verbose level
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -77,12 +89,17 @@ Usage:
|
|||||||
|
|
||||||
Available Commands:
|
Available Commands:
|
||||||
host Runs command defined in config file on the hosts in order specified.
|
host Runs command defined in config file on the hosts in order specified.
|
||||||
|
hosts Runs command defined in config file on the hosts in order specified.
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-h, --help help for exec
|
-h, --help help for exec
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
|
--cmdStdOut Pass to print command output to stdout
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
|
--hostsConfig string yaml hosts file to read from
|
||||||
|
--logFile string log file to write to
|
||||||
|
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
-v, --verbose Sets verbose level
|
-v, --verbose Sets verbose level
|
||||||
|
|
||||||
Use "backy exec [command] --help" for more information about a command.
|
Use "backy exec [command] --help" for more information about a command.
|
||||||
@@ -95,15 +112,19 @@ Host executes specified commands on the hosts defined in config file.
|
|||||||
Use the --commands or -c flag to choose the commands.
|
Use the --commands or -c flag to choose the commands.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
backy exec host [--commands=command1,command2, ... | -c command1,command2, ...] [--hosts=host1,hosts2, ... | -m host1,host2, ...] [flags]
|
backy exec host [--command=command1 --command=command2 ... | -c command1 -c command2 ...] [--hosts=host1 --hosts=hosts2 ... | -m host1 -m host2 ...] [flags]
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-c, --commands strings Accepts comma-separated names of commands.
|
-c, --command stringArray Accepts space-separated names of commands. Specify multiple times for multiple commands.
|
||||||
-h, --help help for host
|
-h, --help help for host
|
||||||
-m, --hosts strings Accepts comma-separated names of hosts.
|
-m, --hosts stringArray Accepts space-separated names of hosts. Specify multiple times for multiple hosts.
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
|
--cmdStdOut Pass to print command output to stdout
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
|
--hostsConfig string yaml hosts file to read from
|
||||||
|
--logFile string log file to write to
|
||||||
|
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
-v, --verbose Sets verbose level
|
-v, --verbose Sets verbose level
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -121,25 +142,74 @@ Flags:
|
|||||||
-V, --vpre Output the version with v prefixed.
|
-V, --vpre Output the version with v prefixed.
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
|
--cmdStdOut Pass to print command output to stdout
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
|
--hostsConfig string yaml hosts file to read from
|
||||||
|
--logFile string log file to write to
|
||||||
|
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
-v, --verbose Sets verbose level
|
-v, --verbose Sets verbose level
|
||||||
```
|
```
|
||||||
|
|
||||||
## list
|
## list
|
||||||
|
|
||||||
```
|
```
|
||||||
Backup lists commands or groups defined in config file.
|
List commands, lists, or hosts defined in config file
|
||||||
Use the --lists or -l flag to list the specified lists. If not flag is not given, all lists will be executed.
|
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
backy list [--list=list1,list2,... | -l list1, list2,...] [ -cmd cmd1 cmd2 cmd3...] [flags]
|
backy list [command]
|
||||||
|
|
||||||
|
Available Commands:
|
||||||
|
cmds List commands defined in config file.
|
||||||
|
lists List lists defined in config file.
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-c, --cmds strings Accepts comma-separated names of commands to list.
|
|
||||||
-h, --help help for list
|
-h, --help help for list
|
||||||
-l, --lists strings Accepts comma-separated names of command lists to list.
|
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
|
--cmdStdOut Pass to print command output to stdout
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
|
--hostsConfig string yaml hosts file to read from
|
||||||
|
--logFile string log file to write to
|
||||||
|
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
|
-v, --verbose Sets verbose level
|
||||||
|
|
||||||
|
Use "backy list [command] --help" for more information about a command.
|
||||||
|
```
|
||||||
|
## list cmds
|
||||||
|
|
||||||
|
```
|
||||||
|
List commands defined in config file
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
backy list cmds [cmd1 cmd2 cmd3...] [flags]
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
-h, --help help for cmds
|
||||||
|
|
||||||
|
Global Flags:
|
||||||
|
--cmdStdOut Pass to print command output to stdout
|
||||||
|
-f, --config string config file to read from
|
||||||
|
--hostsConfig string yaml hosts file to read from
|
||||||
|
--logFile string log file to write to
|
||||||
|
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
|
-v, --verbose Sets verbose level
|
||||||
|
```
|
||||||
|
## list lists
|
||||||
|
|
||||||
|
```
|
||||||
|
List lists defined in config file
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
backy list lists [list1 list2 ...] [flags]
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
-h, --help help for lists
|
||||||
|
|
||||||
|
Global Flags:
|
||||||
|
--cmdStdOut Pass to print command output to stdout
|
||||||
|
-f, --config string config file to read from
|
||||||
|
--hostsConfig string yaml hosts file to read from
|
||||||
|
--logFile string log file to write to
|
||||||
|
--s3Endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
-v, --verbose Sets verbose level
|
-v, --verbose Sets verbose level
|
||||||
```
|
```
|
||||||
|
|||||||
8
docs/content/cli/exec.md
Normal file → Executable file
8
docs/content/cli/exec.md
Normal file → Executable file
@@ -2,18 +2,18 @@
|
|||||||
title: Exec
|
title: Exec
|
||||||
---
|
---
|
||||||
|
|
||||||
The `exec` subcommand can do somethings that the configuration file can't do yet. The command `exec host` can execute commands on many hosts.
|
The `exec` subcommand can do some things that the configuration file can't do yet. The command `exec host` can execute commands on many hosts.
|
||||||
|
|
||||||
`exec host` takes the following arguments:
|
`exec host` takes the following arguments:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
-c, --commands strings Accepts comma-separated names of commands.
|
-c, --commands strings Accepts space-separated names of commands.
|
||||||
-h, --help help for host
|
-h, --help help for host
|
||||||
-m, --hosts strings Accepts comma-separated names of hosts.
|
-m, --hosts strings Accepts space-separated names of hosts.
|
||||||
```
|
```
|
||||||
|
|
||||||
The commands have to be defined in the config file. The hosts need to at least be in the ssh_config(5) file.
|
The commands have to be defined in the config file. The hosts need to at least be in the ssh_config(5) file.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
backy exec host [--commands=command1,command2, ... | -c command1,command2, ...] [--hosts=host1,hosts2, ... | -m host1,host2, ...] [flags]
|
backy exec host [--commands=command1 -commands=command2 ... | -c command1 -c command2 ...] [--hosts=host1 --hosts=hosts2 ... | -m host1 -m host2 ...] [flags]
|
||||||
```
|
```
|
||||||
|
|||||||
29
docs/content/cli/list.md
Executable file
29
docs/content/cli/list.md
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
title: List
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
List commands, lists, or hosts defined in config file
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
```
|
||||||
|
backy list [command]
|
||||||
|
```
|
||||||
|
|
||||||
|
Available Commands:
|
||||||
|
cmds List commands defined in config file.
|
||||||
|
lists List lists defined in config file.
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
```
|
||||||
|
-h, --help help for list
|
||||||
|
```
|
||||||
|
|
||||||
|
Global Flags:
|
||||||
|
```
|
||||||
|
--cmdStdOut Pass to print command output to stdout
|
||||||
|
-f, --config string config file to read from
|
||||||
|
--log-file string log file to write to
|
||||||
|
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
|
-v, --verbose Sets verbose level
|
||||||
|
```
|
||||||
26
docs/content/config/_index.md
Normal file → Executable file
26
docs/content/config/_index.md
Normal file → Executable file
@@ -10,13 +10,31 @@ This is the section on the config file.
|
|||||||
To use a specific file:
|
To use a specific file:
|
||||||
```backy [command] -f /path/to/file```
|
```backy [command] -f /path/to/file```
|
||||||
|
|
||||||
|
You can also use a remote file:
|
||||||
|
```
|
||||||
|
backy [command] -f `s3/http source`
|
||||||
|
```
|
||||||
|
|
||||||
|
See remote resources docs for specific info.
|
||||||
|
|
||||||
If you leave the config path blank, the following paths will be searched in order:
|
If you leave the config path blank, the following paths will be searched in order:
|
||||||
|
|
||||||
1. `./backy.yml`
|
1. `./backy.yml`
|
||||||
2. `./backy.yaml`
|
2. `./backy.yaml`
|
||||||
3. `~/.config/backy.yml`
|
3. The same two files above contained in a `backy` subdirectory under in what is returned by Go's `os` package function `UserConfigDir()`.
|
||||||
4. `~/.config/backy.yaml`
|
|
||||||
|
|
||||||
Create a file at `~/.config/backy.yml`.
|
{{% expand title="`UserConfigDir()` documentation:" %}}
|
||||||
|
|
||||||
See the rest of the documentation in this section to configure it.
|
Up-to date documentation for this function may be found on [GoDoc](https://pkg.go.dev/os#UserConfigDir).
|
||||||
|
|
||||||
|
>UserConfigDir returns the default root directory to use for user-specific configuration data. Users should create their own application-specific subdirectory within this one and use that.
|
||||||
|
|
||||||
|
>On Unix systems, it returns $XDG_CONFIG_HOME as specified by https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.config. On Darwin, it returns $HOME/Library/Application Support. On Windows, it returns %AppData%. On Plan 9, it returns $home/lib.
|
||||||
|
|
||||||
|
>If the location cannot be determined (for example, $HOME is not defined), then it will return an error.
|
||||||
|
|
||||||
|
{{% /expand %}}
|
||||||
|
|
||||||
|
See the rest of the documentation, titles included below, in this section to configure it.
|
||||||
|
|
||||||
|
{{% children description="true" %}}
|
||||||
36
docs/content/config/command-lists.md
Normal file → Executable file
36
docs/content/config/command-lists.md
Normal file → Executable file
@@ -2,7 +2,7 @@
|
|||||||
title: "Command Lists"
|
title: "Command Lists"
|
||||||
weight: 2
|
weight: 2
|
||||||
description: >
|
description: >
|
||||||
This page tells you how to get started with Backy.
|
This page tells you how to use command lists.
|
||||||
---
|
---
|
||||||
|
|
||||||
Command lists are for executing commands in sequence and getting notifications from them.
|
Command lists are for executing commands in sequence and getting notifications from them.
|
||||||
@@ -11,10 +11,18 @@ The top-level object key can be anything you want but not the same as another.
|
|||||||
|
|
||||||
Lists can go in a separate file. Command lists should be in a separate file if:
|
Lists can go in a separate file. Command lists should be in a separate file if:
|
||||||
|
|
||||||
1. key 'cmd-lists.file' is found
|
1. key 'cmdLists.file' is specified
|
||||||
2. hosts.yml or hosts.yaml is found in the same directory as the backy config file
|
2. lists.yml or lists.yaml is found in the same directory as the backy config file (this includes remote config files as of v0.7.0)
|
||||||
|
|
||||||
```yaml
|
{{% notice info %}}
|
||||||
|
The lists file is also checked in remote resources.
|
||||||
|
|
||||||
|
The lists file is ignored under the following condition:
|
||||||
|
|
||||||
|
If a remote config file is specified (on the command-line using `-f`) and the lists file is not found in the same directory, the lists file is assumed to not exist.
|
||||||
|
{{% /notice %}}
|
||||||
|
|
||||||
|
```yaml {lineNos="true" wrap="true" title="yaml"}
|
||||||
test2:
|
test2:
|
||||||
name: test2
|
name: test2
|
||||||
order:
|
order:
|
||||||
@@ -27,12 +35,12 @@ Lists can go in a separate file. Command lists should be in a separate file if:
|
|||||||
```
|
```
|
||||||
|
|
||||||
| key | description | type | required
|
| key | description | type | required
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | ---
|
||||||
| `order` | Defines the sequence of commands to execute | `[]string` | yes |
|
| `order` | Defines the sequence of commands to execute | `[]string` | yes
|
||||||
| `getOutput` | Command(s) output is in the notification(s) | `bool` | no |
|
| `sendNotificationOnSuccess` | Whether to send notification on list success with the commands' output | `bool` | no
|
||||||
| `notifications` | The notification service(s) and ID(s) to use on success and failure. Must be *`service.id`*. See the [notifications documentation page](/config/notifications/) for more | `[]string` | no |
|
| `notifications` | The notification service(s) and ID(s) to use on success and failure. Must be *`service.id`*. See the [notifications documentation page](/config/notifications/) for more | `[]string` | no
|
||||||
| `name` | Optional name of the list | `string` | no |
|
| `name` | Optional name of the list | `string` | no
|
||||||
| `cron` | Time at which to schedule the list. Only has affect when cron subcommand is run. | `string` | no |
|
| `cron` | Time at which to schedule the list. Only has affect when cron subcommand is run. | `string` | no
|
||||||
|
|
||||||
### Order
|
### Order
|
||||||
|
|
||||||
@@ -62,14 +70,14 @@ Name is optional. If name is not defined, name will be the object's map key.
|
|||||||
|
|
||||||
Backy also has a cron mode, so one can run `backy cron` and start a process that schedules jobs to run at times defined in the configuration file.
|
Backy also has a cron mode, so one can run `backy cron` and start a process that schedules jobs to run at times defined in the configuration file.
|
||||||
|
|
||||||
Adding `cron: 0 0 1 * * *` to a `cmd-lists` object will schedule the list at 1 in the morning. See [https://crontab.guru/](https://crontab.guru/) for reference.
|
Adding `cron: 0 0 1 * * *` to a `cmdLists` object will schedule the list at 1 in the morning. See [https://crontab.guru/](https://crontab.guru/) for reference.
|
||||||
|
|
||||||
{{% notice tip %}}
|
{{% notice tip %}}
|
||||||
Note: Backy uses the second field of cron, so add anything except * to the beginning of a regular cron expression.
|
Note: Backy uses the second field of cron, so add anything except `*` to the beginning of a regular cron expression.
|
||||||
{{% /notice %}}
|
{{% /notice %}}
|
||||||
|
|
||||||
```yaml
|
```yaml {lineNos="true" wrap="true" title="yaml"}
|
||||||
cmd-lists:
|
cmdLists:
|
||||||
docker-container-backup: # this can be any name you want
|
docker-container-backup: # this can be any name you want
|
||||||
# all commands have to be defined
|
# all commands have to be defined
|
||||||
order:
|
order:
|
||||||
|
|||||||
@@ -1,152 +0,0 @@
|
|||||||
---
|
|
||||||
title: "Commands"
|
|
||||||
weight: 1
|
|
||||||
---
|
|
||||||
|
|
||||||
The yaml top-level map can be any string.
|
|
||||||
|
|
||||||
The top-level name must be unique.
|
|
||||||
|
|
||||||
### Example Config
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
commands:
|
|
||||||
stop-docker-container:
|
|
||||||
cmd: docker
|
|
||||||
Args:
|
|
||||||
- compose
|
|
||||||
- -f /some/path/to/docker-compose.yaml
|
|
||||||
- down
|
|
||||||
# if host is not defined, command will be run locally
|
|
||||||
# The host has to be defined in either the config file or the SSH Config files
|
|
||||||
host: some-host
|
|
||||||
hooks
|
|
||||||
error:
|
|
||||||
- some-other-command-when-failing
|
|
||||||
success:
|
|
||||||
- success-command
|
|
||||||
final:
|
|
||||||
- final-command
|
|
||||||
backup-docker-container-script:
|
|
||||||
cmd: /path/to/local/script
|
|
||||||
# script file is input as stdin to SSH
|
|
||||||
type: scriptFile # also can be script
|
|
||||||
environment:
|
|
||||||
- FOO=BAR
|
|
||||||
- APP=$VAR
|
|
||||||
```
|
|
||||||
|
|
||||||
Values available for this section **(case-sensitive)**:
|
|
||||||
|
|
||||||
| name | notes | type | required
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| `cmd` | Defines the command to execute | `string` | yes |
|
|
||||||
| `Args` | Defines the arguments to the command | `[]string` | no |
|
|
||||||
| `environment` | Defines evironment variables for the command | `[]string` | no |
|
|
||||||
| `type` | May be `scriptFile`, `script`, or `package`. Runs script from local machine on remote. `Package` is the only one that can be run on local and remote hosts. | `string` | no |
|
|
||||||
| `getOutput` | Command(s) output is in the notification(s) | `bool` | no |
|
|
||||||
| `host` | If not specified, the command will execute locally. | `string` | no |
|
|
||||||
| `scriptEnvFile` | When type is `scriptFile` or `script`, this file is prepended to the input. | `string` | no |
|
|
||||||
| `shell` | Run the command in the shell | `string` | no |
|
|
||||||
| `hooks` | Hooks are used at the end of the individual command. Must have at least `error`, `success`, or `final`. | `map[string][]string` | no |
|
|
||||||
|
|
||||||
#### cmd
|
|
||||||
|
|
||||||
cmd must be a valid command or script to execute.
|
|
||||||
|
|
||||||
#### Args
|
|
||||||
|
|
||||||
args must be arguments to cmd as they would be passed on the command-line:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cmd [arg1 arg2 ...]
|
|
||||||
```
|
|
||||||
|
|
||||||
Define them in an array:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Args:
|
|
||||||
- arg1
|
|
||||||
- arg2
|
|
||||||
- arg3
|
|
||||||
```
|
|
||||||
|
|
||||||
### getOutput
|
|
||||||
|
|
||||||
Get command output when a notification is sent.
|
|
||||||
|
|
||||||
Is not required. Can be `true` or `false`.
|
|
||||||
|
|
||||||
#### host
|
|
||||||
|
|
||||||
{{% notice info %}}
|
|
||||||
If any `host` is not defined or left blank, the command will run on the local machine.
|
|
||||||
{{% /notice %}}
|
|
||||||
|
|
||||||
Host may or may not be defined in the `hosts` section.
|
|
||||||
|
|
||||||
{{% notice info %}}
|
|
||||||
If any `host` from the commands section does not match any object in the `hosts` section, the `Host` is assumed to be this value. This value will be used to search in the default SSH config files.
|
|
||||||
|
|
||||||
For example, say that I have a host defined in my SSH config with the `Host` defined as `web-prod`.
|
|
||||||
If I assign a value to host as `host: web-prod` and don't specify this value in the `hosts` object, web-prod will be used as the `Host` in searching the SSH config files.
|
|
||||||
{{% /notice %}}
|
|
||||||
|
|
||||||
### shell
|
|
||||||
|
|
||||||
If shell is defined, the command will run in the specified shell.
|
|
||||||
Make sure to escape any shell input.
|
|
||||||
|
|
||||||
### scriptEnvFile
|
|
||||||
|
|
||||||
Path to a file.
|
|
||||||
|
|
||||||
When type is `script` or `scriptFile` , the script is appended to this file.
|
|
||||||
|
|
||||||
This is useful for specifying environment variables or other things so they don't have to be included in the script.
|
|
||||||
|
|
||||||
### type
|
|
||||||
|
|
||||||
May be `scriptFile` or `script`. Runs script from local machine on remote host passed to the SSH session as standard input.
|
|
||||||
|
|
||||||
If `type` is `script`, `cmd` is used as the script.
|
|
||||||
|
|
||||||
If `type` is `scriptFile`, cmd must be a script file.
|
|
||||||
|
|
||||||
If `type` is `package`, there are additional fields that must be specified.
|
|
||||||
|
|
||||||
### environment
|
|
||||||
|
|
||||||
The environment variables support expansion:
|
|
||||||
|
|
||||||
- using escaped values `$VAR` or `${VAR}`
|
|
||||||
|
|
||||||
For now, the variables have to be defined in an `.env` file in the same directory as the config file.
|
|
||||||
|
|
||||||
If using it with host specified, the SSH server has to be configured to accept those env variables.
|
|
||||||
|
|
||||||
If the command is run locally, the OS's environment is added.
|
|
||||||
|
|
||||||
### hooks
|
|
||||||
|
|
||||||
Hooks are run after the command is run.
|
|
||||||
|
|
||||||
Errors are run if the command errors, success if it returns no error. Final hooks are run regardless of error condition.
|
|
||||||
|
|
||||||
Values for hooks are as follows:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
command:
|
|
||||||
hook:
|
|
||||||
# these commands are defined elsewhere in the file
|
|
||||||
error:
|
|
||||||
- errcommand
|
|
||||||
success:
|
|
||||||
- successcommand
|
|
||||||
final:
|
|
||||||
- donecommand
|
|
||||||
```
|
|
||||||
|
|
||||||
### packages
|
|
||||||
|
|
||||||
See the [dedicated page](/config/packages) for package configuration.
|
|
||||||
128
docs/content/config/commands/_index.md
Executable file
128
docs/content/config/commands/_index.md
Executable file
@@ -0,0 +1,128 @@
|
|||||||
|
---
|
||||||
|
title: "Commands"
|
||||||
|
description: Commands are just that, commands
|
||||||
|
weight: 1
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example Config
|
||||||
|
|
||||||
|
{{% code file="/examples/example.yml" language="yaml" %}}
|
||||||
|
|
||||||
|
Values available for this section **(case-sensitive)**:
|
||||||
|
|
||||||
|
| name | notes | type | required | External directive support |
|
||||||
|
| ----------------| ------------------------------------------------------------------------------------------------------- | --------------------- | -------- |----------------------------|
|
||||||
|
| `cmd` | Defines the command to execute | `string` | yes | No |
|
||||||
|
| `Args` | Defines the arguments to the command | `[]string` | no | No |
|
||||||
|
| `environment` | Defines environment variables for the command | `[]string` | no | Partial |
|
||||||
|
| `type` | See documentation further down the page. Additional fields may be required. | `string` | no | No |
|
||||||
|
| `getOutput` | Command(s) output is in the notification(s) | `bool` | no | No |
|
||||||
|
| `host` | If not specified, the command will execute locally. | `string` | no | No |
|
||||||
|
| `scriptEnvFile` | When type is `scriptFile` or `script`, this file is prepended to the input. | `string` | no | No |
|
||||||
|
| `shell` | Run the command in the shell | `string` | no | No |
|
||||||
|
| `hooks` | Hooks are used at the end of the individual command. Must have at least `error`, `success`, or `final`. | `map[string][]string` | no | No |
|
||||||
|
|
||||||
|
#### cmd
|
||||||
|
|
||||||
|
cmd must be a valid command or script to execute.
|
||||||
|
|
||||||
|
#### Args
|
||||||
|
|
||||||
|
args must be arguments to cmd as they would be passed on the command-line:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cmd [arg1 arg2 ...]
|
||||||
|
```
|
||||||
|
|
||||||
|
Define them in an array:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Args:
|
||||||
|
- arg1
|
||||||
|
- arg2
|
||||||
|
- arg3
|
||||||
|
```
|
||||||
|
|
||||||
|
### getOutput
|
||||||
|
|
||||||
|
Get command output when a notification is sent.
|
||||||
|
|
||||||
|
Is not required. Can be `true` or `false`.
|
||||||
|
|
||||||
|
#### host
|
||||||
|
|
||||||
|
{{% notice info %}}
|
||||||
|
If any `host` is not defined or left blank, the command will run on the local machine.
|
||||||
|
{{% /notice %}}
|
||||||
|
|
||||||
|
Host may or may not be defined in the `hosts` section.
|
||||||
|
|
||||||
|
{{% notice info %}}
|
||||||
|
If any `host` from the commands section does not match any object in the `hosts` section, the `Host` is assumed to be this value. This value will be used to search in the default SSH config files.
|
||||||
|
|
||||||
|
For example, say that I have a host defined in my SSH config with the `Host` defined as `web-prod`.
|
||||||
|
If I assign a value to host as `host: web-prod` and don't specify this value in the `hosts` object, web-prod will be used as the `Host` in searching the SSH config files.
|
||||||
|
{{% /notice %}}
|
||||||
|
|
||||||
|
### shell
|
||||||
|
|
||||||
|
If shell is defined, the command will run in the specified shell.
|
||||||
|
Make sure to escape any shell input.
|
||||||
|
|
||||||
|
### scriptEnvFile
|
||||||
|
|
||||||
|
Path to a file.
|
||||||
|
|
||||||
|
When type is `script` or `scriptFile` , the script is appended to this file.
|
||||||
|
|
||||||
|
This is useful for specifying environment variables or other things so they don't have to be included in the script.
|
||||||
|
|
||||||
|
### type
|
||||||
|
|
||||||
|
The following options are available:
|
||||||
|
|
||||||
|
| name | description |
|
||||||
|
| --- | --- |
|
||||||
|
| script | `cmd` is used as the script |
|
||||||
|
| scriptFile | Can only be run on a host. `cmd` is read and used as the script, and `scriptEnvFile` can be used to add env variables |
|
||||||
|
| package | Run package operations. See [dedicated page](/config/packages) for configuring package commands |
|
||||||
|
| user | Run user operations. See [dedicated page](/config/user-commands) for configuring package commands |
|
||||||
|
|
||||||
|
### environment
|
||||||
|
|
||||||
|
The environment variables support expansion:
|
||||||
|
|
||||||
|
- using escaped values `$VAR` or `${VAR}`
|
||||||
|
- using any external directive, and if using the env directive, the variable will be read from a `.env` file
|
||||||
|
|
||||||
|
<!-- For now, the variables expanded have to be defined in an `.env` file in the same directory that the program is run from. -->
|
||||||
|
|
||||||
|
If using it with host specified, the SSH server has to be configured to accept those env variables.
|
||||||
|
|
||||||
|
If the command is run locally, the OS's environment is added.
|
||||||
|
|
||||||
|
### hooks
|
||||||
|
|
||||||
|
Hooks are run after the command is run.
|
||||||
|
|
||||||
|
Errors are run if the command errors, success if it returns no error. Final hooks are run regardless of error condition.
|
||||||
|
|
||||||
|
Values for hooks are as follows:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
command:
|
||||||
|
hook:
|
||||||
|
# these commands are defined elsewhere in the file
|
||||||
|
error:
|
||||||
|
- errcommand
|
||||||
|
success:
|
||||||
|
- successcommand
|
||||||
|
final:
|
||||||
|
- donecommand
|
||||||
|
```
|
||||||
|
|
||||||
|
### packages
|
||||||
|
|
||||||
|
See the [dedicated page](/config/packages) for package configuration.
|
||||||
10
docs/content/config/packages.md → docs/content/config/commands/packages.md
Normal file → Executable file
10
docs/content/config/packages.md → docs/content/config/commands/packages.md
Normal file → Executable file
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: "Packages"
|
title: "Packages"
|
||||||
weight: 2
|
weight: 2
|
||||||
|
description: This is dedicated to package commands.
|
||||||
---
|
---
|
||||||
|
|
||||||
This is dedicated to `package` commands. The command `type` field must be `package`. Package is a type that allows one to perform package operations. There are several additional options available when `type` is `package`:
|
This is dedicated to `package` commands. The command `type` field must be `package`. Package is a type that allows one to perform package operations. There are several additional options available when `type` is `package`:
|
||||||
@@ -9,8 +10,8 @@ This is dedicated to `package` commands. The command `type` field must be `packa
|
|||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| `packageName` | The name of a package to be modified. | `string` | yes |
|
| `packageName` | The name of a package to be modified. | `string` | yes |
|
||||||
| `packageManager` | The name of the package manger to be used. | `string` | yes |
|
| `packageManager` | The name of the package manger to be used. | `string` | yes |
|
||||||
| `packageOperation` | The type of operation to be perform. | `string` | yes |
|
| `packageOperation` | The type of operation to perform. | `string` | yes |
|
||||||
| `packageVersion` | The version of a package to be modified. | `string` | no |
|
| `packageVersion` | The version of a package. | `string` | no |
|
||||||
|
|
||||||
|
|
||||||
#### example
|
#### example
|
||||||
@@ -34,6 +35,7 @@ The following package operations are supported:
|
|||||||
- `install`
|
- `install`
|
||||||
- `remove`
|
- `remove`
|
||||||
- `upgrade`
|
- `upgrade`
|
||||||
|
- `checkVersion`
|
||||||
|
|
||||||
#### packageManager
|
#### packageManager
|
||||||
|
|
||||||
@@ -45,11 +47,11 @@ The following package managers are recognized:
|
|||||||
|
|
||||||
#### package command args
|
#### package command args
|
||||||
|
|
||||||
You can add additional arguments using the standard `Args` key. This is useful for adding more packages.
|
You can add additional arguments using the standard `Args` key. This is useful for adding more packages, yet it does not work with `checkVersion`.
|
||||||
|
|
||||||
### Development
|
### Development
|
||||||
|
|
||||||
The PackageManager interface provides an easy to enforce functions and options. There are two interfaces, `PackageManager` and `ConfigurablePackageManager` in the directory `pkg/pkgman`. Go's import-cycle "feature" caused me to implement functional options using a third interface. `PackageManagerOption`is a function that takes an interface.
|
The PackageManager interface provides an easy way to enforce functions and options. There are two interfaces, `PackageManager` and `ConfigurablePackageManager` in the directory `pkg/pkgman`. Go's import-cycle "feature" caused me to implement functional options using a third interface. `PackageManagerOption`is a function that takes an interface.
|
||||||
|
|
||||||
#### PackageManager
|
#### PackageManager
|
||||||
|
|
||||||
66
docs/content/config/commands/user-commands.md
Executable file
66
docs/content/config/commands/user-commands.md
Executable file
@@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
title: "User commands"
|
||||||
|
weight: 2
|
||||||
|
description: This is dedicated to user commands.
|
||||||
|
---
|
||||||
|
|
||||||
|
This is dedicated to `user` commands. The command `type` field must be `user`. User is a type that allows one to perform user operations. There are several additional options available when `type` is `user`:
|
||||||
|
|
||||||
|
| name | notes | type | required | External directive support
|
||||||
|
| ----------------| -------------------------------------------------------------| ---------- | ---------| --------------------------|
|
||||||
|
| `userName` | The name of a user to be configured. | `string` | yes | no |
|
||||||
|
| `userOperation` | The type of operation to perform. | `string` | yes | no |
|
||||||
|
| `userID` | The user ID to use. | `string` | no | no |
|
||||||
|
| `userGroups` | The groups the user should be added to. | `[]string` | no | no |
|
||||||
|
| `systemUser` | Create a system user. | `bool` | no | no |
|
||||||
|
| `userCreateHome`| Create the home directory. | `bool` | no | no |
|
||||||
|
| `userSshPubKeys`| The keys to add to the user's authorized keys. | `[]string` | no | yes |
|
||||||
|
| `userShell` | The shell for the user. | `string` | no | no |
|
||||||
|
| `userHome` | The user's home directory. | `string` | no | no |
|
||||||
|
| `userPassword` | The new password value when using the `password` operation. | `string` | no | yes |
|
||||||
|
|
||||||
|
|
||||||
|
#### example
|
||||||
|
|
||||||
|
The following is an example of a package command:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
addUser:
|
||||||
|
name: add user backy with custom home dir
|
||||||
|
type: user
|
||||||
|
userName: backy
|
||||||
|
userHome: /opt/backy
|
||||||
|
userOperation: add
|
||||||
|
host: some-host
|
||||||
|
```
|
||||||
|
|
||||||
|
#### userOperation
|
||||||
|
|
||||||
|
The following package operations are supported:
|
||||||
|
|
||||||
|
- `add`
|
||||||
|
- `remove`
|
||||||
|
- `modify`
|
||||||
|
- `password`
|
||||||
|
- `checkIfExists`
|
||||||
|
|
||||||
|
### Development
|
||||||
|
|
||||||
|
The UserManager interface provides an way easy to add new commands. There is one interface `Usermanager` in directory `pkg/usermanager`.
|
||||||
|
|
||||||
|
#### UserManager
|
||||||
|
|
||||||
|
```go
|
||||||
|
// UserManager defines the interface for user management operations.
|
||||||
|
// All functions but one return a string for the command and any args.
|
||||||
|
type UserManager interface {
|
||||||
|
AddUser(username, homeDir, shell string, isSystem bool, groups, args []string) (string, []string)
|
||||||
|
RemoveUser(username string) (string, []string)
|
||||||
|
ModifyUser(username, homeDir, shell string, groups []string) (string, []string)
|
||||||
|
// Modify password uses chpasswd for Linux systems to build the command to change the password
|
||||||
|
// Should return a password as the last argument
|
||||||
|
// TODO: refactor when adding more systems instead of Linux
|
||||||
|
ModifyPassword(username, password string) (string, *strings.Reader, string)
|
||||||
|
UserExists(username string) (string, []string)
|
||||||
|
}
|
||||||
|
```
|
||||||
15
docs/content/config/directives.md
Executable file
15
docs/content/config/directives.md
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "External Directives"
|
||||||
|
weight: 2
|
||||||
|
description: How to set up external directives.
|
||||||
|
---
|
||||||
|
|
||||||
|
External directives are for including data that should not be in the config file. The following directives are supported:
|
||||||
|
|
||||||
|
- `%{file:path/to/file}%`
|
||||||
|
- `%{env:ENV_VAR}%`
|
||||||
|
- `%{vault:vault-key}%`
|
||||||
|
|
||||||
|
See the docs of each command if the field is supported.
|
||||||
|
|
||||||
|
If the file path does not begin with a `/`, the config file's directory will be used as the starting point.
|
||||||
24
docs/content/config/hosts.md
Executable file
24
docs/content/config/hosts.md
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
title: "Hosts"
|
||||||
|
weight: 2
|
||||||
|
description: >
|
||||||
|
This page tells you how to use hosts.
|
||||||
|
---
|
||||||
|
|
||||||
|
| Key | Description | Type | Required | External directive support |
|
||||||
|
|----------------------|---------------------------------------------------------------|----------|----------|----------------------------|
|
||||||
|
| `OS` | Operating system of the host (used for package commands) | `string` | no | No |
|
||||||
|
| `config` | Path to the SSH config file | `string` | no | No |
|
||||||
|
| `host` | Specifies the `Host` ssh_config(5) directive | `string` | yes | No |
|
||||||
|
| `hostname` | Hostname of the host | `string` | no | No |
|
||||||
|
| `knownHostsFile` | Path to the known hosts file | `string` | no | No |
|
||||||
|
| `port` | Port number to connect to | `uint16` | no | No |
|
||||||
|
| `proxyjump` | Proxy jump hosts, comma-separated | `string` | no | No |
|
||||||
|
| `password` | Password for SSH authentication | `string` | no | No |
|
||||||
|
| `privateKeyPath` | Path to the private key file | `string` | no | No |
|
||||||
|
| `privateKeyPassword` | Password for the private key file | `string` | no | Yes |
|
||||||
|
| `user` | Username for SSH authentication | `string` | no | No |
|
||||||
|
|
||||||
|
## exec host subcommand
|
||||||
|
|
||||||
|
Backy has a subcommand `exec host`. This subcommand takes the flags of `-m host1 -m host2`. The commands can also be specified by `-c command1 -c command2`.
|
||||||
29
docs/content/config/notifications.md
Normal file → Executable file
29
docs/content/config/notifications.md
Normal file → Executable file
@@ -5,6 +5,7 @@ description: >
|
|||||||
This page tells you how to get set up Backy notifications.
|
This page tells you how to get set up Backy notifications.
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Notifications are only configurable for command lists, as of right now.
|
||||||
|
|
||||||
Notifications can be sent on command list completion and failure.
|
Notifications can be sent on command list completion and failure.
|
||||||
|
|
||||||
@@ -38,23 +39,23 @@ There must be a section with an id (eg. `mail.test-svr`) following one of these
|
|||||||
|
|
||||||
### mail
|
### mail
|
||||||
|
|
||||||
| key | description | type
|
| key | description | type | External directive support |
|
||||||
| --- | --- | ---
|
| --- | --- | --- | --- |
|
||||||
| `host` | Specifies the SMTP host to connect to | `string`
|
| `host` | Specifies the SMTP host to connect to | `string` | no
|
||||||
| `port` | Specifies the SMTP port | `uint16`
|
| `port` | Specifies the SMTP port | `uint16` | no
|
||||||
| `senderaddress` | Address from which to send mail | `string`
|
| `senderaddress` | Address from which to send mail | `string` | no
|
||||||
| `to` | Recipients to send emails to | `[]string`
|
| `to` | Recipients to send emails to | `[]string` | no
|
||||||
| `username` | SMTP username | `string`
|
| `username` | SMTP username | `string` | no
|
||||||
| `password` | SMTP password | `string`
|
| `password` | SMTP password | `string` | yes
|
||||||
|
|
||||||
### matrix
|
### matrix
|
||||||
|
|
||||||
| key | description | type
|
| key | description | type | External directive support |
|
||||||
| --- | --- | ---
|
| --- | --- | ---| ---- |
|
||||||
| `home-server` | Specifies the Matrix server connect to | `string`
|
| `home-server` | Specifies the Matrix server connect to | `string` | no
|
||||||
| `room-id` | Specifies the room ID of the room to send messages to | `string`
|
| `room-id` | Specifies the room ID of the room to send messages to | `string` | no
|
||||||
| `access-token` | Matrix access token | `string`
|
| `access-token` | Matrix access token | `string` | yes
|
||||||
| `user-id` | Matrix user ID | `string`
|
| `user-id` | Matrix user ID | `string` | no
|
||||||
|
|
||||||
To get your access token (assumes you are using [Element](https://element.io/)) :
|
To get your access token (assumes you are using [Element](https://element.io/)) :
|
||||||
|
|
||||||
|
|||||||
21
docs/content/config/remote-resources.md
Executable file
21
docs/content/config/remote-resources.md
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
title: "Remote resources"
|
||||||
|
weight: 2
|
||||||
|
description: This is dedicated to configuring remote resources.
|
||||||
|
---
|
||||||
|
|
||||||
|
Remote resources can be used for a lot of things, including config files and scripts.
|
||||||
|
|
||||||
|
## Config file
|
||||||
|
|
||||||
|
For the main config file to be fetched remotely, pass the URL using `-f [url]`.
|
||||||
|
|
||||||
|
If using S3, you should use the s3 protocol URI: `s3://bucketName/key/path`. You will also need to set the env variable `S3_ENDPOINT` to the appropriate value. The flag `--s3-endpoint` can be used to override this value or to set this value, if not already set.
|
||||||
|
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
Currently, only the AWS authentication credentials file `~/.aws/credentials` is supported. For now, the environment variable `AWS_PROFILE` is used to lookup the profile.
|
||||||
|
|
||||||
|
## Scripts
|
||||||
|
|
||||||
|
Remote script support is currently limited to http/https endpoints.
|
||||||
15
docs/content/config/vault.md
Normal file → Executable file
15
docs/content/config/vault.md
Normal file → Executable file
@@ -1,11 +1,12 @@
|
|||||||
---
|
---
|
||||||
title: "Vault"
|
title: "Vault"
|
||||||
weight: 4
|
weight: 4
|
||||||
|
description: Set up and configure vault.
|
||||||
---
|
---
|
||||||
|
|
||||||
[Vault](https://www.vaultproject.io/) is a tool for storing secrets and other data securely.
|
[Vault](https://www.vaultproject.io/) is a tool for storing secrets and other data securely.
|
||||||
|
|
||||||
Vault config can be used by prefixing `vault:` in front of a password or ENV var.
|
A Vault key can be used by prefixing `%{vault:vault.keys.name}%` in a field that supports external directives.
|
||||||
|
|
||||||
This is the object in the config file:
|
This is the object in the config file:
|
||||||
|
|
||||||
@@ -17,10 +18,12 @@ vault:
|
|||||||
keys:
|
keys:
|
||||||
- name: mongourl
|
- name: mongourl
|
||||||
mountpath: secret
|
mountpath: secret
|
||||||
|
key: data
|
||||||
path: mongo/url
|
path: mongo/url
|
||||||
type: # KVv1 or KVv2
|
type: KVv2 # KVv1 or KVv2
|
||||||
- name:
|
- name: someKeyName
|
||||||
path:
|
mountpath: secret
|
||||||
type:
|
key: keyData
|
||||||
mountpath:
|
type: KVv2
|
||||||
|
path: some/path
|
||||||
```
|
```
|
||||||
|
|||||||
108
docs/content/examples/backy.yaml
Executable file
108
docs/content/examples/backy.yaml
Executable file
@@ -0,0 +1,108 @@
|
|||||||
|
commands:
|
||||||
|
stop-docker-container:
|
||||||
|
cmd: docker
|
||||||
|
Args:
|
||||||
|
- compose
|
||||||
|
- -f /some/path/to/docker-compose.yaml
|
||||||
|
- down
|
||||||
|
# if host is not defined, cmd will be run locally
|
||||||
|
host: some-host
|
||||||
|
hooks:
|
||||||
|
final:
|
||||||
|
- hostname
|
||||||
|
error:
|
||||||
|
- hostname
|
||||||
|
backup-docker-container-script:
|
||||||
|
cmd: /path/to/script
|
||||||
|
# The host has to be defined in the config file
|
||||||
|
host: some-host
|
||||||
|
environment:
|
||||||
|
- FOO=BAR
|
||||||
|
- APP=$VAR
|
||||||
|
shell-cmd:
|
||||||
|
cmd: rsync
|
||||||
|
shell: bash
|
||||||
|
Args:
|
||||||
|
- -av some-host:/path/to/data ~/Docker/Backups/docker-data
|
||||||
|
hostname:
|
||||||
|
cmd: hostname
|
||||||
|
update-docker:
|
||||||
|
type: package
|
||||||
|
shell: zsh # best to run package commands in a shell
|
||||||
|
packageName: docker-ce
|
||||||
|
Args:
|
||||||
|
- docker-ce-cli
|
||||||
|
packageManager: apt
|
||||||
|
packageOperation: install
|
||||||
|
update-dockerApt:
|
||||||
|
# type: package
|
||||||
|
shell: zsh
|
||||||
|
cmd: apt
|
||||||
|
Args:
|
||||||
|
- update
|
||||||
|
- "&&"
|
||||||
|
- apt install -y docker-ce
|
||||||
|
- docker-ce-cli
|
||||||
|
packageManager: apt
|
||||||
|
packageOperation: install
|
||||||
|
|
||||||
|
cmd-lists:
|
||||||
|
cmds-to-run: # this can be any name you want
|
||||||
|
# all commands have to be defined
|
||||||
|
order:
|
||||||
|
- stop-docker-container
|
||||||
|
- backup-docker-container-script
|
||||||
|
- shell-cmd
|
||||||
|
- hostname
|
||||||
|
notifications:
|
||||||
|
- matrix.matrix
|
||||||
|
name: backup-some-server
|
||||||
|
cron: "0 0 1 * * *"
|
||||||
|
hostname:
|
||||||
|
name: hostname
|
||||||
|
order:
|
||||||
|
- hostname
|
||||||
|
notifications:
|
||||||
|
- mail.prod-email
|
||||||
|
|
||||||
|
hosts:
|
||||||
|
# any ssh_config(5) keys/values not listed here will be looked up in the config file or the default config file
|
||||||
|
some-host:
|
||||||
|
hostname: some-hostname
|
||||||
|
config: ~/.ssh/config
|
||||||
|
user: user
|
||||||
|
privateKeyPath: /path/to/private/key
|
||||||
|
port: 22
|
||||||
|
# can also be env:VAR
|
||||||
|
password: file:/path/to/file
|
||||||
|
# only one is supported for now
|
||||||
|
proxyjump: some-proxy-host
|
||||||
|
|
||||||
|
# optional
|
||||||
|
logging:
|
||||||
|
verbose: true
|
||||||
|
file: ./backy.log
|
||||||
|
console: false
|
||||||
|
cmd-std-out: false
|
||||||
|
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
mail:
|
||||||
|
prod-email:
|
||||||
|
id: prod-email
|
||||||
|
type: mail
|
||||||
|
host: yourhost.tld
|
||||||
|
port: 587
|
||||||
|
senderAddress: email@domain.tld
|
||||||
|
to:
|
||||||
|
- admin@domain.tld
|
||||||
|
username: smtp-username@domain.tld
|
||||||
|
password: your-password-here
|
||||||
|
matrix:
|
||||||
|
matrix:
|
||||||
|
id: matrix
|
||||||
|
type: matrix
|
||||||
|
home-server: your-home-server.tld
|
||||||
|
room-id: room-id
|
||||||
|
access-token: your-access-token
|
||||||
|
user-id: your-user-id
|
||||||
24
docs/content/examples/example.yml
Executable file
24
docs/content/examples/example.yml
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
commands:
|
||||||
|
stop-docker-container:
|
||||||
|
cmd: docker
|
||||||
|
Args:
|
||||||
|
- compose
|
||||||
|
- -f /some/path/to/docker-compose.yaml
|
||||||
|
- down
|
||||||
|
# if host is not defined, command will be run locally
|
||||||
|
# The host has to be defined in either the config file or the SSH Config files
|
||||||
|
host: some-host
|
||||||
|
hooks:
|
||||||
|
error:
|
||||||
|
- some-other-command-when-failing
|
||||||
|
success:
|
||||||
|
- success-command
|
||||||
|
final:
|
||||||
|
- final-command
|
||||||
|
backup-docker-container-script:
|
||||||
|
cmd: /path/to/local/script
|
||||||
|
# script file is input as stdin to SSH
|
||||||
|
type: scriptFile # also can be script
|
||||||
|
environment:
|
||||||
|
- FOO=BAR
|
||||||
|
- APP=$VAR
|
||||||
0
docs/content/getting-started/_index.md
Normal file → Executable file
0
docs/content/getting-started/_index.md
Normal file → Executable file
12
docs/content/getting-started/config.md
Normal file → Executable file
12
docs/content/getting-started/config.md
Normal file → Executable file
@@ -48,7 +48,7 @@ commands:
|
|||||||
To execute groups of commands in sequence, use a list configuration.
|
To execute groups of commands in sequence, use a list configuration.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
cmd-lists:
|
cmdLists:
|
||||||
cmds-to-run: # this can be any name you want
|
cmds-to-run: # this can be any name you want
|
||||||
# all commands have to be defined in the commands section
|
# all commands have to be defined in the commands section
|
||||||
order:
|
order:
|
||||||
@@ -97,7 +97,7 @@ hosts:
|
|||||||
|
|
||||||
The notifications object can have two forms.
|
The notifications object can have two forms.
|
||||||
|
|
||||||
For more, [see the notification object documentation](/config/notifications). The top-level map key is id that has to be referenced by the `cmd-lists` key `notifications`.
|
For more, [see the notification object documentation](/config/notifications). The top-level map key is id that has to be referenced by the `cmdLists` key `notifications`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
notifications:
|
notifications:
|
||||||
@@ -124,13 +124,13 @@ notifications:
|
|||||||
|
|
||||||
### Logging
|
### Logging
|
||||||
|
|
||||||
cmd-std-out controls whether commands output is echoed to StdOut.
|
`cmd-std-out` controls whether commands output is echoed to StdOut.
|
||||||
|
|
||||||
If logfile is not defined, the log file will be written to the config directory in the file `backy.log`.
|
If `logfile` is not defined, the log file will be written to the config directory in the file `backy.log`.
|
||||||
|
|
||||||
`console-disabled` controls whether the logging messages are echoed to StdOut. Default is false.
|
`console-disabled` controls whether the logging messages are echoed to StdOut. Default is false.
|
||||||
|
|
||||||
`verbose` basically does nothing as all necessary info is already output.
|
`verbose` prints out debugging messages.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
logging:
|
logging:
|
||||||
@@ -144,7 +144,7 @@ logging:
|
|||||||
|
|
||||||
[Vault](https://www.vaultproject.io/) can be used to get some configuration values and ENV variables securely.
|
[Vault](https://www.vaultproject.io/) can be used to get some configuration values and ENV variables securely.
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
vault:
|
vault:
|
||||||
token: hvs.tXqcASvTP8wg92f7riyvGyuf
|
token: hvs.tXqcASvTP8wg92f7riyvGyuf
|
||||||
address: http://127.0.0.1:8200
|
address: http://127.0.0.1:8200
|
||||||
|
|||||||
0
docs/content/getting-started/install.md
Normal file → Executable file
0
docs/content/getting-started/install.md
Normal file → Executable file
0
docs/content/repositories/_index.md
Normal file → Executable file
0
docs/content/repositories/_index.md
Normal file → Executable file
4
docs/go.mod
Normal file → Executable file
4
docs/go.mod
Normal file → Executable file
@@ -3,6 +3,6 @@ module git.andrewnw.xyz/CyberShell/backy/docs
|
|||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/McShelby/hugo-theme-relearn v0.0.0-20230209073138-890d12ea922d // indirect
|
github.com/McShelby/hugo-theme-relearn v0.0.0-20251115105808-d9ca8e8d8f59 // indirect
|
||||||
github.com/divinerites/plausible-hugo v1.21.1 // indirect
|
github.com/divinerites/plausible-hugo v1.22.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
8
docs/go.sum
Normal file → Executable file
8
docs/go.sum
Normal file → Executable file
@@ -1,4 +1,4 @@
|
|||||||
github.com/McShelby/hugo-theme-relearn v0.0.0-20230209073138-890d12ea922d h1:weq1mrQ/qNAvGrNgvZVL1K8adbT3bswZf2ABLr/LCIA=
|
github.com/McShelby/hugo-theme-relearn v0.0.0-20251115105808-d9ca8e8d8f59 h1:mnEjz/Wrpv6Hea26KeFJPx94w9g9ZHIurUEWvPdaEvs=
|
||||||
github.com/McShelby/hugo-theme-relearn v0.0.0-20230209073138-890d12ea922d/go.mod h1:mKQQdxZNIlLvAj8X3tMq+RzntIJSr9z7XdzuMomt0IM=
|
github.com/McShelby/hugo-theme-relearn v0.0.0-20251115105808-d9ca8e8d8f59/go.mod h1:mKQQdxZNIlLvAj8X3tMq+RzntIJSr9z7XdzuMomt0IM=
|
||||||
github.com/divinerites/plausible-hugo v1.21.1 h1:ZTWwjhZ0PmLMacCVGlcGiYFEZW7VaYE767tchDskOug=
|
github.com/divinerites/plausible-hugo v1.22.0 h1:2pZheSaIMc+EtwcEeZv0ioU2qBOEZa1Ii7IaR/9II9k=
|
||||||
github.com/divinerites/plausible-hugo v1.21.1/go.mod h1:cxr+YB3FUwbLon8KCs4pV4Ankbkq6lJxTQUpNb5KqPo=
|
github.com/divinerites/plausible-hugo v1.22.0/go.mod h1:cxr+YB3FUwbLon8KCs4pV4Ankbkq6lJxTQUpNb5KqPo=
|
||||||
|
|||||||
17
docs/layouts/_default/baseof.html
Normal file → Executable file
17
docs/layouts/_default/baseof.html
Normal file → Executable file
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
{{- block "storeOutputFormat" . }}{{ end }}
|
{{- block "storeOutputFormat" . }}{{ end }}
|
||||||
{{- if .IsHome }}
|
{{- if .IsHome }}
|
||||||
{{- $hugoVersion := "0.126.0" }}
|
{{- $hugoVersion := "0.141.0" }}
|
||||||
{{- if lt hugo.Version $hugoVersion }}
|
{{- if lt hugo.Version $hugoVersion }}
|
||||||
{{- errorf "The Relearn theme requires Hugo %s or later" $hugoVersion }}
|
{{- errorf "The Relearn theme requires Hugo %s or later" $hugoVersion }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -36,12 +36,12 @@
|
|||||||
{{ (printf $link (partial "permalink.gotmpl" (dict "to" .)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }}
|
{{ (printf $link (partial "permalink.gotmpl" (dict "to" .)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- partialCached "favicon.html" . }}
|
{{- partialCached "favicon.html" . }}
|
||||||
{{- partial "stylesheet.html" . }}
|
{{- partial "dependencies.html" (dict "page" . "location" "header") }}
|
||||||
{{- partial "dependencies.gotmpl" (dict "page" . "location" "header") }}
|
|
||||||
{{- partial "custom-header.html" . }}
|
{{- partial "custom-header.html" . }}
|
||||||
</head>
|
</head>
|
||||||
<body class="mobile-support {{ with .Store.Get "relearnOutputFormat" }}{{ . }}{{ else }}html{{ end }}{{- if .Site.Params.disableInlineCopyToClipBoard }} disableInlineCopyToClipboard{{ end }}{{- if .Site.Params.disableHoverBlockCopyToClipBoard }} disableHoverBlockCopyToClipBoard{{ end }}" data-url="{{ partial "permalink.gotmpl" (dict "to" .) }}">
|
<body class="mobile-support {{ with .Store.Get "relearnOutputFormat" }}{{ . }}{{ else }}html{{ end }}{{- if .Site.Params.disableHoverBlockCopyToClipBoard }} disableHoverBlockCopyToClipBoard{{ end }}" data-url="{{ partial "permalink.gotmpl" (dict "to" .) }}">
|
||||||
<div id="R-body" class="default-animation">
|
<div id="R-body" class="default-animation">
|
||||||
<div id="R-body-overlay"></div>
|
<div id="R-body-overlay"></div>
|
||||||
<nav id="R-topbar">
|
<nav id="R-topbar">
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
{{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }}
|
{{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }}
|
||||||
{{- if $showBreadcrumb }}
|
{{- if $showBreadcrumb }}
|
||||||
<ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList">
|
<ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList">
|
||||||
{{- partial "breadcrumbs.html" (dict "page" .) }}
|
{{- partial "breadcrumbs.html" (dict "page" . "schema" true) }}
|
||||||
</ol>
|
</ol>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
<span class="topbar-breadcrumbs highlightable">
|
<span class="topbar-breadcrumbs highlightable">
|
||||||
@@ -74,11 +74,8 @@
|
|||||||
{{- partial "custom-comments.html" . }}
|
{{- partial "custom-comments.html" . }}
|
||||||
</div>
|
</div>
|
||||||
{{- block "menu" . }}{{ end }}
|
{{- block "menu" . }}{{ end }}
|
||||||
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
|
{{- partial "dependencies.html" (dict "page" . "location" "footer") }}
|
||||||
<script src="{{"js/clipboard.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
|
||||||
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ $assetBusting }}" defer></script>
|
|
||||||
{{- partial "dependencies.gotmpl" (dict "page" . "location" "footer") }}
|
|
||||||
<script src="{{"js/theme.js" | relURL}}{{ $assetBusting }}" defer></script>
|
|
||||||
{{- partial "custom-footer.html" . }}
|
{{- partial "custom-footer.html" . }}
|
||||||
|
<div id="toast-container" role="status" aria-live="polite" aria-atomic="false"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
0
docs/layouts/partials/logo.html
Normal file → Executable file
0
docs/layouts/partials/logo.html
Normal file → Executable file
3
docs/layouts/shortcodes/code.html
Executable file
3
docs/layouts/shortcodes/code.html
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
{{ $file := .Get "file" | readFile }}
|
||||||
|
{{ $lang := .Get "language" }}
|
||||||
|
{{ (print "```" $lang "\n" $file "\n```") }}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user