The alis
command-line interface (CLI) is the primary tool to create and manage resources on alis.exchange. You can use this tool to perform many common platform tasks either from the command line or in scripts and other automations. Some example use cases for the CLI:
- List organisations and/or products;
- Clone a product to your local environment;
- Create a new product / organisation;
- Deploy new versions of your product; and
- Manage the build and deploy steps of your services.
The CLI requires the following to be set up in order to run.
The CLI makes use of Google Cloud SDK authentication to seamlessly authenticate your requests to alis.exchange.
- Install the latest version of Cloud SDK for your device by following the instructions.
- Run
gcloud auth login
from your terminal to authenticate your local environment with Google user account via a web-based authorization flow. NOTE Ensure that you login using your account associated with alis.exchange. - Run
gcloud auth application-default login
to acquire new user credentials to use for Application Default Credentials (ADC). These are used in calling Google APIs.
Install any one of the three latest major releases of Go. For installation instructions, see Go’s Getting Started guide.
☑️ After installation, running go version
should reflect one of the three latest major Go versions.
-
Install the Protocol buffer compiler,
protoc
, version 3. For installation instructions, see Protocol Buffer Compiler Installation. This tool significantly simplifies working with our Protocol Buffers. -
Install the required Go plugins for the protocol compiler:
-
Install the protocol compiler plugins for Go using the following commands:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
-
Update your
PATH
so that theprotoc
compiler can find the plugins:export PATH="$PATH:$(go env GOPATH)/bin"
-
Git may already be installed on your device. Check by running git --version
. A successful response should look similar to git version 2.30.0
. If the command was not found, follow the installation instructions.
Your Git needs to be configured with Google Cloud Source repositories. Credential helper scripts provide the information that Git needs to connect securely to Cloud Source Repositories using your Google Account credentials.
- Access this link and log in with your Google credentials
- Copy the relevant script into your terminal
☑️ Check if this was successful by opening the .gitcookies
file in Vim: vim ~/.gitcookies
. If successful, the file should contain a source.developers.google.com
entry.
Since the CLI is in a private repository, you will need to ensure that:
- Your Git user credentials are consistent with your GitHub account that was granted access to the CLI. Ensure this by running:
git config --global user.name "YOUR_GITHUB_USERNAME" git config --global user.email "YOUR_GITHUB_EMAIL"
- You access the private repository with a SSH request, rather than a HTTP request.
-
Generate a new access token and set:
- Note: alis.exchange
- Expiration: No expiration
- Scopes: Repo (Full control of private repositories)
-
Run the following in your terminal:
export GIT_USER="YOUR_GITHUB_USERNAME" export TOKEN="PASTE_THE_GENERATED_TOKEN_HERE" git config --global url."https://${GIT_USER}:${TOKEN}@github.com".insteadOf "https://github.com"
-
☑️ Check if this was successful by running git config -l
. The response should include:
user.name="YOUR_GITHUB_USERNAME"
user.email="YOUR_GITHUB_EMAIL"
url.https://{YOUR_GITHUB_USERNAME}:{GITHUB_TOKEN}@github.com.insteadof=https://github.com
❗️Note that there should only be one url.https entry for the github.com, if not, open the ~/.gitconfig
in your editor and remove the older entries.
- Since the CLI is in a private repo, the GOPRIVATE variables need to be set. If not set, the
go install
will try and retrieve the libraries from the public golang.com domain and fail with at 404 not found error.
go env -w GOPRIVATE=go.protobuf.alis.alis.exchange,github.com/alis-x/cli/alis
- Install the CLI. This will place the CLI binary in your
$GOPATH/bin
folder.
go install github.com/alis-x/cli/alis@latest
- Ensure that
$GOPATH/bin
has been added to your$PATH
such that your terminal can access thealis
CLI. The following command appends the path to the.zshrc
file.
echo 'export PATH="$PATH:$(go env GOPATH)/bin"' >> ~/.zshrc
- Close and restart all currently open terminal windows, including IDEs, such that the configurations of the paths can take place.
# Show help
alis -h
# list available organisations
alis org list
# Setup your local environment for organisation 'foo'
alis org get foo
# list available products
alis product list foo