In order to publish an agent, you will need an image repository to store your agent’s Docker image. Any image repository that can be made public will work. In this section we will walk through creating an image repository on Google Artifact Registry from scratch.

Prerequisites

  • A valid email address
  • A credit card for billing (GCP offers a free tier and $300 in free credits for new users)

Step 1: Create a GCP Account

  1. Go to the Google Cloud Platform website.
  2. Click on the Get started for free button.
  3. Follow the on-screen instructions to create a new Google account or sign in with an existing Google account.
  4. Set up your billing information to access the free tier and free credits.

Step 2: Set Up a New Project

  1. Once logged into the GCP Console, click on the Select a project dropdown at the top of the page.
  2. Click on New Project.
  3. Enter a project name, select a billing account, and choose a location.
  4. Click on Create.

Step 3: Enable the Artifact Registry API

  1. In the GCP Console, go to the Navigation menu > API & Services > Library.
  2. Search for Artifact Registry API.
  3. Click on Artifact Registry API and then click on Enable.

Step 4: Ensure Necessary Permissions

  1. As the owner of the project, you already have the necessary permissions to manage Artifact Registry repositories. If you are using a different account, ensure that it has the Editor role at the project level.

Step 5: Install and Configure Google Cloud SDK (gcloud CLI)

  1. Download and install the Google Cloud SDK.
  2. Open a terminal or command prompt.
  3. Initialize the SDK with the following command:
    gcloud init
    
  4. Follow the on-screen prompts to log in with your Google account and set the default project.

Step 6: Authenticate the CLI Using Application-Default Login

  1. Authenticate the gcloud CLI with your user account:
    gcloud auth application-default login
    
    Follow the on-screen prompts to log in with your Google account. This command sets up application-default credentials for the CLI.

Step 7: Configure Docker to Use Google Artifact Registry

  1. Install Docker if it is not already installed. Follow the instructions on the Docker website to install Docker for your operating system.
  2. Configure Docker to authenticate with Google Artifact Registry:
    gcloud auth configure-docker us-central1-docker.pkg.dev
    

This command updates the Docker configuration to use the credentials from the gcloud CLI. Replace us-central1 with the region where your repository is located.

Step 8: Create a Repository

  1. Create an Artifact Registry repository:
gcloud artifacts repositories create REPOSITORY_NAME --repository-format=docker --location=LOCATION

Replace REPOSITORY_NAMEwith the desired name of your repository andLOCATIONwith your preferred GCP region (e.g.,us-central1).

Step 9: Make the Repository Public

  1. In the GCP Console, go to the Navigation menu > Artifact Registry > Repositories.
  2. Click on the repository you want to make public.
  3. Click on the Permissions tab.
  4. Click on Add principal.
  5. In the New principals field, enter allUsers.
  6. In the Select a role dropdown, choose Artifact Registry > Artifact Registry Reader.
  7. Click on Save.

Step 10: Verify the Image in Google Artifact Registry

  1. In the GCP Console, go to the Navigation menu > Artifact Registry > Repositories > REPOSITORY_NAME.
  2. You should see the image you pushed listed under your repository.

Additional Considerations: Quotas

By default, GCP provides sufficient quotas for most users. However, if you need to increase quotas for your project:

  1. Go to the Navigation menu > IAM & Admin > Quotas.
  2. Filter by the quota you need to increase (e.g., Artifact Registry storage).
  3. Select the quota and click on Edit Quotas.
  4. Fill out the request form and submit it. Google will review your request and notify you of the outcome.

Conclusion

You have now successfully created a GCP account, set up the necessary permissions, configured the CLI, created an Artifact Registry repository, and made it public. For more advanced configurations and management, refer to the GCP documentation.

You can proceed to create an agent and use the registry when prompted for it.

mkdir newagent && cd newagent
surfkit new

Then once the agent is ready

surfkit publish --build