Rails Application - Complete DevOps Pipeline
A comprehensive Ruby on Rails application demonstrating modern DevOps practices with Docker containerization, Kubernetes orchestration, ArgoCD GitOps deployment, and Tekton CI/CD pipelines.
This project showcases a full DevOps workflow for a Rails application with PostgreSQL database, featuring:
Containerization : Docker multi-stage builds with separate app and database containers
Orchestration : Kubernetes deployment with StatefulSet for PostgreSQL
GitOps : ArgoCD for declarative continuous deployment
CI/CD : Tekton pipelines for automated build and push workflows
Ingress : NGINX ingress controller for traffic management
Tool
Version
Purpose
Docker
20.10+
Container runtime
Docker Compose
2.0+
Multi-container orchestration
Kubernetes
1.20+
Container orchestration
Minikube
1.25+
Local Kubernetes cluster
kubectl
1.20+
Kubernetes CLI
ArgoCD
2.5+
GitOps deployment
Tekton
0.40+
CI/CD pipelines
# Clone the repository
git clone https://github.com/srikxcipher/rails_app.git
cd rails_app
# Docker deployment
docker pull srikant25/railsapp:latest
docker-compose up
# Kubernetes deployment
chmod +x k8s-scripts/* .sh
./k8s-scripts/get-all-up.sh
Rails Application : Multi-stage Dockerfile with Ruby 3.2 and Rails 7
PostgreSQL Database : Official PostgreSQL 15 image with custom initialization
Networking : Docker Compose bridge network for service communication
# Ensure Docker daemon is running
sudo systemctl start docker
# Pull pre-built image
docker pull srikant25/railsapp:latest
# Start the application stack
docker-compose up -d
# View application
# Navigate to http://localhost:3000
├── Dockerfile # Multi-stage Rails application build
├── docker-compose.yaml # Multi-container orchestration
├── init.sql # PostgreSQL initialization script
└── bin/docker-entrypoint # Container entry point script
Namespace : rails-app for resource isolation
PostgreSQL : StatefulSet with persistent volume claims
Rails App : Deployment with rolling update strategy
Services : ClusterIP for internal communication, NodePort for external access
Ingress : NGINX controller for HTTP routing
Set permissions and execute deployment scripts:
# Set execution permissions
chmod +x k8s-scripts/* .sh
# Automated deployment sequence
./k8s-scripts/01-start-minikube.sh # Initialize Minikube cluster
./k8s-scripts/02-create-namespace.sh # Create rails-app namespace
./k8s-scripts/03-deploy-postgres.sh # Deploy PostgreSQL StatefulSet
./k8s-scripts/04-deploy-rails-app.sh # Deploy Rails application
./k8s-scripts/05-enable-and-deploy-ingress.sh # Configure ingress
./k8s-scripts/06-status-check.sh # Verify deployment status
Manual Access & Verification
# Access application via NodePort
minikube service webapp-service -n rails-app
# Connect to PostgreSQL for debugging
./k8s-scripts/07-connect-postgres.sh
# Check deployment status
kubectl get all -n rails-app
# Destroy all resources
./k8s-scripts/99-destroy-all.sh
ArgoCD continuously monitors the Git repository and automatically synchronizes the desired state with the Kubernetes cluster.
Declarative Configuration : Infrastructure as Code approach
Automated Sync : Continuous deployment from Git repository
Rollback Capability : Easy reversion to previous application states
Multi-Environment Support : Separate configurations for dev/staging/prod
The Tekton pipeline automates the complete CI/CD workflow:
Source Code Fetch : Clone repository from GitHub
Container Build : Build Docker image using Kaniko
Image Push : Upload to Docker Hub registry
Deployment Trigger : Notify ArgoCD for automatic deployment
# Initialize and execute Tekton components
./tekton/tek-init-script.sh
# Monitor pipeline execution
kubectl get pods --namespace tekton-pipelines --watch
# Access Tekton Dashboard
kubectl --namespace tekton-pipelines port-forward svc/tekton-dashboard 9097:9097
# Visit: http://localhost:9097
# Remove all Tekton resources
./tekton/tek-del-script.sh
rails_app/
├── app/ # Rails application code
├── config/ # Application & ArgoCD configuration
│ └── argocd/ # ArgoCD GitOps manifests
├── kubernetes-files/ # Kubernetes deployment manifests
├── k8s-scripts/ # Automated deployment scripts
├── tekton/ # CI/CD pipeline definitions
├── Dockerfile # Container build instructions
├── docker-compose.yaml # Local development stack
└── README.md # This documentation
Fork the repository
Create a feature branch (git checkout -b feature/amazing-feature)
Commit your changes (git commit -m 'Add amazing feature')
Push to the branch (git push origin feature/amazing-feature)
Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.