Skip to content

Production-ready cloud infrastructure management platform with FastAPI, Streamlit, and GCP integration. Features real-time instance monitoring, automated notifications, and containerized deployment.

License

Notifications You must be signed in to change notification settings

hemhemoh/gcp-vm-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Google Cloud Server Manager

A production-ready full-stack cloud infrastructure management platform built with FastAPI, Streamlit, and Google Cloud Platform APIs.

Python FastAPI Docker GCP

🎯 Project Overview

An enterprise-grade web application that provides centralized management of Google Cloud Compute Engine instances with real-time monitoring, automated notifications, and comprehensive audit logging. Features a modern REST API backend with an intuitive web interface for non-technical stakeholders.

Live Demo: https://app.hemhemoh.com/

πŸ› οΈ Technology Stack

Backend Architecture

  • FastAPI - High-performance async API framework with automatic OpenAPI documentation
  • SQLModel - Type-safe database ORM with Pydantic integration
  • SQLite - Embedded database with ACID compliance
  • Google Cloud SDK - Native GCP API integration for compute resource management
  • Background Tasks - Asynchronous operation monitoring and retry mechanisms
  • SMTP Integration - Automated email notification system

Frontend & DevOps

  • Streamlit - Interactive web interface with real-time updates
  • Docker & Docker Compose - Containerized microservices architecture
  • RESTful API Design - Clean separation of concerns with proper HTTP semantics
  • Session Management - Secure credential handling without persistent storage

Cloud & Infrastructure

  • Google Cloud Platform - Compute Engine API integration
  • Service Account Authentication - Secure GCP resource access
  • Multi-zone Support - Cross-regional instance management
  • Error Handling - Comprehensive exception management with user-friendly messages

⚑ Key Features

  • πŸš€ Instance Lifecycle Management - Start, stop, and monitor GCP instances across multiple zones
  • πŸ“Š Real-time Dashboard - Live status updates with automatic refresh capabilities
  • πŸ”” Smart Notifications - Email alerts for operation success/failure with retry logic
  • πŸ—„οΈ Audit Trail - Complete operation logging with parent-child job relationships
  • πŸ” Secure Authentication - Dynamic service account key upload with session-based security
  • 🐳 Production Ready - Fully containerized with Docker Compose orchestration
  • πŸ“± Responsive UI - Modern web interface optimized for various screen sizes
  • ⚑ Async Processing - Non-blocking background task execution

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    HTTP/REST     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Streamlit     β”‚ ◄──────────────► β”‚    FastAPI      β”‚
β”‚   Frontend      β”‚                  β”‚    Backend      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                              β”‚
                                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   SQLite DB     β”‚                  β”‚  Google Cloud   β”‚
β”‚   (Audit Log)   β”‚                  β”‚   Compute API   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites: Docker, Docker Compose, GCP Account with Compute Engine enabled

# Clone and deploy
git clone https://github.com/hemhemoh/gcp-vm-control
cd gcp-vm-control

# Configure email notifications
echo "SENDER=your-email@gmail.com" > .env
echo "PASSWORD=your-app-password" >> .env

# Launch application stack
docker-compose up --build -d

# Access applications locally
# Frontend: http://localhost:8501
# API Docs: http://localhost:9001/docs

πŸ“‹ API Documentation

Core Endpoints

Method Endpoint Description
POST /load_config Upload service account credentials
GET /list-server Retrieve all instances across zones
POST /start-server Initialize instance startup sequence
POST /end-server Execute instance shutdown procedure
GET /server-status Query specific instance state

Auto-generated API documentation available at /docs

πŸ—ƒοΈ Data Models

Database Schema

# Parent-Child Job Tracking
ParentJob {
    id: int (PK)
    name: str (indexed)
    zone: str (indexed) 
    status: OperationStatus (indexed)
    type: OperationType (indexed)
    is_successful: bool (indexed)
}

ChildJob {
    id: int (PK)
    parent_id: int (FK)
    is_successful: bool
    request_time: datetime
    start_time: datetime
    end_time: datetime
}

πŸ§ͺ Development Workflow

# Local development setup
python -m venv venv
source venv/bin/activate
pip install -r backend/requirements.txt

# Run backend with hot reload
uvicorn api.main:app --reload --host 0.0.0.0 --port 9001

# Run frontend with auto-refresh
streamlit run frontend/app.py --server.port 8501

This project demonstrates proficiency in modern Python web development, cloud platform integration, containerized deployment, and production-ready software architecture.

About

Production-ready cloud infrastructure management platform with FastAPI, Streamlit, and GCP integration. Features real-time instance monitoring, automated notifications, and containerized deployment.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •