Skip to main content

GCP

In this walk-through, you’re going to automate the deployment of your application on GCP using Argonaut. It's aimed at first-time users of Argonaut.

The walk-through assumes that you have and can log into:

  • A GitHub account
  • A GCP account linked to a GCP Organization

Let's begin.

1. Create an Argonaut account

If it’s your first time using Argonaut, you’ll need to sign up for an Argonaut account. Alternatively, if you already have one, log into your account.

2. Create an organization

Each Argonaut account can be connected with multiple GCP projects and organizations.

  1. Click on the Settings icon on your top right.
  2. Click on Cloud Connect.
  3. Under Organization Details, type in a name in the Organization Name field.
  4. Click on the Set button.
  5. You should see an Org is set successfully message.

Create your organization

3. Connect your GCP account

To connect your GCP account with Argonaut:

  1. Log into your GCP account, if not already logged in.
  2. Go to Google Cloud Console.
  3. Create an Organization resource.
  4. Create a project within your organization resource.
  5. Attach your project to a billing account.
  6. Get and copy your organization resource ID.
  7. Navigate to Argonaut dashboard.
  8. Click on the Settings icon on top right.
  9. Click on Cloud Connect.
  10. Scroll to Connect Your Cloud section.
  11. Under Google Cloud Platform, paste your GCP organization resource ID, and click Add.
  12. Copy the shown code snippet.
  13. Run that code snippet on the provided Cloud Console URL.
  14. Go back to your Argonaut Cloud Connect page and refresh the status of your organization resource.
  15. Verify that the status of the organization now shows Connected.

Connect to your GCP account

4. Connect your GitHub account

With your GCP account successfully connected, you finally need to connect Argonaut to your GitHub repository.

  1. Click on the Settings icon ⚙ on the top right of the top nav.
  2. Click Version Control on the left pane.
  3. Scroll to GitHub.
  4. Click +.
  5. Click on the GitHub account you’d like to connect with Argonaut. You’ll host your sample application on this account.
  6. Click on Install to install ArgonautBot on your chosen GitHub account.
  7. Enter your password, and click on Confirm Password.
  8. On successfully connecting your GitHub account, you’ll be redirected to the Version Control page that shows your GitHub account.

Connect your GitHub account

5. Create an environment

  1. Click on Infrastructure in top nav bar.
  2. Click on Environments +.
  3. Choose Google Cloud Platform.
  4. Choose your GCP Org from the dropdown.
  5. Choose your GCP Project from the dropdown.
note

The chosen GCP project must be attached to a GCP billing account and be a part of a GCP organization.

  1. Type your environment's name.
  2. Choose your environment’s region. An environment's region can't be changed later.
  3. Click on Create Environment.

Create environment

To check if the environment creation was successful, navigate to the Infrastructure page from the top nav bar pane, and look for your environment's name in the list.

6. Create a GKE cluster

To deploy your application on K8s, you need to first create a K8s cluster:

  1. Navigate to InfrastructureNew Resource +.
  2. Click on GKE.
  3. Input the following values:
    1. Cluster Name as gcpquickstart.
    2. Initial Node Count as 3.
  4. Click Add Node Group.
    1. Set Nodes: Min as 3 and Max as 5.
    2. Set Disk Capacity as 10.
  5. Click on Create GKE.

Create GKE

  1. You'll be redirected to the History page.
  2. Check the status of the cluster, and ensure that it shows a green checkmark.

7. Set up automatic deployment

  1. Fork the battleships repository into your GitHub account - the same account that you’ve connected to in Argonaut. The rest of the steps assume that the name of the forked repository is also battleships.

  2. On your Argonaut dashboard, click on Applications on your left pane.

  3. Click the button Deployment + on the top right.

  4. Select Git Source.

  5. This takes you to the Deployment Details step.

    1. Choose your GitHub account from the dropdown.
    2. Choose the battleshipsrepository.
    3. Choose the main branch.
    4. Click Next.

    Configure deployment details

  6. You’ll be taken to the Select Runtime step.

    1. Select Kubernetes.
    2. Choose your Target Cluster as gcpquickstart.
    3. In Service, fill gcpquickstart.
    4. In Path, fill ./Dockerfile.
    5. Ensure, Service Type is chosen as Stateless.
    6. Under Network Services, click Add Service.
      1. Fill your Hostname.
      2. Fill the port you want the application to run on in Container Port.
    7. Ensure that Resource Requests & Limits have values set by default.
    8. Click Deploy.
  7. After clicking Deploy, you’ll be taken to the Deployments page that shows the deployment logs. Your application is now being deployed.

  8. To check if the deployment was complete, look for a green check mark icon against your deployment commit ID, on the Deployments page.

  9. Once deployed, navigate to the URL you provided as Hostname. You should see the following screen:

Battleships index page

You’ve successfully deployed your example application using Argonaut! Let’s test whether your application now automatically gets deployed when you push a code change.

8. Test automatic deployment

You’re now ready to test if your app gets deployed automatically whenever any code change is pushed to it. Let’s make a code change, and view the app again.

  1. Git clone your forked battleshipsrepository on your local machine.
  2. Make a code change, and push to remote.
  3. Check your application’s deployments on Argonaut dashboard: ApplicationsgcpquickstartDeployments
  4. You’ll see an ongoing deployment against your commit ID.
  5. Once the deployment is complete, navigate to your service URL to test that your code change is live.

That’s it!

You just used Argonaut to successfully set up automatic deployment of an example application on every code push. You can now connect your own app with Argonaut to automate its deployment.