Add Restarting an App refactor style abra/cheet-sheet.md
continuous-integration/drone/push Build is passing Details

This commit is contained in:
basebuilder 2024-04-06 13:12:47 +02:00
parent ff39cf10b6
commit 36e18bdc62
1 changed files with 72 additions and 24 deletions

View File

@ -12,7 +12,8 @@ title: Cheat sheet
`abra autocomplete bash/zsh/fizsh`
### create and deploy a new app:
### Create & deploy a new app:
- `abra app new $RECIPE`
flags: `-s/--server`, `-D/--domain`, `-S/--secrets`, `-p/--pass`
- `abra app config $APPNAME`
@ -21,43 +22,88 @@ flags: `-p/--pass`, `-a/--all`
- `abra app deploy $APPNAME`
flags: `-f/--force`, `-C/--chaos`
### undeploy and remove an app
- back up any data you don't want to lose
- `abra app undeploy $APPNAME`
- `abra app rm --volumes $APPNAME`
flags: `-f/--force`, `-V/--volumes`
### upgrade abra
- `abra upgrade`
flags: `--rc`
### Restarting an app
### upgrade a recipe
- `abra recipe upgrade $RECIPE`
flags: `-x,y,z/--major,minor,patch`
- `abra recipe sync $RECIPE`
flags: `-x,y,z`
- `abra recipe release $RECIPE [$VERSION]`
flags: `-p/--publish`, `-r/--dry-run`, `-x,y,z`
To run `restart` you need to specify the `<service>` name with the default being `app`
```
$ abra app restart <domain> app
```
### Undeploy & remove an app
Back up any data you don't want to lose
```
$ abra app undeploy $APPNAME
$ abra app rm --volumes $APPNAME
```
Optional flags: `-f/--force`, `-V/--volumes`
### Upgrade abra
To upgrade `abra` itself, run the following:
```
$ abra upgrade
```
Option flags: `--rc`
### Upgrade a recipe
```
$ abra recipe upgrade $RECIPE`
```
Option flags: `-x,y,z/--major,minor,patch`
```
$ abra recipe sync $RECIPE
```
Optional flags: `-x,y,z`
```
$ abra recipe release $RECIPE [$VERSION]
```
Optional flags: `-p/--publish`, `-r/--dry-run`, `-x,y,z`
### Make changes to a recipe
Edit the files in `~/.abra/recipe/$RECIPENAME`
Deploy the changed version to your test instance
Determine how serious your change is (semver.org for reference)
```
$ abra recipe release $RECIPE [$VERSION]
```
### make a change to a recipe
- edit the files in `~/.abra/recipe/$RECIPENAME`
- deploy the changed version to your test instance
- determine how serious your change is (semver.org for reference)
- `abra recipe release $RECIPE [$VERSION]`
### Advanced Listing using `jq`
Several `abra` commands can output JSON formatted tables, and can thus be queried and filtered with the tool [jq](https://stedolan.github.io/jq/ "jq JSON Query tool"). We can also format these outputs with [tv](https://github.com/uzimaru0000/tv "tv Table Viewer") into a pretty table.
Currently, `abra recipe ls`, `abra server ls`, and `abra app ls` support the `-m` machine readable output flag which outputs JSON.
#### Filter recipes by "category"
`abra recipe ls -m | jq '[.[] | select(.category == "Utilities") ]' | tv`
```
$ abra recipe ls -m | jq '[.[] | select(.category == "Utilities") ]' | tv
```
As you can see we, we're selecting all recipes where category is "Utilities".
#### Filter apps by state `deployed`
!!! info
@ -66,6 +112,8 @@ As you can see we, we're selecting all recipes where category is "Utilities".
!!! info
`abra app ls` lists apps grouped into a server object, with statistics about the server. In `jq` we can select the entire apps list with `.[].apps[]`.
`abra app ls -m -S |jq '[.[].apps[] | select(.status == "deployed") | del(.upgrade)]' |tv`
```
$ abra app ls -m -S |jq '[.[].apps[] | select(.status == "deployed") | del(.upgrade)]' |tv
```
The `del(.upgrade)` filter filters out available versions for the recipe in question for that row. It could be useful to leave in if you want a list of deployed apps that need an upgrade.