pubnatsv2
v1.1.1
Published
## Project Overview
Readme
PubNATS v2 Project
Project Overview
PubNATS v2 is a microservice-based API gateway that acts as a bridge between client applications and different messaging systems, primarily focusing on Google Cloud Pub/Sub. The application is designed to handle message publishing and gate control operations.
Core Features
- Message Publishing: Publishes messages to Google Cloud Pub/Sub topics
- Supports two message types: PBF and GCP
- Includes authentication via token validation
- Gate Control: Remotely operates physical gates via SSH
- Supports multiple gate configurations
- Executes remote scripts on gate control machines
Technical Architecture
Backend
- Framework: FastAPI
- Runtime: Python 3.13
- Messaging: Google Cloud Pub/Sub
- Authentication: Token-based authentication
- Remote Access: SSH via Paramiko
Deployment
- Containerization: Docker
- Orchestration: Kubernetes on GKE
- CI/CD: Google Cloud Build
- Cloud Provider: Google Cloud Platform
API Endpoints
- GET / - Root endpoint returning a status message
- POST /publish/pbf - Publishes PBF-formatted messages to Pub/Sub
- POST /publish/gcp - Publishes GCP-formatted messages to Pub/Sub
- POST /gate - Controls physical gates via SSH connections
Configuration
The application is configured using environment variables:
- GCP project and topic settings
- Authentication tokens
- SSH access credentials
- Gate machine configurations
Deployment
The application is deployed as a Kubernetes service on Google Kubernetes Engine with:
- Automatic container builds via Cloud Build
- Secrets management for sensitive information
- Readiness probes for health checks
- Anti-affinity rules for high availability
Development
To run the application locally:
- Install dependencies:
pip install -r requirements.txt - Set required environment variables
- Run the application:
python run.py
The application will be available at http://localhost:8080
