Compare commits

...

21 Commits

Author SHA1 Message Date
0581559783 Bump to the next version
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-06 12:34:15 +02:00
cdd196346a Add label generation checking
All checks were successful
continuous-integration/drone/push Build is passing
Closes https://git.autonomic.zone/coop-cloud/abra/issues/186.
2021-07-06 12:27:06 +02:00
78287fec37 Add change log entry
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-06 11:51:03 +02:00
4b820457de Output diff before committing changes
All checks were successful
continuous-integration/drone/push Build is passing
See https://git.autonomic.zone/coop-cloud/abra/issues/174.
2021-07-06 11:50:09 +02:00
8519cb8661 Appease shellcheck and revert to original quote handling
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-06 11:18:50 +02:00
3c30d3621b Support restarting a service
Closes https://git.autonomic.zone/coop-cloud/abra/issues/200.
2021-07-06 11:12:49 +02:00
76a0badc5a Add new change log entries 2021-07-06 10:53:31 +02:00
b2e0a95a11 Override ARGS and fail correctly
See https://github.com/Coop-Cloud/peertube/issues/1.
2021-07-06 10:53:08 +02:00
ace854e1d7 Don't describe the what here 2021-07-06 10:40:09 +02:00
bd7688f9e7 Do not install deps on CLI upgrade [ci skip] 2021-07-06 00:13:22 +02:00
d7a4c2cebe This has to be already installed [ci skip] 2021-07-06 00:12:02 +02:00
d9a0922b2c Add upgrade note [ci skip] 2021-07-06 00:09:25 +02:00
32a86e0317 Add change log entry
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-06 00:06:39 +02:00
b1c5391a91 Use latest yq 2021-07-06 00:06:07 +02:00
b813f6b90e Drop additional check
All checks were successful
continuous-integration/drone/push Build is passing
This forces the `require yq` to only happen at the start of the
top-level functions which makes more sense and is easier to manage.

Closes https://git.autonomic.zone/coop-cloud/abra/issues/183.
2021-07-06 00:04:19 +02:00
73de76fc04 Remove unused function 2021-07-06 00:04:14 +02:00
5c5cbbf20f Add ASCII radness [ci skip] 2021-07-06 00:01:32 +02:00
19498d9494 Fix typo [ci skip] 2021-07-05 23:58:39 +02:00
6f6a9ab413 Update change log entry
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-05 23:56:37 +02:00
aa81d26d08 Use pwgen/pwqgen if installed
Closes https://git.autonomic.zone/coop-cloud/abra/issues/197.
2021-07-05 23:55:23 +02:00
cc4efe69bf Merge pull request 'Install requirements via install script' (#198) from requirements-install-script into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://git.autonomic.zone/coop-cloud/abra/pulls/198
2021-07-05 23:49:26 +02:00
3 changed files with 174 additions and 119 deletions

View File

@ -9,6 +9,8 @@
# abra x.x.x (UNRELEASED) # abra x.x.x (UNRELEASED)
# abra 10.0.0 (2021-07-06)
- Add `--bump` to `deploy` command to allow packagers to make minor package related releases ([#173](https://git.autonomic.zone/coop-cloud/abra/issues/173)) - Add `--bump` to `deploy` command to allow packagers to make minor package related releases ([#173](https://git.autonomic.zone/coop-cloud/abra/issues/173))
- Drop `--skip-version-check`/`--no-domain-poll`/`--no-state-poll` in favour of `--fast` ([#169](https://git.autonomic.zone/coop-cloud/abra/issues/169)) - Drop `--skip-version-check`/`--no-domain-poll`/`--no-state-poll` in favour of `--fast` ([#169](https://git.autonomic.zone/coop-cloud/abra/issues/169))
- Move `abra` image under the new `thecoopcloud/...` namespace ([#1](https://git.autonomic.zone/coop-cloud/auto-apps-json/issues/1)) - Move `abra` image under the new `thecoopcloud/...` namespace ([#1](https://git.autonomic.zone/coop-cloud/auto-apps-json/issues/1))
@ -17,9 +19,14 @@
- App deployment checks are somewhat more reliable (see [#193](https://git.autonomic.zone/coop-cloud/abra/issues/193) for remaining work) ([#165](https://git.autonomic.zone/coop-cloud/abra/issues/165)) - App deployment checks are somewhat more reliable (see [#193](https://git.autonomic.zone/coop-cloud/abra/issues/193) for remaining work) ([#165](https://git.autonomic.zone/coop-cloud/abra/issues/165))
- Skip generation of commented out secrets and correctly fail deploy when secret generation fails ([#133](https://git.autonomic.zone/coop-cloud/abra/issues/133)) - Skip generation of commented out secrets and correctly fail deploy when secret generation fails ([#133](https://git.autonomic.zone/coop-cloud/abra/issues/133))
- Fix logging for chaos deploys and recipe selection logic ([#185](https://git.autonomic.zone/coop-cloud/abra/issues/185)) - Fix logging for chaos deploys and recipe selection logic ([#185](https://git.autonomic.zone/coop-cloud/abra/issues/185))
- Improve reliability of selectig when to download a new `apps.json` ([#170](https://git.autonomic.zone/coop-cloud/abra/issues/170)) - Improve reliability of selecting when to download a new `apps.json` ([#170](https://git.autonomic.zone/coop-cloud/abra/issues/170))
- Remove `pwgen`/`pwqgen` as password generator requirements ([#167](https://git.autonomic.zone/coop-cloud/abra/issues/167)) - Implement `pwgen`/`pwqgen` native fallback for password generation ([#167](https://git.autonomic.zone/coop-cloud/abra/issues/167) / [#197](https://git.autonomic.zone/coop-cloud/abra/issues/197))
- `abra` installer script will now try to install system requirements ([#196](https://git.autonomic.zone/coop-cloud/abra/issues/196)) - `abra` installer script will now try to install system requirements ([#196](https://git.autonomic.zone/coop-cloud/abra/issues/196))
- Use latest [v4.9.6](https://github.com/mikefarah/yq/releases/tag/v4.9.6) install of `yq` for vendoring (**upgrade HOWTO:** `rm -rf ~/.abra/vendor/*`)
- Support overriding `$ARGS` from `abra.sh` custom commands and error out correctly when these commands fail ([#1](https://github.com/Coop-Cloud/peertube/issues/1))
- Add `abra <app> restart <service>` to support restarting individual services ([#200](https://git.autonomic.zone/coop-cloud/abra/issues/200))
- Output changes when asking to commit during release logic ([3f0a907b5](https://git.autonomic.zone/coop-cloud/rocketchat/commit/3f0a907b57acf960d6befab3d943982d956e2474))
- Add validation for generated output when making new release labels ([#186](https://git.autonomic.zone/coop-cloud/abra/issues/186))
# abra 9.0.0 (2021-06-10) # abra 9.0.0 (2021-06-10)

278
abra
View File

@ -5,7 +5,7 @@
GIT_URL="https://git.autonomic.zone/coop-cloud/" GIT_URL="https://git.autonomic.zone/coop-cloud/"
ABRA_APPS_URL="https://apps.coopcloud.tech" ABRA_APPS_URL="https://apps.coopcloud.tech"
ABRA_DIR="${ABRA_DIR:-$HOME/.abra}" ABRA_DIR="${ABRA_DIR:-$HOME/.abra}"
ABRA_VERSION="9.0.0" ABRA_VERSION="10.0.0"
ABRA_BACKUP_DIR="${ABRA_BACKUP_DIR:-$ABRA_DIR/backups}" ABRA_BACKUP_DIR="${ABRA_BACKUP_DIR:-$ABRA_DIR/backups}"
ABRA_VENDOR_DIR="$ABRA_DIR/vendor" ABRA_VENDOR_DIR="$ABRA_DIR/vendor"
ABRA_APPS_JSON="${ABRA_DIR}/apps.json" ABRA_APPS_JSON="${ABRA_DIR}/apps.json"
@ -17,6 +17,13 @@ ABRA_APPS_JSON="${ABRA_DIR}/apps.json"
DOC=" DOC="
The Co-op Cloud utility belt 🎩🐇 The Co-op Cloud utility belt 🎩🐇
____ ____ _ _
/ ___|___ ___ _ __ / ___| | ___ _ _ __| |
| | / _ \ _____ / _ \| '_ \ | | | |/ _ \| | | |/ _' |
| |__| (_) |_____| (_) | |_) | | |___| | (_) | |_| | (_| |
\____\___/ \___/| .__/ \____|_|\___/ \__,_|\__,_|
|_|
Usage: Usage:
abra [options] app (list|ls) [--status] [--server=<server>] [--type=<type>] abra [options] app (list|ls) [--status] [--server=<server>] [--type=<type>]
abra [options] app new [--server=<server>] [--domain=<domain>] [--app-name=<app_name>] [--pass] [--secrets] <type> abra [options] app new [--server=<server>] [--domain=<domain>] [--app-name=<app_name>] [--pass] [--secrets] <type>
@ -33,6 +40,7 @@ Usage:
abra [options] app <app> restore <service> [<backup file>] abra [options] app <app> restore <service> [<backup file>]
abra [options] app <app> run [--no-tty] [--user=<user>] <service> <args>... abra [options] app <app> run [--no-tty] [--user=<user>] <service> <args>...
abra [options] app <app> rollback [<version>] abra [options] app <app> rollback [<version>]
abra [options] app <app> restart <service>
abra [options] app <app> secret generate (<secret> <version>|--all) [<cmd>] [--pass] abra [options] app <app> secret generate (<secret> <version>|--all) [<cmd>] [--pass]
abra [options] app <app> secret insert <secret> <version> <data> [--pass] abra [options] app <app> secret insert <secret> <version> <data> [--pass]
abra [options] app <app> secret (rm|delete) (<secret>|--all) [--pass] abra [options] app <app> secret (rm|delete) (<secret>|--all) [--pass]
@ -169,15 +177,15 @@ eval "var_$1+=($value)"; else eval "var_$1=$value"; fi; return 0; fi; done
return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() { return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() {
printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() { printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() {
[[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() { [[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() {
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2445} printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2824}
usage=${DOC:34:1842}; digest=d420c usage=${DOC:368:1887}; digest=6ab46
shorts=(-d -C -h -U -e -s -v -n -b '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '') shorts=(-n -b -v -U -e -h -d -C -s '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '')
longs=(--debug --skip-check --help --skip-update --env --stack --verbose --no-prompt --branch --status --server --type --domain --app-name --pass --secrets --all --update --force --fast --chaos --volumes --no-tty --user --bump --dev) longs=(--no-prompt --branch --verbose --skip-update --env --help --debug --skip-check --stack --status --server --type --domain --app-name --pass --secrets --all --update --force --fast --chaos --volumes --no-tty --user --bump --dev)
argcounts=(0 0 0 0 1 1 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0); node_0(){ argcounts=(0 1 0 0 1 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0); node_0(){
switch __debug 0; }; node_1(){ switch __skip_check 1; }; node_2(){ switch __no_prompt 0; }; node_1(){ value __branch 1; }; node_2(){
switch __help 2; }; node_3(){ switch __skip_update 3; }; node_4(){ value __env 4 switch __verbose 2; }; node_3(){ switch __skip_update 3; }; node_4(){
}; node_5(){ value __stack 5; }; node_6(){ switch __verbose 6; }; node_7(){ value __env 4; }; node_5(){ switch __help 5; }; node_6(){ switch __debug 6; }
switch __no_prompt 7; }; node_8(){ value __branch 8; }; node_9(){ node_7(){ switch __skip_check 7; }; node_8(){ value __stack 8; }; node_9(){
switch __status 9; }; node_10(){ value __server 10; }; node_11(){ switch __status 9; }; node_10(){ value __server 10; }; node_11(){
value __type 11; }; node_12(){ value __domain 12; }; node_13(){ value __type 11; }; node_12(){ value __domain 12; }; node_13(){
value __app_name 13; }; node_14(){ switch __pass 14; }; node_15(){ value __app_name 13; }; node_14(){ switch __pass 14; }; node_15(){
@ -200,55 +208,56 @@ _command deploy; }; node_51(){ _command check; }; node_52(){ _command version; }
node_53(){ _command config; }; node_54(){ _command cp; }; node_55(){ node_53(){ _command config; }; node_54(){ _command cp; }; node_55(){
_command logs; }; node_56(){ _command ps; }; node_57(){ _command restore; } _command logs; }; node_56(){ _command ps; }; node_57(){ _command restore; }
node_58(){ _command rm; }; node_59(){ _command delete; }; node_60(){ node_58(){ _command rm; }; node_59(){ _command delete; }; node_60(){
_command run; }; node_61(){ _command rollback; }; node_62(){ _command secret; } _command run; }; node_61(){ _command rollback; }; node_62(){ _command restart; }
node_63(){ _command generate; }; node_64(){ _command insert; }; node_65(){ node_63(){ _command secret; }; node_64(){ _command generate; }; node_65(){
_command undeploy; }; node_66(){ _command volume; }; node_67(){ _command recipe _command insert; }; node_66(){ _command undeploy; }; node_67(){ _command volume
}; node_68(){ _command create; }; node_69(){ _command release; }; node_70(){ }; node_68(){ _command recipe; }; node_69(){ _command create; }; node_70(){
_command versions; }; node_71(){ _command server; }; node_72(){ _command add; } _command release; }; node_71(){ _command versions; }; node_72(){ _command server
node_73(){ _command __ --; }; node_74(){ _command init; }; node_75(){ }; node_73(){ _command add; }; node_74(){ _command __ --; }; node_75(){
_command apps; }; node_76(){ _command upgrade; }; node_77(){ _command doctor; } _command init; }; node_76(){ _command apps; }; node_77(){ _command upgrade; }
node_78(){ _command help; }; node_79(){ optional 0 1 2 3 4 5 6 7 8; } node_78(){ _command doctor; }; node_79(){ _command help; }; node_80(){
node_80(){ optional 79; }; node_81(){ either 46 47; }; node_82(){ required 81; } optional 0 1 2 3 4 5 6 7 8; }; node_81(){ optional 80; }; node_82(){
node_83(){ optional 9; }; node_84(){ optional 10; }; node_85(){ optional 11; } either 46 47; }; node_83(){ required 82; }; node_84(){ optional 9; }; node_85(){
node_86(){ required 80 45 82 83 84 85; }; node_87(){ optional 12; }; node_88(){ optional 10; }; node_86(){ optional 11; }; node_87(){ required 81 45 83 84 85 86
optional 13; }; node_89(){ optional 14; }; node_90(){ optional 15; }; node_91(){ }; node_88(){ optional 12; }; node_89(){ optional 13; }; node_90(){ optional 14
required 80 45 48 84 87 88 89 90 26; }; node_92(){ either 28 16; }; node_93(){ }; node_91(){ optional 15; }; node_92(){ required 81 45 48 85 88 89 90 91 26; }
required 92; }; node_94(){ required 80 45 27 49 93; }; node_95(){ optional 17; } node_93(){ either 28 16; }; node_94(){ required 93; }; node_95(){
node_96(){ optional 18; }; node_97(){ optional 19; }; node_98(){ optional 20; } required 81 45 27 49 94; }; node_96(){ optional 17; }; node_97(){ optional 18; }
node_99(){ optional 29; }; node_100(){ required 80 45 27 50 95 96 97 98 99; } node_98(){ optional 19; }; node_99(){ optional 20; }; node_100(){ optional 29; }
node_101(){ required 80 45 27 51; }; node_102(){ required 80 45 27 52; } node_101(){ required 81 45 27 50 96 97 98 99 100; }; node_102(){
node_103(){ required 80 45 27 53; }; node_104(){ required 80 45 27 54 30 31; } required 81 45 27 51; }; node_103(){ required 81 45 27 52; }; node_104(){
node_105(){ optional 28; }; node_106(){ required 80 45 27 55 105; }; node_107(){ required 81 45 27 53; }; node_105(){ required 81 45 27 54 30 31; }; node_106(){
required 80 45 27 56; }; node_108(){ required 80 45 27 57 93; }; node_109(){ optional 28; }; node_107(){ required 81 45 27 55 106; }; node_108(){
either 58 59; }; node_110(){ required 109; }; node_111(){ optional 21; } required 81 45 27 56; }; node_109(){ required 81 45 27 57 94; }; node_110(){
node_112(){ required 80 45 27 110 111 90; }; node_113(){ optional 32; } either 58 59; }; node_111(){ required 110; }; node_112(){ optional 21; }
node_114(){ required 80 45 27 57 28 113; }; node_115(){ optional 22; } node_113(){ required 81 45 27 111 112 91; }; node_114(){ optional 32; }
node_116(){ optional 23; }; node_117(){ oneormore 33; }; node_118(){ node_115(){ required 81 45 27 57 28 114; }; node_116(){ optional 22; }
required 80 45 27 60 115 116 28 117; }; node_119(){ required 80 45 27 61 99; } node_117(){ optional 23; }; node_118(){ oneormore 33; }; node_119(){
node_120(){ required 34 29; }; node_121(){ either 120 16; }; node_122(){ required 81 45 27 60 116 117 28 118; }; node_120(){ required 81 45 27 61 100; }
required 121; }; node_123(){ optional 35; }; node_124(){ node_121(){ required 81 45 27 62 28; }; node_122(){ required 34 29; }
required 80 45 27 62 63 122 123 89; }; node_125(){ node_123(){ either 122 16; }; node_124(){ required 123; }; node_125(){
required 80 45 27 62 64 34 29 36 89; }; node_126(){ either 34 16; }; node_127(){ optional 35; }; node_126(){ required 81 45 27 63 64 124 125 90; }; node_127(){
required 126; }; node_128(){ required 80 45 27 62 110 127 89; }; node_129(){ required 81 45 27 63 65 34 29 36 90; }; node_128(){ either 34 16; }; node_129(){
required 80 45 27 65; }; node_130(){ required 80 45 27 66 47; }; node_131(){ required 128; }; node_130(){ required 81 45 27 63 111 129 90; }; node_131(){
either 37 16; }; node_132(){ required 131; }; node_133(){ required 81 45 27 66; }; node_132(){ required 81 45 27 67 47; }; node_133(){
required 80 45 27 66 110 132; }; node_134(){ optional 117; }; node_135(){ either 37 16; }; node_134(){ required 133; }; node_135(){
required 80 45 27 38 134; }; node_136(){ required 80 67 47; }; node_137(){ required 81 45 27 67 111 134; }; node_136(){ optional 118; }; node_137(){
required 80 67 68 39; }; node_138(){ optional 24; }; node_139(){ required 81 45 27 38 136; }; node_138(){ required 81 68 47; }; node_139(){
required 80 67 39 69 96 138; }; node_140(){ required 80 67 39 70; }; node_141(){ required 81 68 69 39; }; node_140(){ optional 24; }; node_141(){
optional 41; }; node_142(){ optional 42; }; node_143(){ required 81 68 39 70 97 140; }; node_142(){ required 81 68 39 71; }; node_143(){
required 80 71 72 40 141 142; }; node_144(){ required 80 71 48 43 73 33; } optional 41; }; node_144(){ optional 42; }; node_145(){
node_145(){ required 80 71 82; }; node_146(){ required 80 71 40 58; } required 81 72 73 40 143 144; }; node_146(){ required 81 72 48 43 74 33; }
node_147(){ required 80 71 40 74; }; node_148(){ required 80 71 40 75 83; } node_147(){ required 81 72 83; }; node_148(){ required 81 72 40 58; }
node_149(){ optional 25; }; node_150(){ required 80 76 149; }; node_151(){ node_149(){ required 81 72 40 75; }; node_150(){ required 81 72 40 76 84; }
required 80 52; }; node_152(){ required 80 77; }; node_153(){ oneormore 44; } node_151(){ optional 25; }; node_152(){ required 81 77 151; }; node_153(){
node_154(){ optional 153; }; node_155(){ required 80 78 154; }; node_156(){ required 81 52; }; node_154(){ required 81 78; }; node_155(){ oneormore 44; }
required 80; }; node_157(){ node_156(){ optional 155; }; node_157(){ required 81 79 156; }; node_158(){
either 86 91 94 100 101 102 103 104 106 107 108 112 114 118 119 124 125 128 129 130 133 135 136 137 139 140 143 144 145 146 147 148 150 151 152 155 156 required 81; }; node_159(){
}; node_158(){ required 157; }; cat <<<' docopt_exit() { either 87 92 95 101 102 103 104 105 107 108 109 113 115 119 120 121 126 127 130 131 132 135 137 138 139 141 142 145 146 147 148 149 150 152 153 154 157 158
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:34:1842}" >&2 }; node_160(){ required 159; }; cat <<<' docopt_exit() {
exit 1; }'; unset var___debug var___skip_check var___help var___skip_update \ [[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:368:1887}" >&2
var___env var___stack var___verbose var___no_prompt var___branch var___status \ exit 1; }'; unset var___no_prompt var___branch var___verbose var___skip_update \
var___env var___help var___debug var___skip_check var___stack var___status \
var___server var___type var___domain var___app_name var___pass var___secrets \ var___server var___type var___domain var___app_name var___pass var___secrets \
var___all var___update var___force var___fast var___chaos var___volumes \ var___all var___update var___force var___fast var___chaos var___volumes \
var___no_tty var___user var___bump var___dev var__type_ var__app_ \ var___no_tty var___user var___bump var___dev var__type_ var__app_ \
@ -257,40 +266,39 @@ var__secret_ var__cmd_ var__data_ var__volume_ var__command_ var__recipe_ \
var__host_ var__user_ var__port_ var__provider_ var__subcommands_ var_app \ var__host_ var__user_ var__port_ var__provider_ var__subcommands_ var_app \
var_list var_ls var_new var_backup var_deploy var_check var_version var_config \ var_list var_ls var_new var_backup var_deploy var_check var_version var_config \
var_cp var_logs var_ps var_restore var_rm var_delete var_run var_rollback \ var_cp var_logs var_ps var_restore var_rm var_delete var_run var_rollback \
var_secret var_generate var_insert var_undeploy var_volume var_recipe \ var_restart var_secret var_generate var_insert var_undeploy var_volume \
var_create var_release var_versions var_server var_add var___ var_init \ var_recipe var_create var_release var_versions var_server var_add var___ \
var_apps var_upgrade var_doctor var_help; parse 158 "$@" var_init var_apps var_upgrade var_doctor var_help; parse 160 "$@"
local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__debug" \ local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__no_prompt" \
"${prefix}__skip_check" "${prefix}__help" "${prefix}__skip_update" \ "${prefix}__branch" "${prefix}__verbose" "${prefix}__skip_update" \
"${prefix}__env" "${prefix}__stack" "${prefix}__verbose" \ "${prefix}__env" "${prefix}__help" "${prefix}__debug" "${prefix}__skip_check" \
"${prefix}__no_prompt" "${prefix}__branch" "${prefix}__status" \ "${prefix}__stack" "${prefix}__status" "${prefix}__server" "${prefix}__type" \
"${prefix}__server" "${prefix}__type" "${prefix}__domain" \ "${prefix}__domain" "${prefix}__app_name" "${prefix}__pass" \
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \ "${prefix}__secrets" "${prefix}__all" "${prefix}__update" "${prefix}__force" \
"${prefix}__update" "${prefix}__force" "${prefix}__fast" "${prefix}__chaos" \ "${prefix}__fast" "${prefix}__chaos" "${prefix}__volumes" "${prefix}__no_tty" \
"${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__bump" \ "${prefix}__user" "${prefix}__bump" "${prefix}__dev" "${prefix}_type_" \
"${prefix}__dev" "${prefix}_type_" "${prefix}_app_" "${prefix}_service_" \ "${prefix}_app_" "${prefix}_service_" "${prefix}_version_" "${prefix}_src_" \
"${prefix}_version_" "${prefix}_src_" "${prefix}_dst_" \ "${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
"${prefix}_backup_file_" "${prefix}_args_" "${prefix}_secret_" \ "${prefix}_secret_" "${prefix}_cmd_" "${prefix}_data_" "${prefix}_volume_" \
"${prefix}_cmd_" "${prefix}_data_" "${prefix}_volume_" "${prefix}_command_" \ "${prefix}_command_" "${prefix}_recipe_" "${prefix}_host_" "${prefix}_user_" \
"${prefix}_recipe_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \ "${prefix}_port_" "${prefix}_provider_" "${prefix}_subcommands_" \
"${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \ "${prefix}app" "${prefix}list" "${prefix}ls" "${prefix}new" "${prefix}backup" \
"${prefix}ls" "${prefix}new" "${prefix}backup" "${prefix}deploy" \ "${prefix}deploy" "${prefix}check" "${prefix}version" "${prefix}config" \
"${prefix}check" "${prefix}version" "${prefix}config" "${prefix}cp" \ "${prefix}cp" "${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \
"${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \ "${prefix}delete" "${prefix}run" "${prefix}rollback" "${prefix}restart" \
"${prefix}delete" "${prefix}run" "${prefix}rollback" "${prefix}secret" \ "${prefix}secret" "${prefix}generate" "${prefix}insert" "${prefix}undeploy" \
"${prefix}generate" "${prefix}insert" "${prefix}undeploy" "${prefix}volume" \ "${prefix}volume" "${prefix}recipe" "${prefix}create" "${prefix}release" \
"${prefix}recipe" "${prefix}create" "${prefix}release" "${prefix}versions" \ "${prefix}versions" "${prefix}server" "${prefix}add" "${prefix}__" \
"${prefix}server" "${prefix}add" "${prefix}__" "${prefix}init" "${prefix}apps" \ "${prefix}init" "${prefix}apps" "${prefix}upgrade" "${prefix}doctor" \
"${prefix}upgrade" "${prefix}doctor" "${prefix}help" "${prefix}help"; eval "${prefix}"'__no_prompt=${var___no_prompt:-false}'
eval "${prefix}"'__debug=${var___debug:-false}' eval "${prefix}"'__branch=${var___branch:-}'
eval "${prefix}"'__skip_check=${var___skip_check:-false}' eval "${prefix}"'__verbose=${var___verbose:-false}'
eval "${prefix}"'__help=${var___help:-false}'
eval "${prefix}"'__skip_update=${var___skip_update:-false}' eval "${prefix}"'__skip_update=${var___skip_update:-false}'
eval "${prefix}"'__env=${var___env:-}' eval "${prefix}"'__env=${var___env:-}'
eval "${prefix}"'__help=${var___help:-false}'
eval "${prefix}"'__debug=${var___debug:-false}'
eval "${prefix}"'__skip_check=${var___skip_check:-false}'
eval "${prefix}"'__stack=${var___stack:-}' eval "${prefix}"'__stack=${var___stack:-}'
eval "${prefix}"'__verbose=${var___verbose:-false}'
eval "${prefix}"'__no_prompt=${var___no_prompt:-false}'
eval "${prefix}"'__branch=${var___branch:-}'
eval "${prefix}"'__status=${var___status:-false}' eval "${prefix}"'__status=${var___status:-false}'
eval "${prefix}"'__server=${var___server:-}' eval "${prefix}"'__server=${var___server:-}'
eval "${prefix}"'__type=${var___type:-}' eval "${prefix}"'__type=${var___type:-}'
@ -341,6 +349,7 @@ eval "${prefix}"'rm=${var_rm:-false}'
eval "${prefix}"'delete=${var_delete:-false}' eval "${prefix}"'delete=${var_delete:-false}'
eval "${prefix}"'run=${var_run:-false}' eval "${prefix}"'run=${var_run:-false}'
eval "${prefix}"'rollback=${var_rollback:-false}' eval "${prefix}"'rollback=${var_rollback:-false}'
eval "${prefix}"'restart=${var_restart:-false}'
eval "${prefix}"'secret=${var_secret:-false}' eval "${prefix}"'secret=${var_secret:-false}'
eval "${prefix}"'generate=${var_generate:-false}' eval "${prefix}"'generate=${var_generate:-false}'
eval "${prefix}"'insert=${var_insert:-false}' eval "${prefix}"'insert=${var_insert:-false}'
@ -358,10 +367,10 @@ eval "${prefix}"'upgrade=${var_upgrade:-false}'
eval "${prefix}"'doctor=${var_doctor:-false}' eval "${prefix}"'doctor=${var_doctor:-false}'
eval "${prefix}"'help=${var_help:-false}'; local docopt_i=1 eval "${prefix}"'help=${var_help:-false}'; local docopt_i=1
[[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do [[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do
declare -p "${prefix}__debug" "${prefix}__skip_check" "${prefix}__help" \ declare -p "${prefix}__no_prompt" "${prefix}__branch" "${prefix}__verbose" \
"${prefix}__skip_update" "${prefix}__env" "${prefix}__stack" \ "${prefix}__skip_update" "${prefix}__env" "${prefix}__help" "${prefix}__debug" \
"${prefix}__verbose" "${prefix}__no_prompt" "${prefix}__branch" \ "${prefix}__skip_check" "${prefix}__stack" "${prefix}__status" \
"${prefix}__status" "${prefix}__server" "${prefix}__type" "${prefix}__domain" \ "${prefix}__server" "${prefix}__type" "${prefix}__domain" \
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \ "${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
"${prefix}__update" "${prefix}__force" "${prefix}__fast" "${prefix}__chaos" \ "${prefix}__update" "${prefix}__force" "${prefix}__fast" "${prefix}__chaos" \
"${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__bump" \ "${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__bump" \
@ -374,11 +383,12 @@ declare -p "${prefix}__debug" "${prefix}__skip_check" "${prefix}__help" \
"${prefix}ls" "${prefix}new" "${prefix}backup" "${prefix}deploy" \ "${prefix}ls" "${prefix}new" "${prefix}backup" "${prefix}deploy" \
"${prefix}check" "${prefix}version" "${prefix}config" "${prefix}cp" \ "${prefix}check" "${prefix}version" "${prefix}config" "${prefix}cp" \
"${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \ "${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \
"${prefix}delete" "${prefix}run" "${prefix}rollback" "${prefix}secret" \ "${prefix}delete" "${prefix}run" "${prefix}rollback" "${prefix}restart" \
"${prefix}generate" "${prefix}insert" "${prefix}undeploy" "${prefix}volume" \ "${prefix}secret" "${prefix}generate" "${prefix}insert" "${prefix}undeploy" \
"${prefix}recipe" "${prefix}create" "${prefix}release" "${prefix}versions" \ "${prefix}volume" "${prefix}recipe" "${prefix}create" "${prefix}release" \
"${prefix}server" "${prefix}add" "${prefix}__" "${prefix}init" "${prefix}apps" \ "${prefix}versions" "${prefix}server" "${prefix}add" "${prefix}__" \
"${prefix}upgrade" "${prefix}doctor" "${prefix}help"; done; } "${prefix}init" "${prefix}apps" "${prefix}upgrade" "${prefix}doctor" \
"${prefix}help"; done; }
# docopt parser above, complete command for generating this parser is `docopt.sh abra` # docopt parser above, complete command for generating this parser is `docopt.sh abra`
PROGRAM_NAME=$(basename "$0") PROGRAM_NAME=$(basename "$0")
@ -490,13 +500,7 @@ require_docker_version() {
done done
} }
require_valid_json() {
require_jq
$JQ "$1" > /dev/null || error "Invalid JSON '$1'"
}
require_valid_yaml() { require_valid_yaml() {
require_yq
$YQ e "$1" > /dev/null || error "Invalid YAML '$1'" $YQ e "$1" > /dev/null || error "Invalid YAML '$1'"
} }
@ -648,7 +652,7 @@ require_jq() {
} }
require_yq() { require_yq() {
vendor_binary "https://github.com/mikefarah/yq" "v4.6.1" "yq_linux_amd64" vendor_binary "https://github.com/mikefarah/yq" "v4.9.6" "yq_linux_amd64"
} }
checkout_main_or_master() { checkout_main_or_master() {
@ -656,10 +660,20 @@ checkout_main_or_master() {
} }
pwgen_native() { pwgen_native() {
if type pwgen > /dev/null 2>&1; then
pwgen -s "$length" 1
return
fi
tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c "$1" tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c "$1"
} }
pwqgen_native() { pwqgen_native() {
if type pwqgen > /dev/null 2>&1; then
pwqgen
return
fi
shuf -n 3 /usr/share/dict/words | tr -dc 'a-zA-Z0-9' | tr -d '\n' shuf -n 3 /usr/share/dict/words | tr -dc 'a-zA-Z0-9' | tr -d '\n'
} }
@ -1621,7 +1635,7 @@ sub_app_secret_insert() {
printf "$PW" | docker secret create "${STACK_NAME}_${SECRET}_${VERSION}" - > /dev/null printf "$PW" | docker secret create "${STACK_NAME}_${SECRET}_${VERSION}" - > /dev/null
# shellcheck disable=SC2181 # shellcheck disable=SC2181
if [[ $? != 0 ]]; then exit 1; fi # exit if secret wasn't created if [[ $? != 0 ]]; then exit 1; fi
if [ "$STORE_WITH_PASS" == "true" ] && type pass > /dev/null 2>&1; then if [ "$STORE_WITH_PASS" == "true" ] && type pass > /dev/null 2>&1; then
echo "$PW" | pass insert "hosts/$DOCKER_CONTEXT/${STACK_NAME}/${SECRET}" -m > /dev/null echo "$PW" | pass insert "hosts/$DOCKER_CONTEXT/${STACK_NAME}/${SECRET}" -m > /dev/null
@ -1830,10 +1844,12 @@ sub_app_run(){
RUN_USER="-u $abra___user" RUN_USER="-u $abra___user"
fi fi
local -a ARGS="${ARGS:-""}"
if [ "$abra___no_tty" = "true" ]; then if [ "$abra___no_tty" = "true" ]; then
ARGS="-i" ARGS+=" -i"
else else
ARGS="-it" ARGS+=" -it"
fi fi
CONTAINER=$(docker container ls --format "table {{.ID}},{{.Names}}" \ CONTAINER=$(docker container ls --format "table {{.ID}},{{.Names}}" \
@ -1845,11 +1861,14 @@ sub_app_run(){
fi fi
debug "Using container ID ${CONTAINER}" debug "Using container ID ${CONTAINER}"
# shellcheck disable=SC2145
debug "Running command: docker exec $RUN_USER $ARGS $CONTAINER $@"
exit
# 3wc: we want the "splitting" that shellcheck warns us about, so that -u and
# $RUN_USER aren't treated as a single argument:
# shellcheck disable=SC2086 # shellcheck disable=SC2086
docker exec $RUN_USER $ARGS "$CONTAINER" "$@" if ! docker exec $RUN_USER $ARGS "$CONTAINER" "$@"; then
exit 1
fi
return return
} }
@ -1893,6 +1912,31 @@ sub_app_rollback(){
sub_app_deploy sub_app_deploy
} }
###### .. app restart
help_app_restart (){
echo "abra [options] app <app> restart <service>
Restart a service.
EXAMPLES
abra app peertube restart app
POWERED BY
docker service scale foo=bar"
}
sub_app_restart(){
SERVICE="${abra__service_}"
debug "Scaling ${STACK_NAME}_${SERVICE} to 0 running containers..."
docker service scale "${STACK_NAME}_${SERVICE}=0"
debug "Scaling ${STACK_NAME}_${SERVICE} back to 1 running container..."
docker service scale "${STACK_NAME}_${SERVICE}=1"
success "${STACK_NAME}_${SERVICE} was succesfully restarted!"
}
###### .. app logs ###### .. app logs
help_app_logs (){ help_app_logs (){
echo "abra [options] app <app> logs [<service>] echo "abra [options] app <app> logs [<service>]
@ -2239,9 +2283,15 @@ sub_recipe_release() {
error "Hmm, something went wrong generating a new version number.." error "Hmm, something went wrong generating a new version number.."
fi fi
local -a expected_format="^coop-cloud.[a-z]*.[a-z]*.[a-z]*=v\\d*.\\d*.\\d*-\\S{8}"
if [[ ! "$new_version" =~ $expected_format ]]; then
error "'$new_version' does not match the expected label format, bailing out..."
fi
success "All compose files updated; new version is $new_version" success "All compose files updated; new version is $new_version"
if [ "$abra___no_prompt" = "false" ] && [ "$bump" = "false" ]; then if [ "$abra___no_prompt" = "false" ] && [ "$bump" = "false" ]; then
git --no-pager diff
read -rp "Commit your changes to git? [y/N]? " choice read -rp "Commit your changes to git? [y/N]? " choice
if [ "${choice,,}" != "y" ]; then if [ "${choice,,}" != "y" ]; then
@ -2480,9 +2530,9 @@ OPTIONS
sub_upgrade() { sub_upgrade() {
if [[ "$abra___dev" == "true" ]]; then if [[ "$abra___dev" == "true" ]]; then
curl https://install.abra.coopcloud.tech | bash -s -- --dev curl https://install.abra.coopcloud.tech | bash -s -- --dev --no-deps
else else
curl https://install.abra.coopcloud.tech | bash curl https://install.abra.coopcloud.tech | bash --no-deps
fi fi
} }

View File

@ -2,7 +2,7 @@
# shellcheck disable=SC2154,SC2034 # shellcheck disable=SC2154,SC2034
ABRA_VERSION="9.0.0" ABRA_VERSION="10.0.0"
GIT_URL="https://git.autonomic.zone/coop-cloud/abra" GIT_URL="https://git.autonomic.zone/coop-cloud/abra"
ABRA_SRC="$GIT_URL/raw/tag/$ABRA_VERSION/abra" ABRA_SRC="$GIT_URL/raw/tag/$ABRA_VERSION/abra"
ABRA_DIR="${ABRA_DIR:-$HOME/.abra}" ABRA_DIR="${ABRA_DIR:-$HOME/.abra}"
@ -145,7 +145,6 @@ function install_docker {
sudo apt-get install -yq \ sudo apt-get install -yq \
apt-transport-https \ apt-transport-https \
ca-certificates \ ca-certificates \
curl \
gnupg \ gnupg \
lsb-release lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
@ -161,7 +160,6 @@ function install_requirements {
echo "Detected Debian based distribution, attempting to install system requirements..." echo "Detected Debian based distribution, attempting to install system requirements..."
sudo apt update && sudo apt install -y \ sudo apt update && sudo apt install -y \
curl \
passwdqc \ passwdqc \
pwgen pwgen