How priyanshunegi-work/cloud-run-assignment works
Project type and purpose
• This is a containerized Python Flask web service, deployed in a serverless fashion on Google Cloud Run.
• Its purpose is to demonstrate containerization, cloud‐native deployment, and simple system health checks via a Bash script.
File structure
• Top‐level artifacts:
• README.md – overview and deployment instructions
• sys_check.sh – standalone health‐check script (disk usage, login history)
• deploy_app/ folder:
• main.py – Flask application entry point
• requirements.txt – Python dependencies (Flask, Gunicorn)
• Dockerfile – instructions to build the container image
• log.txt – placeholder or sample application log file
Extract key architectural hints from the README
• Containerization with Docker
• Image storage in Google Artifact Registry
• Deployment to Cloud Run (fully managed, serverless)
• Uses gcloud CLI for deployment
Main components & their roles
a. Developer workstation / CI pipeline
• Holds the source code (deploy_app/ + sys_check.sh) and Dockerfile
• Triggers a Docker build (either locally or via Cloud Build)
b. Container image
• Built from deploy_app/Dockerfile, includes Flask app + Gunicorn
c. Artifact Registry (us-central1-docker.pkg.dev)
• Stores the built container image
d. Google Cloud Run
• Pulls the image from Artifact Registry
• Runs containers on demand, scales automatically
• Exposes an HTTPS endpoint to clients
e. Clients
• Web browsers or API clients consuming the Flask service
f. Health‐check script (sys_check.sh)
• External monitoring tool, can run on a VM or local cron
• Checks disk usage, login history—reports or logs results
Relationships & data flows
• Code → Docker build → Image pushed → Artifact Registry
• Artifact Registry → Cloud Run deployment → Running service
• Client HTTP(S) requests → Cloud Run → Container (Flask + Gunicorn) → Response
• sys_check.sh → (optionally) invokes Cloud Run endpoint or queries VM to perform health checks
Architectural patterns & design principles
• Serverless microservice (single‐purpose container)
• Separation of concerns: build pipeline vs. runtime
• Immutable infrastructure: containers are rebuilt & redeployed
• Infrastructure as code: Dockerfile + gcloud CLI commands
Relevant technologies & frameworks
• Python 3.x, Flask, Gunicorn
• Docker
• Google Cloud Build (optional), Artifact Registry
• Google Cloud Run (fully managed)
• Bash (sys_check.sh)