Commit Graph

485 Commits

Author SHA1 Message Date
knoflook cf2653fef8
refactor: drop unused function, rename GetAppsNames 2021-09-08 13:43:55 +02:00
decentral1se 5ba40ad883
feat: include service tags
Closes coop-cloud/abra#92.
2021-09-08 10:15:46 +02:00
knoflook 4c216fdf40
feat: auto-complete app and recipe names 2021-09-07 16:57:39 +02:00
decentral1se c441a1ab52
Merge branch 'abra-upgrade' into main 2021-09-07 15:24:48 +02:00
decentral1se f1659b3bda
feat: support abra upgrading 2021-09-07 15:23:10 +02:00
knoflook 1757fabb89
feat: bash and (fi)zsh completion along with docs 2021-09-07 13:18:21 +02:00
decentral1se 1de4f95267
docs: lower case that [ci skip] 2021-09-07 09:13:13 +02:00
decentral1se dcf1a90c31
fix: tables align output again
Closes coop-cloud/go-abra#16.
2021-09-07 08:41:03 +02:00
decentral1se a06870f5cb
fix: generating secrets works again again
Closes coop-cloud/go-abra#68.
2021-09-07 08:28:20 +02:00
decentral1se b477bf8ece
fix: get app new working again 2021-09-07 08:12:37 +02:00
decentral1se 2cb0fb8d66
refactor: match app/recipe new instead of create 2021-09-07 07:31:11 +02:00
decentral1se 448dadd292
fix: sort versions correctly
Closes coop-cloud/go-abra#44.
2021-09-06 16:51:42 +02:00
decentral1se 8aaedee39e
fix: use new RecipeMeta struct 2021-09-06 12:24:23 +02:00
decentral1se f4d8b45859
fix: sort tags in descending order
Update tagcmp dep also.
2021-09-06 12:22:45 +02:00
decentral1se 7ed37547a5
docs: add FIXME [ci skip] 2021-09-06 01:51:04 +02:00
decentral1se 9862cf17a9
refactor: rename to RecipeMeta 2021-09-06 01:47:59 +02:00
decentral1se d1527741ba
refactor: drop erroneous return 2021-09-06 01:44:55 +02:00
decentral1se 9d6739a711
refactor: use new recipe struct 2021-09-06 01:43:21 +02:00
decentral1se 356c8f8c4e
refactor: construct recipe struct proper 2021-09-06 01:41:16 +02:00
decentral1se 6a1ecd0f85
refactor: consolidate recipe in-place editing functions 2021-09-06 01:34:28 +02:00
decentral1se b5d8fb1270
refactor: create compose package 2021-09-06 01:15:59 +02:00
decentral1se e1a10723ce
refactor: de-indent and error handle up front 2021-09-06 00:45:29 +02:00
decentral1se a0625bf133
refactor: centralise recipe validation 2021-09-06 00:45:13 +02:00
decentral1se c03d187256
fix: error out correctly and fix doc string 2021-09-06 00:26:45 +02:00
decentral1se 5e05bcd8b0
docs: <server> is not always required, drop it 2021-09-06 00:14:52 +02:00
decentral1se d4333c2dc0
refactor: use app getting instead of boilerplate 2021-09-05 23:17:35 +02:00
decentral1se 48bcc9cb36
refactor: break up recipe cli package 2021-09-05 22:33:07 +02:00
decentral1se ec40d88134
refactor: centralise app name validation 2021-09-05 22:04:48 +02:00
decentral1se cc249e8187
fix: check for deployment of app before removing
Closes coop-cloud/go-abra#61.

Fix thanks to @knoflook!
2021-09-05 21:54:52 +02:00
decentral1se 273db078b0
fix: bail out if app doesn't exist
Closes coop-cloud/go-abra#67.
Closes coop-cloud/go-abra#69.

Fix lifted from approach in
coop-cloud/go-abra#69. Thanks for
@knoflook!
2021-09-05 21:46:36 +02:00
decentral1se b7742d5e18
refactor: use pkg directory structure 2021-09-05 21:37:03 +02:00
decentral1se c99f0fc908
refactor: recipe validation 2021-09-05 01:55:10 +02:00
decentral1se 317be4cc01
docs: short aliases [ci skip] 2021-09-05 01:34:56 +02:00
decentral1se a3a66ef972
docs: short aliases, short descriptions [ci skip] 2021-09-05 01:21:16 +02:00
decentral1se 7155a33d31
fix: recipe lint and logrus usage 2021-09-05 01:21:05 +02:00
decentral1se d5f49594a9
docs: attempt to simplify app/server/recipe CLI docs [ci skip] 2021-09-05 01:01:31 +02:00
decentral1se 5287f097e7
refactor: drop unused flags for now 2021-09-05 00:56:51 +02:00
decentral1se 1961cdcfee
docs: add autonomic as author 2021-09-05 00:54:36 +02:00
decentral1se 0727223009
docs: place <app> in args usage [ci skip] 2021-09-05 00:44:45 +02:00
decentral1se 07a43cb314
refactor: NewClientWithContext -> New, and use server only 2021-09-05 00:41:31 +02:00
decentral1se dac679db48
refactor: punctuation, error handling and package docs 2021-09-05 00:22:47 +02:00
decentral1se ff21237a21
refactor: clear up app/recipe usage
See coop-cloud/go-abra#36.
2021-09-05 00:14:27 +02:00
decentral1se e68c7fc71c
fix: respect COMPOSE_FILE when loading compose files
Final part of coop-cloud/go-abra#57.
2021-09-04 22:02:49 +02:00
decentral1se da049ad69a
fix: drop swarmkit/etcd dep
Part of coop-cloud/go-abra#57.
2021-09-04 21:08:14 +02:00
knoflook 836420e369
docs: add app remove description 2021-09-03 14:22:40 +02:00
decentral1se 612fc5a531
feat: final round of hacks for deploy command 2021-09-03 11:46:40 +02:00
decentral1se 92c8e9aab9
fix: pass in stack name when deploying 2021-09-02 19:49:41 +02:00
knoflook c150856a66
fix: app rm quitting when there are no secrets/volumes to remove 2021-09-02 17:52:42 +02:00
decentral1se 063fa66af9
WIP heinous appEnv threading for env var loading 2021-09-01 15:01:20 +02:00
decentral1se 09873b42ce
WIP making a mess for stack deploy 2021-09-01 14:03:39 +02:00
decentral1se ac86912ead
WIP chaos integrate deploy/deploy_composefile
The best in copy/pasta technology.

See https://github.com/docker/cli/tree/master/cli/command/stack/swarm
for more.
2021-09-01 13:08:42 +02:00
Roxie Gibson 45c6be02b1
refactor: check for errors on secret rm 2021-08-31 17:08:25 +01:00
Roxie Gibson 7835c1f91d
fix: defers after checking for err 2021-08-31 16:47:38 +01:00
Roxie Gibson 542e9eea5c
refactor: rm unneeded sprintf 2021-08-31 16:47:16 +01:00
Roxie Gibson 32b2bf245b
refactor: simplfiy for...range loops 2021-08-31 16:17:08 +01:00
Roxie Gibson 3b93f893fd
refactor: fix defer and handle error 2021-08-31 16:02:38 +01:00
decentral1se 57e641689a
feat: add secret generate (untested, moving fast) 2021-08-31 11:59:07 +02:00
decentral1se d68f2f5686
feat: add app secret insert 2021-08-31 10:50:02 +02:00
decentral1se f9ae9c9a56
feat: add app secret rm 2021-08-31 10:31:54 +02:00
decentral1se 15651822f1
feat: implement secret ls
Closes coop-cloud/go-abra#54.
2021-08-30 17:02:08 +02:00
decentral1se 66a8630101
feat: implement undeploy command 2021-08-30 01:36:42 +02:00
decentral1se 440911f983
feat: finish app run command 2021-08-29 21:20:21 +02:00
decentral1se 8cc691ab52
WIP app run command 2021-08-29 18:21:30 +02:00
decentral1se db4908c3ae
feat: add restore command 2021-08-29 16:25:31 +02:00
decentral1se 8651e22441
feat: implement app logs command 2021-08-29 14:13:35 +02:00
decentral1se 45e2442e83
fix: more robust length check 2021-08-29 14:13:07 +02:00
decentral1se 547f785da5
feat: add app cp command 2021-08-29 13:41:29 +02:00
decentral1se acca710a5a
feat: add app config command 2021-08-29 10:45:49 +02:00
decentral1se 8ad51c1fd5
feat: implement check command 2021-08-28 20:13:56 +02:00
decentral1se 3a8296a8fe
feat: implement backup command 2021-08-28 19:10:19 +02:00
decentral1se ff0b0b5ad8
feat: finish ps command 2021-08-28 16:00:16 +02:00
decentral1se de5169ea24
fix: support trimming library is version listing 2021-08-25 14:22:31 +02:00
decentral1se 62ceca798c
refactor: sort output of version command 2021-08-25 14:16:33 +02:00
decentral1se b34acefa21
refactor: support listing unknown versions 2021-08-25 14:06:42 +02:00
decentral1se c5bb680fed
refactor: making app version command async 2021-08-25 13:30:55 +02:00
decentral1se ed11634abf
WIP abra app version <app> implementation 2021-08-25 13:06:49 +02:00
knoflook c3088a5158
refactor: create functions in client for removing and listing volumes 2021-08-17 20:39:07 +02:00
knoflook 5663659d23
feat: initial commit for abra app volume ls/rm 2021-08-17 20:39:06 +02:00
Roxie Gibson ca4001a805
docs: fixed typo in functiion comment 2021-08-13 14:13:56 +01:00
Roxie Gibson 98ec23761f
refactor: de-vendor tagcmp into its own repo 2021-08-13 12:49:46 +01:00
Roxie Gibson b143b544b6
fix: err not being checked & unneeded type assert 2021-08-12 14:53:42 +01:00
Roxie Gibson 8f9ffa0667
style: correct error formatting ST1005 2021-08-12 14:41:39 +01:00
knoflook cefad74e22
fix: app rm removing secrets and volumes twice 2021-08-12 12:59:11 +02:00
decentral1se 83671f42a2
feat: recipe sync 2021-08-10 12:55:23 +02:00
decentral1se c6ea18311e
refactor: drop this for now 2021-08-10 08:34:36 +02:00
decentral1se 1c217b127b
docs: add recipe upgrade docs 2021-08-10 08:34:11 +02:00
decentral1se a12b53abab
feat: support tag upgrades without semver-like tags 2021-08-10 08:24:36 +02:00
decentral1se e39c6a05be
feat: detect if tags are not parsable 2021-08-10 07:57:23 +02:00
decentral1se 210baf1905
feat: first POC for recipe upgrade 2021-08-10 07:53:05 +02:00
decentral1se 1b03836210
WIP: add compose updating to recipe upgrade 2021-08-09 17:36:21 +02:00
decentral1se 334e417abf
WIP include catalogue checking in upgrade command 2021-08-09 16:29:16 +02:00
decentral1se 7b1a6dd4d7
WIP first run at the upgrade command 2021-08-09 16:17:40 +02:00
decentral1se a18a9493f2
fix: add missing error handling 2021-08-09 16:17:31 +02:00
decentral1se 3d7961282a
refactor: drop that back to TODO for now 2021-08-06 21:24:56 +02:00
decentral1se 828417c92b
refactor: add config.GetAppComposeFiles 2021-08-06 19:38:06 +02:00
decentral1se 11ef64ead3
WIP: abra recipe upgrade on the way 2021-08-06 15:40:23 +02:00
decentral1se c75c2254e4
refactor: spec out new release command breakdown 2021-08-06 12:34:59 +02:00
decentral1se 36af302d5f
refactor: dangling else, Sprintf formatting, printing 2021-08-06 12:20:14 +02:00
knoflook 6732edf8db
feat: implement app remove
See coop-cloud/go-abra#43.
2021-08-06 12:00:24 +02:00
3wc 8554e68418 fix: line break after `recipe create` 2021-08-06 10:37:15 +02:00
decentral1se 202f7ce561
WIP: spec'ing out the release command
See coop-cloud/go-abra#39.
2021-08-04 23:52:34 +02:00
decentral1se 9378db1979
fix: look up ipv4 from host correctly
We use a custom resolver now instead of relying on the baked-in
Golang resolver which has issues. We use a friendly librehoster
DNS resolver and not Google because fuck that.
2021-08-04 22:51:07 +02:00
decentral1se efb9d6f6a5
feat: finalise recipe lint command 2021-08-04 00:07:23 +02:00
decentral1se 532bb8a336
WIP: recipe lint command 2021-08-03 19:25:32 +02:00
decentral1se 471c982f63
refactor: use new internal arg failure func 2021-08-03 13:57:12 +02:00
Roxie Gibson b351760f6e
refactor(typo): typo of hetzner in output for user 2021-08-02 23:26:57 +01:00
decentral1se 102f4e22b5
docs: fix typo 2021-08-02 22:03:53 +02:00
decentral1se 5294e84d5e
feat: implement capsul create 2021-08-02 15:11:14 +02:00
decentral1se 3e91174ce0
feat: implement hetzner new command 2021-08-02 14:05:39 +02:00
Roxie Gibson 38d8b51bd5
refactor: moved a lot of flags & added comments
Comments added to fix the golint errors on exported things need comments
2021-08-02 07:36:35 +01:00
Roxie Gibson 9070806f8d
refactor: deal with err from ShowSubcommandHelp 2021-08-02 05:58:47 +01:00
Roxie Gibson bb1eb372ef
refactor: stack func to client, mv app to new file
Stack interaction is now under client.

App types and functions moved from env to app under config
2021-08-02 05:51:58 +01:00
Roxie Gibson a3f574a8fa
refactor: app new cmd to be easier to read 2021-08-02 04:18:20 +01:00
Roxie Gibson 30d11f48a7
refactor: break up cli pkg into nice small chunks 2021-08-02 02:10:41 +01:00
Roxie Gibson dc4e490497
refactor(style): error str shouldnt be capitalized 2021-08-02 01:09:25 +01:00
Roxie Gibson ffd1b3a771
refactor: function rename
`errorExit` renamed to `showSubcommandHelpAndError`
2021-08-02 01:08:17 +01:00
Roxie Gibson 8267d4202b
feat: function to display help, error, & exit 2021-08-02 00:57:11 +01:00
decentral1se d74b7636a1
WIP make a start on the hetzner command 2021-08-02 01:54:16 +02:00
decentral1se 4ae5e6123d
refactor: add specific check for missing context 2021-08-02 01:06:41 +02:00
decentral1se 19d435c5e5
feat: implement server init 2021-08-02 01:03:27 +02:00
decentral1se 6be54c670a
fix: error out if missing server arg 2021-08-02 00:37:25 +02:00
decentral1se a1bce4661b
docs: server CLI documentation 2021-08-02 00:30:03 +02:00
decentral1se 8a5ee68b7b
refactor: drop alias command
Save us some work and avoid confusion on two things doing the same thing
under different top-level sub-commands (this was just an experiment
after all).
2021-08-02 00:20:39 +02:00
decentral1se 760ac495b3
fix: handle error for reading apps 2021-07-31 18:47:32 +02:00
decentral1se 42968fb8e1
feat: finally implement app new command 2021-07-31 15:50:04 +02:00
decentral1se 932803453e
WIP: still hacking on the app new command
Finally had to fork godotenv because it strips comments and we need
those to parse length values (e.g. "FOO=v1  # length=10") (or in other
words, motivation to move to the YAML format).

There is a new secret module now, with functionality for dealing with
generation and parsing of secrets.

The final output needs some work and there is also the final step of
implementing the sending of secrets to the docker daemon. Coming Soon
™️.
2021-07-31 12:49:22 +02:00
decentral1se 5771f6c158
WIP another pass on the app new command 2021-07-30 22:55:00 +02:00
decentral1se e728bcd7ac
docs: CLI flag docs and rewording of usage 2021-07-30 22:54:30 +02:00
decentral1se 769c5b899b
refactor: abstract secret generation into package 2021-07-30 22:53:51 +02:00
decentral1se f56ddef6c8
WIP: another step further into app new command 2021-07-30 20:14:17 +02:00
Roxie Gibson a581049cf1
refactor: simplify for loop 2021-07-30 16:32:06 +01:00
decentral1se 064a0f271f
WIP: further process on app new command 2021-07-30 13:16:28 +02:00
decentral1se d422902e09
WIP: spec out first steps for app new command 2021-07-29 12:26:11 +02:00
decentral1se e4ed2aeebf
docs: better wording 2021-07-28 22:13:05 +02:00
decentral1se 1187d6bfd5
refactor: move catalogue logic into own package 2021-07-28 22:10:13 +02:00
decentral1se bf0212c520
docs: more flag aliases (for app new command) 2021-07-28 14:27:23 +02:00
decentral1se de3ea8188e
WIP spec out app new command 2021-07-28 14:26:37 +02:00
decentral1se bf7d437571
docs: more CLI documentation 2021-07-28 13:56:18 +02:00
decentral1se 2c1b8ee7e2
docs: document flags for app new command 2021-07-28 11:30:14 +02:00
decentral1se 622e0127ea
docs: fill out app listing CLI docs 2021-07-28 11:29:59 +02:00
decentral1se 0e75350985
feat: prototype for app listing 2021-07-27 21:25:08 +02:00
decentral1se ef1591d596
WIP: app status listing using concurrency
This being my first time using goroutines, it is pretty messy but the
idea has been shown to be workable! We can concurrently look up multiple
contexts for a much faster response time especially when using multiple
servers.

Remaining TODOs are:

- [ ] Get proper status reporting (deployed/inactive/unknown)
- [ ] Error handling (especially when missing contexts)
- [ ] Refactor and tidy
2021-07-27 12:52:09 +02:00
decentral1se 429c7e4e50
docs: take a pass on CLI usage docs and add ASCII 2021-07-26 23:58:34 +02:00
decentral1se 3bc612c44e
WIP: status lookup for apps listing 2021-07-26 20:59:17 +02:00
decentral1se 2c83113040
docs: add shorthand and usage docs for app ls flags 2021-07-26 19:59:50 +02:00
decentral1se fae5a87ce2
fix: respect --type/-t logic for app listing
Reverts c27376c89b. Woops.
2021-07-26 19:59:26 +02:00
decentral1se 145e6326c9
fix: use domain to follow original abra app ls 2021-07-26 19:49:51 +02:00
decentral1se 5def18a9af
fix: sort by server and type for app listing 2021-07-26 19:47:44 +02:00
decentral1se c27376c89b
fix: disable merging and rely on type being present 2021-07-26 19:16:38 +02:00
decentral1se 01cbee824a
WIP: app list command sorting 2021-07-26 18:23:28 +02:00
decentral1se 337d3e9ae1
refactor: more conventional name for method 2021-07-26 17:50:40 +02:00
decentral1se 60a70d2d83
refactor(recipe): better naming, sorting and types
In order to arrange various types of sorting for the app catalogue, it
seems like the recommended approach is to maintain a separate data
structure alongside the JSON map we get from apps.coopcloud.tech.

Therefore, I attempt to provide a ToList() method and accompanying
sort.Sort interface sorting implementations. For now, this is just
sorting by app name.

I am testing this type of implementation here before moving on to
arrange different types of sorting for the `app list` command.
2021-07-26 17:25:08 +02:00
decentral1se 1f62ace524
refactor: use method to sort recipe apps listing 2021-07-26 15:43:35 +02:00
decentral1se 1f550c2470
feat: finish recipe create command 2021-07-25 19:28:29 +02:00
decentral1se 359b07b562
WIP: recipe create 2021-07-25 00:07:35 +02:00
decentral1se 45c3bce7ff
fix: return if erroring out 2021-07-24 23:30:42 +02:00
decentral1se 6eee02d90a
feat: add recipe versions command 2021-07-24 23:18:23 +02:00
Roxie Gibson dfc91a86a1
feat: WIP server rm command 2021-07-22 17:38:44 +01:00
decentral1se fce1ab6c02
refactor: better naming for loop scoped variables 2021-07-22 14:53:08 +02:00
decentral1se 381de28e83
refactor: make ReadApps main API entrypoint
This allows AppsReadFS/AppsReadWeb to be used behind the scenes of this
API for the conditional loading logic. All functions are left as public
for now while we're experimenting.
2021-07-22 14:51:56 +02:00
decentral1se 56cec1580a
refactor: use app-less naming for this struct also 2021-07-22 14:25:37 +02:00
Roxie Gibson fc7dade6f8
feat: server add command
Interacts with and stores infomaton in the docker store at ~/.docker

Equivalent to docker context add
2021-07-22 12:48:14 +01:00
Roxie Gibson fe86b50ee3
refactor: actual context getting 2021-07-22 09:51:27 +01:00
decentral1se 1f6c0e8c4b
feat: support local apps.json loading
This logic supports the following cases:

- Download a fresh apps.json and load it if missing
- Check if a local apps.json is old and get a fresh one if so
- Always save a local copy after downloading a fresh apps.json

The http.Head() call is faster than a http.Get() call (only carries back
respones headers) and aims to make the more general case more
performant: you have the latest copy of the apps.json and don't need to
download another one. This a direct port of our Bash implementation
logic.

Closes https://git.autonomic.zone/coop-cloud/go-abra/issues/9.
2021-07-21 22:42:51 +02:00
Roxie Gibson 6b370599fa
refactor: simplified sort of app names 2021-07-21 17:12:35 +01:00
Roxie Gibson 9216cc5d6a
refactor: simplifing range statement 2021-07-21 16:36:46 +01:00
decentral1se 53576dc916
Revert "style: add missing type marker"
This reverts commit e064f18730.

As discussed, this is explicitly using a type shorthand which is all
good.
2021-07-21 13:32:16 +02:00
decentral1se 302ebcb394
feat: add recipe ls command 2021-07-21 13:28:46 +02:00
Roxie Gibson 29971c36a0
refactor: moved all fatal errors to logrus
This will allow us to test commands that would normally exit
2021-07-21 09:04:34 +01:00
decentral1se a74d214121
docs: use hyphen shortname and trim message 2021-07-21 00:19:06 +02:00
decentral1se e064f18730
style: add missing type marker 2021-07-21 00:17:16 +02:00
decentral1se 7b2100c568
feat: add version command 2021-07-20 23:59:47 +02:00
Roxie Gibson 16514b3151
feat: implemented type & servers flags in `app ls` 2021-07-20 13:00:03 +01:00
Roxie Gibson cfe2f70151
refactor: moving logging to command functions
easier to unit test our util commands like this
2021-07-19 12:47:46 +01:00
Roxie Gibson bd9bc530d1
faet: a draft version of the app ls command 2021-07-19 08:37:00 +01:00
Roxie Gibson 37c06c82bf
feat: added error to GetContextEndpoint
this ill make the progam not fail if there is a non-docker swarm context
2021-07-18 06:34:22 +01:00
Roxie Gibson 38f610bdec
feat: abra server ls
WE DID IT! The first actual command to be ported.

Code is still a mess in terms of UX but its a milestone!
2021-07-18 04:21:26 +01:00
Roxie Gibson d1f7e8011d
refactor: Moved table function to fornatter
Makes more sense for it to be in there
2021-07-18 03:24:48 +01:00
Roxie Gibson 2134f57dd0
WIP: Messy code that is mostly just testing
This is me trying to print all services in a stack.

Struggling to isolate stack and tasks which is needed for swarm
2021-07-17 09:30:56 +01:00
Roxie Gibson 6c748922b4
feat: added context flag to make dev easier
needed until we have proper server subcommand system
2021-07-17 09:29:25 +01:00
Roxie Gibson b9e06f2310
feat: added util formatting for the cil 2021-07-17 09:27:52 +01:00
Roxie Gibson be46695d82
feat: added flags to base command
they already exist just attatching them to the command
2021-07-17 05:11:48 +01:00
Roxie Gibson a78bb9123a
feat: POC passgen 2021-07-15 08:23:26 +01:00
Roxie Gibson 1adca5ca0e
feat: added app commands and flags for commands 2021-07-15 06:17:47 +01:00
Roxie Gibson 9a0bd6dc11
refactor(cli): moved commands and cli out of main 2021-07-15 03:44:07 +01:00