[Release] Meteor on Cloud Run - Deploy your Meteor app to Google Cloud Run (Scale to Zero, Rolling Deploys & More!)

Meteor on Cloud Run - Deploy Meteor Apps to Google Cloud Run

Hi all, I’ve built a CLI tool that automates deploying Meteor.js applications to Google Cloud Run with zero-downtime deployments and automatic scaling.

Key Features

  • Autoscaling & Pay-per-use - Scales to zero when idle, scales up automatically under load
  • Zero-downtime deployments - Rolling updates with automatic traffic migration
  • Automatic SSL/HTTPS - Free SSL certificates for custom domains
  • Secrets management - Secure handling via Google Secret Manager
  • CI/CD ready - GitHub Actions integration with Workload Identity Federation
  • Settings.json support - Automatic processing of Meteor settings (Galaxy format compatible)

Why Cloud Run?

  • Pay only for actual requests (not idle time) by scaling to zero!
  • Global CDN and edge caching included
  • Generous free tier (2M requests/month)
  • Fast cold starts with containerization
  • No server management required

Quickstart

(gcloud cli needs to be installed)

# Install
npm install -g meteor-cloud-run

# In your Meteor app directory
meteor-cloud-run init   # Interactive setup
meteor-cloud-run deploy # Deploy to Cloud Run

# Your app is live at *.run.app!

You can check out the code here:

Feedback and contributions welcome :slight_smile:

Glad to be building on Meteor!

7 Likes

Hi @sussition , It looks amazing !
What kind of response time do you observe after scaling to zero ? Is it acceptable for real users and use cases ?
Thanks

It depends on how heavy your app is. From what I’ve seen, a cold start scaling from 0 containers can be between 5 to 30 seconds (anecdotal!)

1 Like

How fast is the first render when it was idle? Meteor bundle is not small, I guess it will take time to load.

5+ seconds waiting is too long for normal users.

Agreed for high traffic applications - it depends on your use case, you can always set minimum instance to 1 so it never cold starts :slight_smile:

I’m using Google Cloud Run, but not for Meteor app, they are functions to work with the Meteor app.
I haven’t tested with Meteor app, but how much CPU does a Meteor app use? I think you will hit another problem when it scales to so many instances. Too many connections to the database, it can be worse if you use oplog scanning.

It’s possible to run a Meteor app (which supports server-less design) with Google Cloud Run but for the app with some traffic, I think it’s better to deploy on Galaxy, docker, vps or real server.

Oplog tailing becomes an issue at scale regardless of where you host it, just swap to redis-oplog once you get to that scale and reduce subscription usage. But there are solutions you can adopt with Cloud Run like max instance counts and connection pooling for later when you reach those capacity limits.

Under the hood, this library wraps your Meteor app in a Docker container anyways (https://hub.docker.com/r/geoffreybooth/meteor-base)

It’s a good problem to have though, it means the app is getting used :laughing:

You’re right, but I mean if you run your app on cloud run vs a VPS for example, You may need 10 instances of could run but 5 or less number of VPS.

1 Like

I’m curious about this. If I run Cloud Run with minimum instances at 5 and max instances at 5 (i.e. no autoscaling), won’t the performance be the same as running 5 equivalent continuous instances on a VPS? I couldn’t find anything that would indicate performance differs, except that Cloud Run would automatically queue requests at peak load (as opposed to VPS infra requiring its own load balancer).

Do you know the cost difference of this scenario, i.e., Cloud Run vs VPS?

I don’t run the entire Meteor app in cloud run, just a function with some NPM libraries:

    "@apollo/client": "^3.12.9",
    "@google-cloud/functions-framework": "^3.4.5",
    "cross-fetch": "^4.1.0",
    "debug": "^4.4.0"

But I saw the container instances increase very quickly:

Could be very different, if you run some tasks which don’t need to stay there, cloud function is very cheap (could be free). But VPS, you need to keep it alive, and it’s expensive even with auto scalling.

But as I said, you will hit a problem when it creates too many instances.

I was asking about that scenario mentioned about running Cloud Run indefinitely, as if it were a VPS.

If you want to run it indefinitely like a VPS, Cloud Run should be more expensive (albeit you don’t need to actually manage the servers yourself)

1 Like

I don’t have the answer. But this price calculator will give you an idea:

1 Like