A lightweight Platform-as-a-Service (PaaS) that automatically deploys applications from GitHub repositories using Docker and Kubernetes (K3s).
Users submit a GitHub repository, and the platform automatically:
-
Clones the repository
-
Builds a Docker image
-
Pushes the image to Docker Hub
-
Deploys the container to Kubernetes
-
Exposes the application publicly
This project demonstrates DevOps, container orchestration, and platform engineering concepts.
Anantha Sridhar
DevOps β’ Platform Engineering β’ Cloud Infrastructure
Before setting up the platform, ensure you have:
- AWS account
- Docker Hub account
- A purchased domain
- SSH client
- Git installed
Basic knowledge of:
- Docker
- Kubernetes
- Linux commands
User
β
β Submit GitHub Repo
βΌ
FastAPI Deployment API
β
βΌ
GitHub Repository
β
βΌ
Docker Build
β
βΌ
Docker Hub Registry
β
βΌ
Kubernetes (K3s)
β
βΌ
Traefik Ingress
β
βΌ
Public URL
| Component | Usage |
|---|---|
| FastAPI | Backend deployment API |
| Docker | Containerization |
| Docker Hub | Image registry |
| Kubernetes (K3s) | Container orchestration |
| Traefik | Ingress controller |
| AWS EC2 | Infrastructure |
-
Before deploying the platform, you must update the configuration variables in the code.
-
Open the configuration file (usually in the backend where deployments are handled) and replace the placeholder values:
DOCKER_USERNAME = "DOCKER_USERNAME"
DOMAIN = "YOUR_DOMAIN"
DOCKER_REPO = "YOUR_DOCKER_HUB_REPO" Example:
DOCKER_USERNAME = "Anantha Sridhar"
DOMAIN = "deploywithanantha.xyz"
DOCKER_REPO = "mini-platform"These values are required for the platform to correctly build, push, and expose deployed applications.
1οΈβ£ Create a Docker Hub Repository
Go to:
https://hub.docker.comCreate a new repository.
Example:
Repository Name: mini-platform-imagesWhy this is required:
- Kubernetes does not build images.
- It pulls images from a container registry.
Without a Docker repository, Kubernetes cannot deploy the application containers.
2οΈβ£ Buy a Domain
You must purchase a domain for exposing deployed applications.
Recommended providers:
Namecheap
Cloudflare
Google Domains
Example domain:
deploywithanantha.xyzThis domain will be used to route traffic to applications deployed in Kubernetes.
3οΈβ£ Configure DNS
Add an A record pointing to your Elastic IP.
Example:
| Type | Name | Value |
|---|---|---|
| A | @ | EC2 Elastic IP |
Example result:
deploywithanantha.xyz β 54.xx.xx.xxGo to AWS Console β EC2 β Launch Instance
Configuration:
| Setting | Value |
|---|---|
| OS | Ubuntu 22.04 |
| Instance Type | t2.micro / t3.micro |
| Storage | 20GB |
| Key Pair | Create .pem key |
Download the key file.
Example:
Demo_Docker.pemAdd the following inbound rules.
| Type | Port |
|---|---|
| SSH | 22 |
| HTTP | 80 |
| HTTPS | 443 |
| Custom TCP | 8000 |
Why these ports?
| Port | Purpose |
|---|---|
| 22 | SSH access |
| 80 | HTTP traffic |
| 443 | HTTPS |
| 8000 | FastAPI server |
AWS public IPs change when the instance restarts.
-
Elastic IP ensures:
-
Stable domain mapping
-
Stable HTTPS certificates
-
Permanent public endpoint
Go to:
EC2 β Elastic IPs β AllocateThen associate it with your instance.
ssh -i "<your_pem_file.pem>" ubuntu@<elastic-ip>Example:
ssh -i "<your_pem_file.pem>" ubuntu@54.210.xx.xxsudo apt update
sudo apt install docker.io -y
sudo systemctl enable docker
sudo systemctl start docker
sudo usermod -aG docker ubuntu
logoutdocker psK3s is a lightweight Kubernetes distribution.
Install it:
curl -sfL https://get.k3s.io | sh -Check installation:
sudo kubectl get nodesExpected output:
Ready control-planeCopy kubeconfig to your user.
sudo mkdir -p ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown ubuntu:ubuntu ~/.kube/configSet environment variable:
export KUBECONFIG=/home/ubuntu/.kube/configVerify:
kubectl get nodessudo apt install python3 python3-pip python3-venv -yClone the project.
git clone https://github.com/YOUR_USERNAME/mini_deployment_platform
cd mini_deployment_platformCreate virtual environment.
python3 -m venv env
source env/bin/activateInstall dependencies.
pip install -r requirements.Login to Docker Hub.
docker loginWhy is a Docker registry needed?
- Kubernetes does not build images.
- It only pulls images from registries.
Deployment flow:
Code β Docker Build β Docker Hub β Kubernetes pulls imageWithout a registry Kubernetes cannot deploy containers.
Start the backend.
uvicorn app.main:app --host 0.0.0.0 --port 8000Access the API documentation.
http://<elastic-ip>:8000/
If Kubernetes commands fail because of config issues:
export KUBECONFIG=/home/ubuntu/.kube/configTraefik can automatically generate HTTPS certificates using Let's Encrypt.
Applications must contain a Dockerfile.
Example structure:
my-app
β
βββ Dockerfile
βββ requirements.txt
βββ main.py
β
βββ app
β βββ main.py
β
βββ README.md
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["uvicorn","main:app","--host","0.0.0.0","--port","8000"]
Applications must:
-
Include a Dockerfile
-
Expose port 8000
-
Bind to 0.0.0.0
Example:
uvicorn main:app --host 0.0.0.0 --port 8000When a user submits a repository:
POST /deployExample request:
{
"github_url": "https://github.com/user/app"
}Internal process:
1. Clone repository
2. Build Docker image
3. Push image to Docker Hub
4. Generate Kubernetes YAML
5. Deploy container
6. Create service
7. Expose application
No Server Available Error
Sometimes old deployments consume resources.
Delete previous deployments.
kubectl get deploymentsThen remove unused apps.
kubectl delete deployment <deployment-name>Example:
kubectl delete deployment testappRun:
export KUBECONFIG=/home/ubuntu/.kube/configFix permissions.
sudo usermod -aG docker ubuntuThen reconnect to the server.
Run:
ssh-keygen -R <ec2-host>-
Dynamic subdomains for deployed apps
-
GitHub webhook auto-deploy
-
Horizontal Pod Autoscaling
-
Multi-node Kubernetes cluster
-
Deployment Dashboard
-
Auto-detect project type
