Deploy to Google Cloud Platform using Cloud Run: a step-by-step guide.

Google Cloud Platform (GCP) is a suite of cloud computing services from Google, providing a comprehensive infrastructure to deploy and manage applications of all kinds. In this article, you will learn how to deploy your Pathway application to GCP using Cloud Run, a compute platform that lets you run containers on scalable infrastructue.

The entire process is as easy as deploying any dockerized application. You will see, step by step, how to deploy a Pathway web service hosted on a GitHub repository.

Prerequisites

  1. Google account
  2. GitHub account
  3. A GitHub project with Pathway application and Dockerfile

For an easy start, you can fork our demo repository.

Note: Regardless of whether you use a Gmail or Google Workspace account, you can test Cloud Run for free. Google may require billing information, but you will not be charged after the trial period.

Create Google Cloud project

The first step is to create a Google Cloud project at GCP Console

  1. Choose friendly name of your project and click Create
image Create Google Cloud project

Create Cloud Run service

Now that you have your project ready, go to Cloud Run. Make sure your newly created project is selected in top left corner.

  1. Click on the "Create Service" button
image create a new service
  1. Select "Continuously deploy from a repository" and click on "Set up with Cloud Build":
image build from GitHub
  1. Point to the repository with your Pathway application and click the "Next" button.

Note: Google may prompt you to enable additional APIs. In such case simply click Enable and wait for a short time. If you are not authenticated already, choose Github as the repository provider and authenticate.

When prompted, paste your repository identifier: https://github.com/pathway-labs/realtime-indexer-qa-chat

image choose GitHub repository
  1. Choose "Dockerfile" as a build type and save the changes:
image choose Dockerfile build type

Note: if you are using custom repository, you can adjust Dockerfile path.

  1. Select "Allow unauthenticated invocations" as an authentication type:
image choose authentication type
  1. Under container resources section, increase memory to at least 1 GiB and click "Create":
image increase memory limits

Test your deployment

Once your app has been deployed, you will see a green mark next to the project name. You can now copy the URL of your service and test it with CURL.

image copy service URL

If your deployment is ready, you can test it with the following command:

curl -X POST -d '{"input": "hello, world"}' <YOUR-URL>

You can learn more about this example on GitHub.

Deploy changes

You have successfully deployed a sample Pathway application using Cloud Run. You can now adjust the Pathway pipeline by modifying app.py. Once you are ready, commit and push your changes. Cloud Build will automatically detect your changes and start deploying the new version. You can monitor this process under the revisions tab.

image revisions

Delete your web service

If you were only testing your web service and wish to delete it, go to Cloud Run, select your service, and click the "Delete" button.

image delete service

Conclusions

In this guide, you learned how to deploy a Pathway application to GCP using Cloud Run, from setting up your Google Cloud project to testing and managing your deployment. By leveraging the continuous deployment capabilities of Google Cloud Build, you can deploy changes to your applications in seconds. Don't hesitate to explore other methods for deploying Pathway in our dedicated article.