Skip to main content

Deploy on Google Cloud

In this guide we'll walk you through deploying an Interval app on Google Cloud Run.

The full code for this example is also available on GitHub.

Before you begin

There are two important requirements for running Interval on Google Cloud Run.

The first is that your instance must use always allocated CPUs with a single allocated instance. Interval requires an always-online listener, and we won't be able to connect to your app if Google allows the server to sleep or shut down due to inactivity.

The second is that your entrypoint must listen for connections on port 8080. This is how Google detects that your app is online:

import "dotenv/config";
import Interval, { io } from "@interval/sdk";

// Google Cloud Run requires a process listening on port 8080
const http = require("http");
const server = http.createServer(() => {});

const interval = new Interval({
apiKey: process.env.INTERVAL_API_KEY,
actions: {
hello_world: async () => {
const name = await io.input.text("Your name");
return `Hello, ${name}`;



Use the following instructions to set up a new instance on Google Cloud Run to run Interval.

This guide assumes you'll be setting up continuous deployment from a GitHub repo using a Dockerfile. For examples of how to set up your project, check out a sample Dockerfile and index.ts.

  1. Go to the Cloud Run dashboard and click Create Service
  2. Choose Continuously deploy new revisions from a source repository, then click the Set Up With Cloud Build button
  3. Pick your repo from GitHub and click Next
  4. Under Build Type, select the Dockerfile option
  5. Under CPU allocation, pick "CPU is always allocated"
  6. Set minimum and maximum number of instances to 1
  7. Under Authentication, choose "Allow unauthenticated invocations"
  8. Click Container, Variables & Secrets, Connections, Security
  9. Under Variables & Secrets > Environment Variables, add your Live mode API key as INTERVAL_API_KEY. You can get an API key from the dashboard.
  10. Click Create

That's it! Cloud Build will build and deploy your app to Cloud Run. Check the Cloud Build logs for progress and look for your actions to appear in the Actions tab in Interval shortly.

Having issues with any of these steps? Let us know and we'd be happy to help you out.

Did this section clearly explain what you wanted to learn?