-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* successfully renamed * adding dockerfile for deployment options * adding github package * added install scripts
- Loading branch information
Ryan SVIHLA
authored
Nov 15, 2021
1 parent
12a4732
commit b64572c
Showing
19 changed files
with
599 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Astra Cli docker image | ||
|
||
on: | ||
push: | ||
# Publish `master` as Docker `latest` image. | ||
branches: | ||
- main | ||
- seed | ||
|
||
# Publish `v1.2.3` tags as releases. | ||
tags: | ||
- v* | ||
|
||
# Run tests for any PRs. | ||
pull_request: | ||
|
||
env: | ||
IMAGE_NAME: astra-cli | ||
|
||
jobs: | ||
# Push image to GitHub Packages. | ||
# See also https://docs.docker.com/docker-hub/builds/ | ||
push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build image | ||
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" | ||
|
||
- name: Log in to registry | ||
# This is where you will update the PAT to GITHUB_TOKEN | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Push image | ||
run: | | ||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
# Strip git ref prefix from version | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# Use Docker `latest` tag convention | ||
[ "$VERSION" == "main" ] && VERSION=latest | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
docker push $IMAGE_ID:$VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM golang:1.17.3-alpine as BUILD | ||
|
||
COPY / /astra | ||
WORKDIR /astra | ||
|
||
RUN ./script/build | ||
|
||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
WORKDIR /root/ | ||
COPY --from=0 /astra/bin/astra /astra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,19 @@ Apache 2.0 licensed Astra Cloud Management CLI | |
|
||
Ready for production | ||
|
||
## How to install - install script | ||
|
||
* /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/rsds143/astra-cli/main/script/install-astra.sh)" | ||
* astra login | ||
|
||
## How to install - docker | ||
|
||
Instead of downloading the binary this trusts that you have docker installed | ||
|
||
* make sure docker is installed | ||
* /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/rsds143/astra-cli/main/script/install-astra-docker.sh)" | ||
* astra.sh login | ||
|
||
## How to install - Homebrew for Mac and Linux | ||
|
||
* [install homebrew](https://brew.sh/) if you have not | ||
|
@@ -22,13 +35,13 @@ Ready for production | |
* download a [release](https://github.com/rsds143/astra-cli/releases) | ||
* tar zxvf <download> | ||
* cd <extracted folder> | ||
* ./astra-cli | ||
* ./astra | ||
|
||
## How to install - From Source | ||
|
||
* Install [Go 1.16](https://golang.org/dl/) | ||
* Install [Go 1.17](https://golang.org/dl/) | ||
* run `git clone [email protected]:rsds143/astra-cli.git` | ||
* run `./scripts/build` or `go build -o ./bin/astra-cli .` | ||
* run `./scripts/build` or `go build -o ./bin/astra .` | ||
|
||
## How to use | ||
|
||
|
@@ -40,58 +53,51 @@ Ready for production | |
After creating a token with rights to use the devops api | ||
|
||
``` | ||
./bin/astra-cli login --token "changed" | ||
astra login --token "changed" | ||
Login information saved | ||
``` | ||
### login service account | ||
|
||
After creating a service account on the Astra page | ||
|
||
``` | ||
./bin/astra-cli login --id "changed" --name "changed" --secret "changed" | ||
astra login --id "changed" --name "changed" --secret "changed" | ||
Login information saved | ||
``` | ||
|
||
## login service account with json | ||
|
||
``` | ||
./bin/astra-cli login --json '{"clientId":"changed","clientName":"[email protected]","clientSecret":"changed"}' | ||
astra login --json '{"clientId":"changed","clientName":"[email protected]","clientSecret":"changed"}' | ||
Login information saved | ||
``` | ||
|
||
### creating database | ||
|
||
``` | ||
./bin/astra-cli db create -v --keyspace myks --name mydb | ||
2021/02/24 18:23:24 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PENDING but expected ACTIVE trying again 19 more times | ||
2021/02/24 18:23:29 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PENDING but expected ACTIVE trying again 18 more times | ||
2021/02/24 18:23:35 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PENDING but expected ACTIVE trying again 17 more times | ||
2021/02/24 18:23:40 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PENDING but expected ACTIVE trying again 16 more times | ||
2021/02/24 18:23:45 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PENDING but expected ACTIVE trying again 15 more times | ||
2021/02/24 18:23:50 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PENDING but expected ACTIVE trying again 14 more times | ||
2021/02/24 18:23:55 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PENDING but expected ACTIVE trying again 13 more times | ||
2021/02/24 18:24:00 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PENDING but expected ACTIVE trying again 12 more times | ||
astra db create -v --keyspace myks --name mydb | ||
............ | ||
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b created | ||
``` | ||
|
||
### get secure connection bundle | ||
|
||
``` | ||
./bin/astra-cli db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d external -l external.zip | ||
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d external -l external.zip | ||
file external.zip saved 12072 bytes written | ||
./bin/astra-cli db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d internal -l internal.zip | ||
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d internal -l internal.zip | ||
file internal.zip saved 12066 bytes written | ||
./bin/astra-cli db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d proxy-internal -l proxy-internal.zip | ||
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d proxy-internal -l proxy-internal.zip | ||
file proxy-internal.zip saved 348 bytes written | ||
./bin/astra-cli db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d proxy-external -l proxy-external.zip | ||
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d proxy-external -l proxy-external.zip | ||
file proxy-external.zip saved 339 bytes written | ||
``` | ||
|
||
### get secure connection bundle URLs | ||
|
||
``` | ||
./bin/astra-cli db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -o list | ||
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -o list | ||
external bundle: changed | ||
internal bundle: changed | ||
external proxy: changed | ||
|
@@ -101,15 +107,15 @@ file proxy-external.zip saved 339 bytes written | |
### listing databases | ||
|
||
``` | ||
./bin/astra-cli db list | ||
astra db list | ||
name id status | ||
mydb 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b ACTIVE | ||
``` | ||
|
||
### listing databases in json | ||
|
||
``` | ||
./bin/astra-cli db list -o json | ||
astra db list -o json | ||
[ | ||
{ | ||
"id": "2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b", | ||
|
@@ -157,15 +163,15 @@ mydb 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b ACTIVE | |
### getting database by id | ||
|
||
``` | ||
./bin/astra-cli db get 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
astra db get 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
name id status | ||
mydb 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b ACTIVE | ||
``` | ||
|
||
### getting database by id in json | ||
|
||
``` | ||
./bin/astra-cli db get 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b -o json | ||
astra db get 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b -o json | ||
{ | ||
"id": "2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b", | ||
"orgId": "changed", | ||
|
@@ -212,49 +218,30 @@ mydb 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b ACTIVE | |
|
||
### parking database | ||
|
||
Does not work on serverless | ||
NOTE: Does not work on serverless | ||
|
||
``` | ||
./bin/astra-cli db park -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
astra db park -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
starting to park database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
2021/02/24 18:31:26 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PARKING but expected PARKED trying again 29 more times | ||
2021/02/24 18:31:56 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PARKING but expected PARKED trying again 28 more times | ||
2021/02/24 18:32:26 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PARKING but expected PARKED trying again 27 more times | ||
2021/02/24 18:32:57 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PARKING but expected PARKED trying again 26 more times | ||
2021/02/24 18:33:27 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state PARKING but expected PARKED trying again 25 more times | ||
........... | ||
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b parked | ||
``` | ||
|
||
### unparking database | ||
|
||
Does not work on serverless | ||
NOTE: Does not work on serverless | ||
|
||
``` | ||
./bin/astra-cli db unpark -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
astra db unpark -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
starting to unpark database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
2021/02/25 08:41:02 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 59 more times | ||
2021/02/25 08:41:32 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 58 more times | ||
2021/02/25 08:42:02 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 57 more times | ||
2021/02/25 08:42:32 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 56 more times | ||
2021/02/25 08:43:02 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 55 more times | ||
2021/02/25 08:43:32 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 54 more times | ||
2021/02/25 08:44:02 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 53 more times | ||
2021/02/25 08:44:32 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 52 more times | ||
2021/02/25 08:45:03 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 51 more times | ||
2021/02/25 08:45:33 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 50 more times | ||
2021/02/25 08:46:03 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 49 more times | ||
2021/02/25 08:46:33 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 48 more times | ||
2021/02/25 08:47:03 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 47 more times | ||
2021/02/25 08:47:33 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 46 more times | ||
2021/02/25 08:48:03 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 45 more times | ||
2021/02/25 08:48:33 db 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b in state UNPARKING but expected ACTIVE trying again 44 more times | ||
........... | ||
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b unparked | ||
``` | ||
|
||
### deleting database | ||
|
||
``` | ||
./bin/astra-cli db delete -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
astra db delete -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
starting to delete database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b | ||
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b deleted | ||
``` | ||
|
@@ -264,7 +251,7 @@ database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b deleted | |
I did not have a paid account to verify this works, but you can see it succesfully starts the process | ||
|
||
``` | ||
./bin/astra-cli db resize -v 72c4d35b-1875-495a-b5f1-97329d90b6c5 2 | ||
astra db resize -v 72c4d35b-1875-495a-b5f1-97329d90b6c5 2 | ||
unable to unpark '72c4d35b-1875-495a-b5f1-97329d90b6c5' with error expected status code 2xx but had: 400 error was [map[ID:2.000009e+06 message:resizing is not supported for this database tier]] | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.