๐ Introduction
If you've ever wanted a complete DevOps lab at home, you're in the right place. With just a single bare-metal PC, you can simulate an enterprise-grade infrastructure using Proxmox VE, a few VMs or containers, and some powerful automation tools like Ansible and Jenkins.
In this post, I’ll show you how to build a scalable, flexible lab environment with multiple Linux distros, CI/CD pipelines, cloud integrations, and separate environments for Dev, Staging, and Production.
๐งฑ Hardware and Lab Setup
๐ฅ️ Host Machine Specs
- CPU: Quad-Core Intel
- RAM: 32 GB DDR4
- Storage: 512 GB SSD (you can scale as needed)
- OS: Proxmox VE (latest version)
๐ ️ Step 1: Install Proxmox VE
- Download Proxmox VE ISO:
https://www.proxmox.com/en/downloads - Create bootable USB: Use Balena Etcher or Rufus.
- Install on bare metal: During install, dedicate at least 50% of RAM for VM use.
- Access the web UI:
https://your-proxmox-ip:8006
๐งฑ Step 2: Proxmox Networking & Storage Setup
- Create Linux Bridge (vmbr0) for internet access
- Optional: Add internal-only bridge (vmbr1) for secure intra-VM traffic
- Use ZFS or LVM for better VM snapshot support
๐งช Step 3: Spin Up VMs/CTs (Linux Distributions)
Name | OS | Role | Notes |
---|---|---|---|
mgmt-node | Ubuntu 22 | Ansible, Jenkins | Central Control Host |
web-dev | Ubuntu 22 | Web Dev Env | Runs dev apps via Docker |
web-stage | RHEL 9 | Staging Env | Test builds here |
web-prod | RHEL 9 | Production | Load-balanced, secure |
db-server | Ubuntu 22 | DB Server | PostgreSQL or MySQL |
proxy-lb | Ubuntu 22 | NGINX Load Balancer | SSL + reverse proxy |
You can use cloud-init templates for rapid provisioning.
๐ค Step 4: Automation with Ansible
Install Ansible on mgmt-node
:
sudo apt update && sudo apt install ansible -y
Inventory Example:
[web]
web-dev ansible_host=192.168.1.101
web-stage ansible_host=192.168.1.102
web-prod ansible_host=192.168.1.103
[db]
db-server ansible_host=192.168.1.104
Playbook Example:
- name: Install NGINX on web servers
hosts: web
become: yes
tasks:
- name: Install NGINX
apt:
name: nginx
state: present
Run It:
ansible-playbook install-nginx.yml
Install Jenkins on mgmt-node
:
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | \
sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | \
sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt update
sudo apt install jenkins -y
Access Jenkins UI:
http://mgmt-node-ip:8080
Create Pipelines:
- Build app
- Run tests
- Push Docker image to private registry
- Deploy using Ansible
๐ณ Step 6: Containerize Your App
Dockerfile Example (Node.js):
FROM node:18
WORKDIR /app
COPY . .
RUN npm install
CMD ["npm", "start"]
Push to Docker Registry (or set up your own on Proxmox)
☁️ Optional: Cloud Integration
- Use Terraform to spin up AWS EC2 or Azure VMs
- Use Ansible to provision and configure
- Set up Jenkins to deploy app from Proxmox to AWS staging or prod
๐ Step 7: Load Balancing with NGINX
upstream webapp {
server 192.168.1.101;
server 192.168.1.102;
}
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://webapp;
proxy_set_header Host $host;
}
}
Add SSL with Let's Encrypt using Certbot.
๐ Environments: Dev, Staging, Prod
- Dev (
web-dev
): Auto-deploy on Git push (CI only) - Staging (
web-stage
): Deploy on merge tomain
branch - Prod (
web-prod
): Manual approval + Ansible deploy
๐ Step 8: Monitoring and Logging (Bonus)
- Use Prometheus + Grafana on another container
- Install Node Exporter on each VM
- Use Loki + Grafana for central logging
✅ Final Thoughts
With just a single Proxmox host, you’ve now built:
- A full CI/CD pipeline
- Multi-tier Linux infrastructure
- Cloud-compatible deployment pipeline
- Load balancing, monitoring, and staging workflows
You’re ready to take on real-world DevOps challenges — all from your homelab.
๐ฌ Questions?
Drop your comments or suggestions below. I'd love to hear how you’re building your own lab!
Comments
Post a Comment
Unprofessional comments will be reported.