Integrating with CI/CD
You can deploy Akka Serverless services from a CI/CD (Continuous Integration/Continuous Delivery) service with the
akkasls command. You need to create a script that installs
akkasls and authenticates as an Akka Serverless account. To authenticate a CI/CD service, the script needs a refresh token.
You can use your own account in the script, or create a separate account tied to a different email address by inviting that address to your Akka Serverless project.
Create a refresh token as follows:
Log in to the account you want to authenticate.
Create a refresh token with
akkasls auth tokens create --type=refresh --scopes=execution --description="My CI/CD token"
The output will look similar to:
Token created: cst1.832640ce01f08072e91e3c848eb0767763f94ba9f973fa127d0c285a74e88076
Record the token and configure it in your CI/CD solution as a secret to be passed as an environment variable, for example, as
The next section provides an example of how to use the variable.
To configure deployment with
akkasls, write a script that runs in your CI/CD environment. You need the refresh token to be passed as an environment variable as described above. Additionally, you will need the id(s) of the project(s) you wish to work with.
The script needs the project id (a UUID), not the project name. Because the token has
The example below assumes use of an
AKKASLS_TOKEN environment variable for the refresh token, and an
AKKASLS_PROJECT_ID environment variable for the project ID.
The following example script sets up continuous integration on a Linux machine. For other operating systems, see how to download and install
# Download and install akkasls wget https://downloads.akkaserverless.com/stable/akkasls_linux_amd64.tar.gz tar -xzf akkasls_linux_amd64.tar.gz mv akkasls /usr/local/bin # Log in akkasls config set refresh-token $AKKASLS_TOKEN # Set the project to work with akkasls config set project $AKKASLS_PROJECT_ID