Compare commits

...

82 Commits
0.5.0 ... 0.6.0

Author SHA1 Message Date
d68444be9e Mark release 2021-03-17 12:54:29 +01:00
f7bc8efabe Update to latest when upgrading 2021-03-17 12:53:02 +01:00
f5284ba725 Point to installer for hacking 2021-03-17 12:50:02 +01:00
293d3ff558 Merge pull request 'Show git digest in abra version if we're running a development version' (#103) from digest-version into main
Reviewed-on: https://git.autonomic.zone/coop-cloud/abra/pulls/103
2021-03-17 12:48:45 +01:00
3wc
c00319ab01 Update CHANGELOG 2021-03-16 12:55:47 +02:00
3wc
8b4141670c Include git digest in dev version output
Re: #100
2021-03-16 12:54:42 +02:00
23c852125d Listen to shellcheck and do things 2021-03-16 10:13:15 +01:00
b4eae2e5e5 Add missing quote 2021-03-16 09:24:21 +01:00
9e953319cf Get label parsing done correctly 2021-03-16 09:23:13 +01:00
0814fa9146 Add export to the output also 2021-03-16 09:04:42 +01:00
0e1b6c858b Add change log entry 2021-03-16 08:58:12 +01:00
28618bd3ac Add packager helper script 2021-03-16 08:57:05 +01:00
b04bfea1c7 Use local marker and scan services only once 2021-03-16 08:38:11 +01:00
bc0ef0d6fc Fix deployments when versions are missing 2021-03-16 07:32:31 +01:00
16c91fedd1 Add newline back 2021-03-16 07:00:23 +01:00
9f5945094c Document new dev update command 2021-03-16 06:59:35 +01:00
76513a1f35 Add change log entry 2021-03-16 06:51:35 +01:00
86eb8d7fde Handle existing files use-case for dev installer
Closes https://git.autonomic.zone/coop-cloud/abra/issues/98.
2021-03-16 06:51:10 +01:00
e31b3d3173 Add change log entry 2021-03-16 06:25:29 +01:00
58b13d7528 Use app type naming and use yellow 2021-03-16 06:22:32 +01:00
b0fca49ecb Generalise top level deploy output 2021-03-16 06:19:52 +01:00
79dacf557e Implement edge-case handling for versioning 2021-03-16 06:19:37 +01:00
d6caf03301 Spacing for readability 2021-03-16 05:58:08 +01:00
9b90712d28 Look up image name and show it also 2021-03-16 05:57:01 +01:00
1dd3fe6fcd Use COMPOSE var here 2021-03-16 05:56:52 +01:00
29953c17d9 Add change log entry 2021-03-16 05:48:08 +01:00
3b59adfe34 Vendor yq program 2021-03-16 05:47:13 +01:00
00c8a988e1 Fix parsing of stack_name/service concatenation 2021-03-16 05:04:05 +01:00
524fb6a44c Use STACK_NAME instead of Gitea 2021-03-15 18:56:26 +01:00
e99bedf9e4 WIP version output summary which handles services
See https://git.autonomic.zone/coop-cloud/organising/issues/47.
2021-03-15 18:30:37 +01:00
0d98c442a2 Add change log entry 2021-03-15 17:04:14 +01:00
bcc15ecdb0 Support dev upgrades on the CLI also 2021-03-15 17:03:01 +01:00
a617629a7a Lowercase that 2021-03-15 16:54:54 +01:00
f7ae400eb3 Use makefile for releasing installer 2021-03-15 16:54:33 +01:00
7141d364e1 Zomg lol fix my typo 2021-03-15 10:07:17 +01:00
057ce223f1 Fix link 2021-03-15 10:06:50 +01:00
3wc
7511b25e47 Update installation docs, release new installer
[ci skip]
2021-03-15 10:35:06 +02:00
3wc
62b447d61f Update changelog
[ci skip]
2021-03-14 14:40:57 +02:00
3wc
88d2a75575 Add --dev to installer, to grab git version 2021-03-14 14:39:11 +02:00
3wc
8cb6617a0f Automatically truncate suggested app name
Ref #83
2021-03-14 03:33:33 +02:00
3wc
1a649c56cb Docs & comments 2021-03-14 03:33:22 +02:00
3wc
fd655274f8 Bomb out with Bash < 4
Ref #96
2021-03-14 03:24:13 +02:00
946d1a068d Drop current version handling logic for deploy
New logic coming soon.

See https://git.autonomic.zone/coop-cloud/organising/issues/47#issuecomment-4231.
2021-03-13 20:23:53 +01:00
3wc
e8651976ca Only load apps once, exciting 2× speed increase 2021-03-13 20:15:54 +02:00
3wc
af52ba1fec Clean-up 🧹 2021-03-12 13:13:17 +02:00
3wc
499c08c374 Update CHANGELOG 2021-03-12 13:10:50 +02:00
3wc
08281891a1 Add --type filter to abra <app> ls 2021-03-12 13:10:35 +02:00
5bce042922 First steps to enable abra-hetzner
See https://git.autonomic.zone/coop-cloud/abra/issues/88.
2021-03-10 23:28:59 +01:00
3276c9fe47 Always choose the default IPv4 address for init'ing
Closes https://git.autonomic.zone/coop-cloud/abra/issues/91.
2021-03-10 22:23:38 +01:00
040374e781 List volumes/secrets when removing 2021-03-05 12:53:21 +01:00
621c8cd5c4 Fix volume/secret deletion logic
- Fix escaping of quotes
- Dont delete things unless options are passed
2021-03-04 19:21:38 +01:00
7434b67c34 Fix parens and ignore quote warning 2021-03-04 16:59:36 +01:00
17306a753b Support volume and secret removal 2021-03-04 16:55:24 +01:00
2e3f4cabd8 Warn if unable to find version 2021-03-04 16:40:35 +01:00
cf2308cdd7 Point to script 2021-03-04 16:31:18 +01:00
eec49d6dd1 Guard against length errors in app names
Closes https://git.autonomic.zone/coop-cloud/abra/issues/83.
2021-03-04 16:25:21 +01:00
d6195ad6d7 Undercore - values in the domain too 2021-03-04 16:19:55 +01:00
fd04c5a6e9 Support branch selection for app repo clones
Closes https://git.autonomic.zone/coop-cloud/abra/issues/80.
2021-03-04 16:01:56 +01:00
1c9d7282b2 Revert "Sort commands listing"
This reverts commit 99ab5bf369.

Woops, they cannot be sorted this way. Ignore me.
2021-03-04 15:50:27 +01:00
dd9c485c66 Fix wording and wrap 2021-03-04 15:48:53 +01:00
99ab5bf369 Sort commands listing 2021-03-04 15:38:09 +01:00
25a0afed65 Fix indentation and, document local options only 2021-03-04 15:35:18 +01:00
44e22db11b Add change log entry 2021-03-04 13:27:32 +01:00
3321010089 Add change log README entry 2021-03-04 13:24:13 +01:00
e04c4626f2 Update change log 2021-03-04 13:22:57 +01:00
65ce949e03 Bail out if versions match
Closes https://git.autonomic.zone/coop-cloud/abra/issues/87.
2021-03-04 13:20:58 +01:00
5931cbd791 Only throw away error but keep stdout 2021-03-04 13:20:45 +01:00
0bbff91722 Add service rollback
Closes https://git.autonomic.zone/coop-cloud/abra/issues/76.
2021-03-04 13:10:51 +01:00
7f5e753dfd Re-factor version output logic and fix bug
It was showing empty strings for deployed versions it could not find.
Now, it will not change messages to output if it can not detect the
versions deployed (containers dont have the tag).
2021-03-04 13:10:00 +01:00
d3776f4424 Warn on secret storage after generation
Closes https://git.autonomic.zone/coop-cloud/abra/issues/75.
2021-03-03 17:20:24 +01:00
544c4e86ba Capture output for version checking
Closes https://git.autonomic.zone/coop-cloud/abra/issues/85.
2021-03-03 16:56:47 +01:00
516309b478 Show command to run 2021-03-03 16:54:01 +01:00
dfd7e29a30 Give spacing to blocks 2021-03-03 16:51:25 +01:00
bb30fa28da Fix wording 2021-03-03 16:50:59 +01:00
044de5824b Drop whitespace 2021-03-03 16:49:58 +01:00
3wc
00cdce7bd2 Update CHANGELOG
[ci skip]
2021-03-02 20:34:35 +02:00
3wc
f163d4b0fa Add script to auto-generate app catalogue 2021-03-02 20:33:14 +02:00
e0032fb74a Add change log entry 2021-03-02 13:07:00 +01:00
152dfe9349 Support basic version checking
Closes https://git.autonomic.zone/coop-cloud/abra/issues/82.
2021-03-02 13:06:56 +01:00
5a95ae97a0 Add changelog entry 2021-03-02 12:06:14 +01:00
98e674b8e8 Add version and digest showing
See https://git.autonomic.zone/coop-cloud/abra/issues/82.
2021-03-02 12:04:25 +01:00
b655cf20be Make README less vague
Closes https://git.autonomic.zone/coop-cloud/abra/issues/79.
2021-03-02 11:53:55 +01:00
8 changed files with 672 additions and 211 deletions

View File

@ -1,5 +1,26 @@
# abra x.x.x (UNRELEASED)
# abra 0.6.0 (2021-03-17)
- Show version and digest of app if labelled ([98e674b8e8](https://git.autonomic.zone/coop-cloud/abra/commit/98e674b8e83458a83dcbf331e8e34c7188559c4a))
- Implement basic version checking on deployment ([#82](https://git.autonomic.zone/coop-cloud/abra/issues/82))
- New `app-catalogue.sh` script to auto-generate app list for documentation ([f163d4b](https://git.autonomic.zone/coop-cloud/abra/commit/f163d4b0fa920232e9d995a22d20fe78b174b3a9))
- Support app service rollbacks with `abra <app> rollback <service>` ([#76](https://git.autonomic.zone/coop-cloud/abra/issues/76))
- Detect when latest version is deployed and perform a no-op ([#87](https://git.autonomic.zone/coop-cloud/abra/issues/87))
- Allow cloning of app repos with different main branches using `-b, --branch=<branch>` ([#80](https://git.autonomic.zone/coop-cloud/abra/issues/80))
- Protect against lengthy app names which gives Docker trouble later on ([#83](https://git.autonomic.zone/coop-cloud/abra/issues/83))
- Support removal of secrets and volumes when `rm`'ing apps ([#44](https://git.autonomic.zone/coop-cloud/abra/issues/44))
- Always choose the default IPv4 address with `abra server <host> init` ([#91](https://git.autonomic.zone/coop-cloud/abra/issues/91))
- Add `--type=<type>` filtering option to `abra <app> ls` ([0828189](https://git.autonomic.zone/coop-cloud/abra/commit/0828189))
- Check for bash 4+ ([#96](https://git.autonomic.zone/coop-cloud/abra/commit/0828189))
- Add `--dev` option to installer using `git clone` ([88d2a75](https://git.autonomic.zone/coop-cloud/abra/commit/88d2a75))
- Support `--dev` on the `abra upgrade` command also ([bcc15ec](https://git.autonomic.zone/coop-cloud/abra/commit/bcc15ec))
- Vendor [yq](https://github.com/mikefarah/yq/releases) automatically ([3b59adf](https://git.autonomic.zone/coop-cloud/abra/commit/3b59adf))
- Extend version handling logic to support all underlying services ([#90](https://git.autonomic.zone/coop-cloud/abra/issues/90))
- Fix development installation script symlink issue ([#98](https://git.autonomic.zone/coop-cloud/abra/issues/98))
- Add `app-version.sh` script to help packagers version apps ([28618bd](https://git.autonomic.zone/coop-cloud/abra/commit/28618bd))
- Add git digest to `abra version` output ([8b41416](https://git.autonomic.zone/coop-cloud/abra/commit/8b41416))
# abra 0.5.0 (2021-03-01)
- `secret auto` merged into `secret generate` and `app new --auto` is now `app new --secrets` ([#64](https://git.autonomic.zone/coop-cloud/abra/pulls/64))

View File

@ -7,12 +7,51 @@
The cooperative cloud utility belt 🎩🐇
`abra` is a command-line tool for managing your own [Co-op Cloud](https://cloud.autonomic.zone). It can provision new servers, create applications, deploy them, run backup and restore operations and a whole lot of other things. It is the go-to tool for day-to-day operations when managing a Co-op Cloud instance.
## Change log
See [CHANGELOG.md](./CHANGELOG.md).
## Documentation
> [docs.cloud.autonomic.zone](https://docs.cloud.autonomic.zone/)
## Install
Install the latest stable release:
```sh
curl https://install.abra.autonomic.zone | bash
```
or the bleeding-edge development version:
```sh
curl https://install.abra.autonomic.zone | bash -s -- --dev
```
The source for this script is [here](./installer/installer).
## Update
Run `abra upgrade` to automatically download and install the latest release
version.
To update the development version, run `abra upgrade --dev`.
## Hack
It's written in Bash version 4 or greater!
Install it via `curl https://install.abra.autonomic.zone | bash -s -- --dev`, then you can hack on the source in `~/.abra/src`.
The command-line interface is generated via [docopt](http://docopt.org/). If you add arguments then you need to run `make docopt` ro regenerate the parser.
Please remember to update the [CHANGELOG](./CHANGELOG.md) when you make a change.
To deploy a new version of the installer scripts:
```sh
make release-installer
```

644
abra

File diff suppressed because it is too large Load Diff

100
app-catalogue.sh Executable file
View File

@ -0,0 +1,100 @@
#!/bin/bash
# Usage: ./app-catalogue.sh
#
# Gather metadata from Co-op Cloud apps in $ABRA_DIR/apps (default
# ~/.abra/apps), and format it as a Markdown table for this page:
# https://docs.cloud.autonomic.zone/apps/
stack_dir="${ABRA_DIR:-$HOME/.abra}/apps/"
cd "$stack_dir"
# load all README files into ENV_FILES array
mapfile -t readmes < <(find -L . -name "README.md")
# FIXME 3wc: requires bash 4, use for loop instead
base_url="https://git.autonomic.zone/coop-cloud"
cat_apps=()
cat_development=()
cat_utilities=()
cat_graveyard=()
get_var() {
echo "$1" | grep "$2" | sed 's/^[^:]*: //'
}
# shellcheck disable=SC2120
trim() {
# accept input as argument or from STDIN, see here:
# https://zwbetz.com/passing-input-to-a-bash-function-via-arguments-or-stdin/
# shellcheck disable=SC2155
local input="$([[ -p /dev/stdin ]] && cat - || echo "$@")"
[[ -z "$input" ]] && return 1
echo "$input" | tr -d ' '
}
# shellcheck disable=SC2120
prettify() {
# as above
# shellcheck disable=SC2155
local input="$([[ -p /dev/stdin ]] && cat - || echo "$@")"
[[ -z "$input" ]] && return 1
echo "$input" | sed -e 's/Yes/✅/' -e 's/No/❌/' -e 's/N\/A/⛔/'
}
for readme in "${readmes[@]}"; do
type="$(basename "${readme%README.md}")"
if [ "$type" = "example" ]; then
continue
fi
title="$(grep '^# ' "$type/README.md" | sed 's/^# //' )"
# find section between 'metadata' and 'endmetadata' comments
metadata="$(awk '/-- metadata --/,/-- endmetadata --/' "$type/README.md")"
status="$(get_var "$metadata" "Status")"
category="$(get_var "$metadata" "Category" | cut -d',' -f2 | trim)"
if [ -z "$category" ]; then
echo "ERROR: missing category for $type"
continue
fi
image="$(get_var "$metadata" "Image" | cut -d',' -f2 | trim)"
healthcheck="$(get_var "$metadata" "Healthcheck" | prettify)"
backups="$(get_var "$metadata" "Backups" | prettify)"
email="$(get_var "$metadata" "Email" | prettify)"
tests="$(get_var "$metadata" "Tests" | prettify)"
sso="$(get_var "$metadata" "SSO" | prettify)"
row="| [$title]($base_url/$type) | $status | $image | $healthcheck | $backups | $email | $tests | $sso |"
category_lower="$(echo "$category" | tr '[:upper:]' '[:lower:]')"
eval "cat_$category_lower+=( '$row' )"
done
headers="
| **Name** | **Status** | **Image** | **Healtcheck** | **Backups** | **Email** | **CI** | **Single-Sign-On** |
| --- | --- | --- | --- | --- | --- | --- | --- |"
echo "## Applications"
echo "$headers"
printf '%s\n' "${cat_apps[@]}" | sort
echo
echo "## Developer tools"
echo "$headers"
printf '%s\n' "${cat_development[@]}" | sort
echo
echo "## Utilities"
echo "$headers"
printf '%s\n' "${cat_utilities[@]}" | sort
echo
echo "## Graveyard"
echo "$headers"
printf '%s\n' "${cat_graveyard[@]}" | sort

42
app-version.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# Usage: ./app-version.sh <image> <service>
# Example: ./app-version.sh drone/drone:1.10.1 app
#
# Accepts a full format hub.docker.com image tag which it pulls locally and
# generates output which can be used to put in the abra.sh for app packaging.
# Requires the yq program https://mikefarah.gitbook.io/yq/
error() {
echo "$(tput setaf 1)ERROR: $*$(tput sgr0)"
exit 1
}
IMAGE="$1"
SERVICE="$2"
if ! docker pull -q "$IMAGE" > /dev/null 2>&1; then
error "Failed to download image, is the tag correct?"
fi
version=$(echo "$IMAGE" | cut -d ':' -f2)
digest=$(docker image inspect -f "{{.Id}}" "$IMAGE" | cut -d ':' -f2- | cut -c 1-8)
echo "--- Add the following to your abra.sh ---"
echo "export ABRA_TYPE_${SERVICE^^}_VERSION=${version}"
echo "export ABRA_TYPE_${SERVICE^^}_DIGEST=${digest}"
version_lookup="ABRA_TYPE_${SERVICE^^}_VERSION"
digest_lookup="ABRA_TYPE_${SERVICE^^}_DIGEST"
label='- "coop-cloud.${STACK_NAME}.'
label+="${SERVICE}"
label+='.version=${'
label+="${version_lookup}"
label+='}-${'
label+="${digest_lookup}"
label+='}"'
echo
echo "--- And don't forget to label the actual service in the compose file ---"
echo "$label"

View File

@ -26,10 +26,8 @@ services:
configs:
abra_installer:
name: abra_installer_v1
file: installer
abra_conf:
name: abra_conf_v1
file: nginx.conf
networks:

View File

@ -1,18 +1,34 @@
#!/bin/bash
ABRA_VERSION="0.5.0"
ABRA_SRC="https://git.autonomic.zone/coop-cloud/abra/raw/tag/$ABRA_VERSION/abra"
ABRA_VERSION="0.6.0"
GIT_URL="https://git.autonomic.zone/coop-cloud/abra"
ABRA_SRC="$GIT_URL/raw/tag/$ABRA_VERSION/abra"
function install_abra {
function install_abra_release {
mkdir -p "$HOME/.local/bin"
curl "$ABRA_SRC" > "$HOME/.local/bin/abra"
chmod +x "$HOME/.local/bin/abra"
echo "abra installed to $HOME/.local/bin/abra"
}
function run_installation {
install_abra
function install_abra_dev {
mkdir -p "$HOME/.abra/"
if [[ ! -d "$HOME/.abra/src" ]]; then
git clone "$GIT_URL" "$HOME/.abra/src"
fi
( cd "$HOME/.abra/src" && git pull origin main && cd -)
mkdir -p "$HOME/.local/bin"
ln -sf "$HOME/.abra/src/abra" "$HOME/.local/bin/abra"
echo "abra installed to $HOME/.local/bin/abra (development bleeding edge)"
}
run_installation
function run_installation {
if [ "$1" = "--dev" ]; then
install_abra_dev
else
install_abra_release
fi
}
run_installation "$@"
exit 0

View File

@ -1,4 +1,4 @@
.PHONY: test shellcheck docopt kcov codecov
.PHONY: test shellcheck docopt kcov codecov release-installer
test:
@sudo DOCKER_CONTEXT=default docker run \
@ -43,3 +43,8 @@ codecov: SHELL:=/bin/bash
codecov:
@bash <(curl -s https://codecov.io/bash) \
-s coverage -t $$(pass show hosts/swarm.autonomic.zone/drone/codecov/token)
release-installer:
@docker stack rm abra-installer-script && \
cd installer && \
docker stack deploy -c compose.yml abra-installer-script