DEV Community

Caleb Duff
Caleb Duff

Posted on

Deploying Microservices on Google Cloud with Antigravity

If you’ve watched an AI coding agent build a single app in minutes, the next question is obvious: can it handle six services, two runtimes and a delivery pipeline, without turning your cloud project into a mess?

That’s what I set out to answer in my session at DevFest Port Harcourt 2026. In this post I’ll walk you through it step by step: we’ll design a small online shop called CloudMart, build it as microservices with Google Antigravity, deploy most of it to GKE, put one service on Cloud Run, and wire up CI/CD.

What you’ll learn

  • How to split an app into services by business capability, with each service owning its data.
  • How to describe a system to Antigravity so it plans before it codes.
  • How to build, test and deploy five services to GKE Autopilot.
  • How to run an event-driven service on Cloud Run with Pub/Sub, using the Cloud Run MCP server.
  • How to generate a Cloud Build pipeline without hardcoded paths or project IDs.
  • Which guardrails keep a fast agent from being wrong fast.

Prerequisites

  • A Google Cloud project with billing enabled
  • Google Antigravity installed and signed in
  • The gcloud CLI, installed and authenticated
  • Docker, Node.js 20 and a GitHub account

Note: Use a dedicated project for this. GKE costs money while it runs, so set a budget alert and delete everything when you’re done.

Companion links: [YouTube demo coming soon] · CloudMart repository · Google’s reference app, Online Boutique

1. The Architecture: What We’re Building

CloudMart is a small online shop. You browse products, add them to a cart and check out. When an order goes through, the customer gets a notification.

It’s split into a frontend plus five backend services, each matching something the business actually does:

Service Job Runs on
Frontend The storefront customers see GKE
Product Catalogue and prices GKE
Cart Items a customer has picked GKE
Order Checkout: reads the cart, takes payment, records the order GKE
Payment Approves or declines a payment (mocked) GKE
Notification Sends the order confirmation Cloud Run

Here’s how a request flows:

Customer → Frontend → Ingress / API gateway
                         ├→ Product
                         ├→ Cart
                         └→ Order → Payment
                                  └→ Pub/Sub (order.placed) → Notification on Cloud Run
Enter fullscreen mode Exit fullscreen mode

CloudMart architecture

Two rules shaped this design:

  1. Split by business capability, not by code layer. Product, Cart and Order are things a customer does. “Database layer” or “utils” are not services. A quick test: if two services always have to be deployed together, they’re really one service.
  2. Each service owns its data. Order never reads Product’s data directly. It asks through Product’s API, or listens for events. That’s what lets you change and deploy each one on its own.

Why two runtimes? GKE is the right home for services that talk to each other all the time. Notification only wakes up when an order comes in, so it lives on Cloud Run, which scales to zero and costs nothing while idle. Same container image format, different home.

Note: To keep the demo cheap and simple, data lives in memory or JSON files, and Payment is a mock that declines anything over ₦1,000,000. Swapping in real databases changes nothing about how the services are deployed.

Two Ways to Get CloudMart Running

You can follow this post in one of two ways:

  • Option A: Build it with the agent. Start from an empty folder and generate every service with Antigravity. This is the full journey, covered in sections 2 and 3.
  • Option B: Clone the finished repo. Start from the CloudMart code I generated for the session and go straight to testing and deploying. Use the prompts below, then jump to section 4.

Option B: Clone the repository

git clone https://github.com/Duffigoogle/cloudmart.git
cd cloudmart
Enter fullscreen mode Exit fullscreen mode

Open the cloudmart folder in Antigravity. If you also want Google’s larger reference app to compare with, clone it alongside:

git clone https://github.com/GoogleCloudPlatform/microservices-demo.git
Enter fullscreen mode Exit fullscreen mode

The repo already contains the six services, their tests, a docker-compose.yml, the Kubernetes files in k8s/, a cloudbuild.yaml, and two ways to create the cloud resources: scripts/setup-gcp.sh or Terraform in terraform/.

Phase 1: Run the unit tests

Run the unit tests across all six CloudMart microservices (product, cart, payment, order, notification, and frontend). Show me the test summary for each service and fix any test that fails.
Enter fullscreen mode Exit fullscreen mode

Summary of all tests

Results of all unit tests

Phase 2: Run the whole shop locally

With Node.js only, no Docker needed:

Start all six CloudMart services locally using npm start so they run in the background on ports 8080–8085. Open http://localhost:8080 in the browser, click a product to view its single-product page, add two items to the cart, verify the Port Harcourt shipping address and ₦7,500 shipping cost on the Cart page, place the order, confirm the "Your order is complete!" view appears, and show me the notification service log line.
Enter fullscreen mode Exit fullscreen mode

All six (6) CloudMart Services started

End-to-End Storefront Verification Summary

Or with containers, if you want to test the Docker images first:

Build and start all six CloudMart microservices using docker compose up -d --build. Verify that all six /healthz endpoints on ports 8080–8085 return 200 OK, place a test order through the frontend at http://localhost:8080, and show me the notification container log line.]
Enter fullscreen mode Exit fullscreen mode

Built Images on Docker Desktop
Health Endpoint Verification /healthz and running ports

Containerized /healthz verification endpoints

Testing CloudMart Locally

Notification container log on Docker

Then try the failure case, because a demo that only shows the happy path isn’t telling the whole story:

On the running storefront at http://localhost:8080, add items totaling more than ₦1,000,000 to the cart and attempt to place an order. Verify that the payment service returns "declined", the Cart page displays the "Payment declined" error banner, and no order.placed notification is sent.
Enter fullscreen mode Exit fullscreen mode

Phase 3: Deploy to Google Cloud

Replace <YOUR_PROJECT_ID> with your project ID in each prompt.

3A. Create the cloud foundation

Using GCP project <YOUR_PROJECT_ID>, region europe-west1, Artifact Registry repo cloudmart-docker-repo, and GKE Autopilot cluster cloudmart-cluster: run scripts/setup-gcp.sh (or terraform apply in terraform/) to enable the required APIs, create the Artifact Registry repository, create the Pub/Sub topic, create the least-privilege GKE workload and Cloud Build service accounts, and provision the GKE Autopilot cluster.
Enter fullscreen mode Exit fullscreen mode

Enabling Cloud Resources APIs

Fixed the billing account issues by connecting to a credited billing account.

All 17 Google Cloud resources provisioned in the project

Terraform Outputs

Provisioned GCP Resources Summary

3B. Build and push all six images

With Cloud Build:

Using GCP project <YOUR_PROJECT_ID> and region europe-west1, run Google Cloud Build with cloudbuild.yaml (using the cloudmart-cloudbuild service account) to build all six CloudMart Dockerfiles in parallel and push the v1.0.0 images to europe-west1-docker.pkg.dev/<YOUR_PROJECT_ID>/cloudmart-docker-repo. Verify all six images are listed in Artifact Registry.
Enter fullscreen mode Exit fullscreen mode

Cloud Build Job Summary

Or with Docker on your machine:

Authenticate Docker with europe-west1-docker.pkg.dev, build the production Docker images for frontend, product, cart, order, payment, and notification with tag v1.0.0, and push all six images to europe-west1-docker.pkg.dev/<YOUR_PROJECT_ID>/cloudmart-docker-repo.
Enter fullscreen mode Exit fullscreen mode

Verified Images in Artifact Registry

3C. Put Notification on Cloud Run and connect Pub/Sub

Deploy the notification service image from europe-west1-docker.pkg.dev/<YOUR_PROJECT_ID>/cloudmart-docker-repo/notification:v1.0.0 to Cloud Run in europe-west1 on port 8085 allowing unauthenticated requests. Ensure the order.placed Pub/Sub topic exists, grant roles/pubsub.publisher on order.placed to cloudmart-gke-workload@<YOUR_PROJECT_ID>.iam.gserviceaccount.com, and create a Pub/Sub push subscription pointing to the Cloud Run service's /pubsub endpoint.
Enter fullscreen mode Exit fullscreen mode

Notification Service is now deployed on Google Cloud Run

Cloud Run Deployment Summary

Note: Allowing unauthenticated requests keeps the demo simple, but it means anyone with the URL can call /pubsub. Beyond a demo, keep the service private and give the push subscription a service account with the Cloud Run Invoker role (section 5 shows the prompt).

3D. Deploy the five core services to GKE

Update k8s/kustomization.yaml and k8s/order.yaml with project <YOUR_PROJECT_ID>, region europe-west1, repository cloudmart-docker-repo, tag v1.0.0, and the cloudmart-gke-workload@<YOUR_PROJECT_ID>.iam.gserviceaccount.com Workload Identity annotation (keeping PUBSUB_TOPIC=order.placed). Validate with kubectl apply -k k8s/ --dry-run=client, deploy to cloudmart-cluster with kubectl apply -k k8s/, wait for all pods in the cloudmart namespace to be Ready, and give me the external LoadBalancer IP for the frontend service.
Enter fullscreen mode Exit fullscreen mode

All five(5) CloudMart services (frontend, product, cart, order and payment are now deployed and running on GKE Autopilot cluster)

GKE Autopilot Pods & Services

All five(5) services with their Cluster IP, Ports, Type, etc.

3E. Check it works end to end

Open the GKE frontend LoadBalancer URL, place an order on CloudMart, and fetch the Cloud Run logs for the notification service in europe-west1 to confirm it received the order.placed Pub/Sub push message and logged the Naira confirmation line.
Enter fullscreen mode Exit fullscreen mode

CloudMart Running live on Google Cloud

That’s CloudMart live on Google Cloud. Option B readers can now skip to section 4 to verify it in the console, then section 6 for CI/CD and hardening.

4. Verify It Yourself

When the agent finishes, it gives you a walkthrough of what it did. Read it, then check for yourself. My rule: trust, but verify.

[Screenshot: walkthrough artifact]

Open the storefront’s external IP, add a couple of products and check out.

[Screenshot: CloudMart storefront on GKE]

Then take a quick tour of the console:

  • Artifact Registry: five images, each tagged with the git commit

Five (5) Images in the Artifact Registry

  • GKE Cluster: cloudmart-cluster

GKE deployed cloudmart cluster

  • GKE → Workloads: five deployments in the cloudmart namespace, all green

GKE Deployments in the cloudmart namespace

  • GKE → Services: one external LoadBalancer for the frontend, internal services for the rest

GKE deployed services with their TYPE, ENDPOINTS, PODS

  • Pub/Sub: the order.placed topic and subscription, ready for the next step

Pub/Sub topic

Pub/Sub subscription

5. Put Notification on Cloud Run

This was my favourite moment of the session. The notification service doesn’t need a cluster: it sits idle until an order comes in. That makes it a perfect fit for Cloud Run.

Deploy the notification service to Cloud Run, subscribe it to the order.placed Pub/Sub topic, then place a test order and show me the log.
Enter fullscreen mode Exit fullscreen mode

If the agent tries to make the service public, push back:

Keep it private: deploy with no unauthenticated access, and use a push subscription with a service account that has the Cloud Run Invoker role.
Enter fullscreen mode Exit fullscreen mode

[deployed Cloud Run service]

Place an order in the storefront, then open the Cloud Run logs:

Adding items to cart

Displaying Cart items

Placing Order & Checking Out

Payment & Order Completed

Order placed, event sent, notification sent, in about a minute. Same container image format, a different home, and it costs nothing while nobody is ordering.

6. Automate It, and What Production-Ready Really Takes

Step A: Wire up CI/CD

The last prompt asks the agent to write the pipeline:

Write a cloudbuild.yaml that tests and builds each changed service, pushes to Artifact Registry and rolls out to GKE, with notification going to Cloud Run. No hardcoded IDs.
Enter fullscreen mode Exit fullscreen mode

[Screenshot: generated cloudbuild.yaml and a build running]

Check three things in what it generates: tests run before the build, the project and region come from Cloud Build substitutions, and images go to Artifact Registry (Container Registry is retired).

Step B: Be honest about production

CloudMart runs on production-grade infrastructure, but it is not a production-ready system yet. Here’s what I’d add before real customers use it:

  1. Real databases, one per service (for example Cloud SQL for orders, Memorystore for carts)
  2. A real payment provider, with keys kept in Secret Manager, never in code or prompts
  3. A dead-letter topic for notifications that fail, so no order event is lost
  4. Workload Identity and authentication between services, so only Order can call Payment

The same loop works for hardening: describe it, review the plan, verify the result.

Add a dead-letter topic for the notification push subscription, retry failed messages up to 5 times, and alert me when anything lands in the dead-letter topic. Show me the plan first.
Enter fullscreen mode Exit fullscreen mode

The guardrails I used throughout

  • Read the plan before anything runs. Comment on it like a pull request.
  • Keep command approval on. Never let the agent auto-run anything that deletes something or touches production.
  • Least privilege. Separate service accounts with only the roles they need; never Owner or Editor.
  • Branch, commit, budget alert. Git is your undo button, and a budget alert is your smoke alarm.

Wrapping Up

We went from an empty folder to six services on two runtimes, with events flowing through Pub/Sub and a pipeline that rebuilds everything on each push. Antigravity wrote most of the code and ran most of the commands.

But the prompts were the smallest part of the work. The real work was deciding where to split the services, who owns which data, what runs on GKE versus Cloud Run, and reading every plan before saying yes.

AI can do the plumbing. Engineering judgement is still your job.

Want to try it? Clone CloudMart, follow the prompts above, and when you’re done, delete your cluster, because an idle cluster quietly eats your free credits. If you want to go deeper, study Google’s Online Boutique: 11 services in five languages.

Which service would you move to Cloud Run next? Tell me in the comments.

Resources


I’m Caleb Duff, a GDG Cloud Organizer and community manager for AI in Nigeria. I make videos about tech, cloud and AI as Techie From The Future on YouTube. Connect with me on LinkedIn and X.

Top comments (0)