pubsub-client-rust

Crates.iopubsub-client-rust
lib.rspubsub-client-rust
version0.2.0
created_at2025-11-04 20:17:36.635959+00
updated_at2025-12-07 00:14:00.767981+00
descriptionMinimal Rust pubsub client call to Google Cloud
homepage
repositoryhttps://github.com/xbill9/gemini-cli-codeassist
max_upload_size
id1916893
size84,303
xbill (xbill9)

documentation

README

Google Cloud Pubsub Rust Client Example

This project is an example of how to use the Google Cloud Pub/Sub client in a Rust application.

Project Overview

pubsub-client-rust is a sample application that demonstrates how to interact with Google Cloud Pub/Sub from a Rust application. It is designed to be deployed as a containerized application on Google Cloud Run.

Key Technologies

Getting Started

This project uses a Makefile to simplify common development tasks.

Prerequisites

Initial Setup

  1. Install Dependencies:

    cargo build
    
  2. Run the application locally:

    make run
    

    The server will start on port 8080.

Development Workflow

The Makefile provides targets for common development tasks.

Building the Project

  • Development Build:
    make build
    
  • Release Build:
    make release
    

Running Locally

make run

Code Quality

  • Formatting:
    make format
    
  • Linting:
    make clippy
    

Testing

make test

Deployment

Deployment is handled by Google Cloud Build and defined in cloudbuild.yaml.

Manual Deployment

To manually trigger a deployment, run:

make deploy

This command submits a build to Google Cloud Build, which will:

  1. Build the Docker image (as defined in Dockerfile).
  2. Push the image to Google Container Registry (GCR).
  3. Deploy the new image to the cloudrun-rust service in the us-central1 region.

Deployment Process

  • Dockerfile: A multi-stage Dockerfile is used to create a minimal, secure production image.
    1. Builder Stage: The Rust code is compiled in a rust builder image.
    2. Final Stage: The compiled binary is copied to a minimal gcr.io/distroless/cc-debian12 image.
  • cloudbuild.yaml: This file defines the Cloud Build pipeline. It takes care of building, pushing, and deploying the container image.
Commit count: 0

cargo fmt