Using the CLI

The Akka Serverless command-line interface complements the Console interface and makes most deployment and configuration operations available from the command line. This page shows the use of common commands. The List of akkasls commands page links to all commands.

Check periodically to make sure you have the latest akkasls command installed. The command akkasls version prints the version number of akkasls. Download the latest version as described in Setting up the Akka Serverless CLI.

Usage

Generally, akkasls is followed by a command, with optional sub-commands and parameters. You may also supply flags, preceded by -- (two hyphens) that modify the operation of the command-line client itself.

Log in

To use the akkasls CLI, you must authenticate your command line client with your Akka Serverless account. Entering auth login at the command line launches the Akka Serverless login screen in your default browser. The command line client prints Waiting for UI login…​ and pauses. After you log in and click Authorize, the command line prompt returns.

Upon successful authentication, if your account contains:

  • One project, the CLI will report that it is the current project, which will be the target of subsequent commands.

  • No projects, you need to explicitly set the target project after creating a project.

  • Multiple projects, you need to explicitly set the target. Use akkasls projects list to see all of your projects.)

To log in, enter:

akkasls auth login

To set the target project to my-project:

akkasls config set project my-project

Enter akkasls auth -h at the command line, or see akkasls auth for other authentication related commands.

Administer Akka Serverless projects

Enter akkasls projects -h at the command line, or see akkasls projects for a complete list of commands to manage your Akka Serverless projects.

Create a new project

akkasls projects new sample-project "An example project in Akka Serverless"

The akkasls projects new NAME [DESCRIPTION] command will create a new project in your Akka Serverless account.

You may want to mark the new project as the current project, which will be the target of subsequent commands. You can do that by entering:

akkasls config set project sample-project

List projects

akkasls projects list

The akkasls projects list command will list a quick one-line summary of all projects that your Akka Serverless account has access to. The current project will have an asterisk '*' next to it.

Add Docker access credentials

akkasls docker add-credentials \
  --docker-server https://mydockerregistry.com \
  --docker-username myself \
  --docker-password secret

To let Akka Serverless retrieve Docker images from private repositories, use the akkasls docker add-credentials [flags] command to add a set of docker credentials to the project. The flags are:

  • --docker-server string The docker server, for example https://mydockerregistry.com

  • --docker-username string The docker username

  • --docker-password string The docker password

  • --docker-email string The docker email address

See akkasls docker -h or akkasls docker for a complete list of commands to manage Docker credentials.

Administer services

The akkasls services commands manipulate the services in your current Akka Serverless project.

List services

akkasls services list

The akkasls services list command lists a one-line summary of all services under the current project.

Deploy a service

akkasls services deploy \
    my-service \
    my-container-uri/container-name:tag-name

The akkasls services deploy service-name docker-image command will deploy a service with name service-name using the docker-image.

You will need to set up Docker credentials in order for Akka Serverless to be able to pull from your image repository.

Expose a service route

akkasls services expose my-service --enable-cors

The akkasls services expose service-name command creates a route to expose a service for inbound traffic. You may optionally enable HTTP CORS with the --enable-cors flag.

View logs of a service

akkasls services logs my-service

The akkasls services logs service-name will display logging output for your service.

View details of a service

akkasls services get my-service

The akkasls services get service-name shows the description of a specific service in the current project.

Configure shell command completion

Completion allows you to hit [TAB] on a partially entered akkasls command and have the shell complete the command, subcommand or flag for you.

bash

To load completion for bash run

source <(akkasls completion)

To configure your bash shell to load completions for each session add this to your ~/.bashrc or ~/.profile file:

# add to ~/.bashrc or ~/.profile
source <(akkasls completion)

In order use bash completion, you may need to enable it in your ~/.bashrc (or appropriate) file with something like:

if [ -f /etc/bash_completion ]; then
  source /etc/bash_completion
fi
zsh (eg. MacOS)

To set up zsh shell completion run

akkasls completion zsh > "${fpath[1]}/_akkasls"
compinit

If shell completion is not already enabled in your environment you will need to enable it. You can execute the following once:

echo "autoload -U compinit; compinit" >> ~/.zshrc
fish

To set up fish shell completion run

akkasls completion fish > ~/.config/fish/completions/akkasls.fish
source ~/.config/fish/completions/akkasls.fish
Powershell

To set up shell completion for Powershell run

akkasls completion powershell | Out-String | Invoke-Expression