|
| 1 | +# Laravel App Production-Ready Setup |
| 2 | + |
| 3 | +A full production-like setup for a Laravel application using Docker, Kubernetes (via Helm), and GitLab CI/CD pipelines for automation and deployment. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 📦 Architecture |
| 8 | + |
| 9 | +### Local Development |
| 10 | +- Laravel + MongoDB + Elasticsearch in containers via **Docker Compose**. |
| 11 | + |
| 12 | +### Production Architecture |
| 13 | +- Laravel app containerized and deployed to **Kubernetes** using **Helm**. |
| 14 | +- MongoDB and Elasticsearch are hosted externally (e.g., managed clusters or self-hosted). |
| 15 | + |
| 16 | +### CI/CD Pipeline |
| 17 | +- **GitLab CI/CD** pipeline handles: |
| 18 | + - Code testing |
| 19 | + - Docker image builds |
| 20 | + - Simulated Helm-based deployment |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## 🌐 Environments |
| 25 | + |
| 26 | +| Environment | Description | |
| 27 | +|---------------|--------------------------------------------------------------| |
| 28 | +| Local | Docker Compose setup for fast development | |
| 29 | +| Development | Simulated Kubernetes deployment with custom Helm values | |
| 30 | +| Staging | Production-like setup used for testing before going live | |
| 31 | +| Production | Fully simulated in CI/CD (no real infra required) | |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## 🔁 CI/CD Workflow |
| 36 | + |
| 37 | +### 🔍 Stages Explained |
| 38 | + |
| 39 | +- **Test**: |
| 40 | + Runs unit/integration tests on every merge request to validate code stability. |
| 41 | + |
| 42 | +- **Build**: |
| 43 | + Builds and pushes Docker image after a successful merge. |
| 44 | + |
| 45 | +- **Deploy**: |
| 46 | + Simulates deploying the app to Kubernetes using Helm. |
| 47 | + |
| 48 | +### ⚙️ Trigger Rules |
| 49 | + |
| 50 | +- `test` stage runs on Merge Requests to `main` branch. |
| 51 | +- Merge is blocked if tests fail. |
| 52 | +- After merging to `main`, `build` and `deploy` stages run automatically. |
| 53 | +- Docker images are pushed to DockerHub or simulated registry. |
| 54 | +- Deployment is simulated to an EKS-like cluster using Helm. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## 🚀 Getting Started |
| 59 | + |
| 60 | +### 1. Run Project Locally with Docker Compose |
| 61 | + |
| 62 | +```bash |
| 63 | +docker-compose up --build |
0 commit comments