Google Cloud Run

Getting started with Akita is as simple as dropping our Agent into your Dockerfile. Below are instructions for installing the Akita Agent in Google Cloud Run using a Dockerfile.

🚧

Private Beta

You will need to be in our beta.

❗️

Using Google Cloud Run with Windows?

We only support Linux at the moment. Let us know so we can prioritize adding support.

❗️

Deploying directly from source?

If you are using Google Cloud Run to deploy an application without a container, these instructions do not apply to you. See Generating API Models without Packet Capture for some additional options.

🚧

Akita requires execution environment gen2

The current GA release of Google Cloud Run uses a runtime environment which simulates Linux system calls. This simulated environment cannot support the Akita client's passive observation. You will need to upgrade your execution environment to "gen2", which supports full Linux compatibility. This is a beta feature in Google Cloud; see About Execution Environments in the Google Cloud Run documentation.

You will be setting up the Akita Agent to run within your Docker container. To set up the Akita Agent you will:

  1. Create an Akita Project
  2. Generate an API key for the Akita Agent
  3. Install the Akita Agent in your container
  4. Run the Akita Agent
  5. Configure your Akita API key as a Secret
  6. Launch the new container
  7. Verify that the Akita Agent is working

Create a project

Log into the Akita App, and go to the Settings page.
Enter a project name and click "Create Project". We suggest naming the project after your app or deployment stack.

22542254

Give your project a name that's easy to remember – you'll need it later, when you start the Akita Agent on the CLI.

Generate API key

On the same Settings page, locate and click the “API Keys” tab. Click the “Set up the Akita client” button. Copy your API key secret into your favorite password manager or somewhere else you can easily access it. Also note your API key, as you will need it later.

780780

Install Agent in container

Install the Akita Agent during your container build process by running the install script below, adding it to your Dockerfile.

RUN bash -c "$(curl -L https://releases.akita.software/scripts/install_akita.sh)"

Run Agent

There are two options for running the Akita Agent:

  1. Modify the entry point in your Dockerfile, or
  2. Via a script

Run with Dockerfile

Next, change your container's default command to the Akita Agent by adding the below to your Dockerfile. Use the project name you created earlier on the Akita console.
You will need to set a rate-limit. We recommend starting with a low rate-limit, as it is applied to each running container.

CMD ["/usr/local/bin/akita", "apidump", "--project", "<your project name>", \
     "-u", "root", "-c", "<your normal command line>", \
     "--rate-limit", "1000"]

Run with script

If your normal entry point is a script, you can run the Akita Agent as a background process. Run akita apidump --project <your_project_name> in the background.

Configure API key

The Akita Agent needs to access the API Key you created earlier; the simplest way is to set is as an environment variable in the Cloud Run service. In the UI, you can specify environment variables while creating or deploying a new revision of your service:

857857

Or, you can specify the API key ID and API key secret on the command line with the --set-env-vars flag when you deploy a new version of the service.

$ gcloud beta run deploy ... \ 
  --set-env-vars AKITA_API_KEY_ID=apk_xxxx,AKITA_API_KEY_SECRET=xxxxxxxxxxxx

Launch Container

After editing your Dockerfile and rebuilding, you need to launch the new version of service in a gen2 execution environment. On the command line, you can specify this as a command line flag:

$ gcloud beta run deploy ... \
  --execution-environment gen2 \
  --set-env-vars AKITA_API_KEY_ID=apk_xxxx,AKITA_API_KEY_SECRET=xxxxxxxxxxxx

Note that you have to specify beta to enable the gen2 execution environment, as it is not currently a GA release.

From the console, you can select the "Second generation" execution environment.

739739

Verify

In the Akita web console, check out the incoming data on the Model page. You should see a map of your API being generated as the Akita Agent gathers data.

Then check out the Metrics and Errors page to get real-time information on the health of your app or service.