https://github.com/sidge4real/devops_exam_preparation
Simple blog app with local HTTP deployment via Docker Compose, using Node.js API, EJS frontend, and Nginx-served admin dashboard routed through Traefik.
https://github.com/sidge4real/devops_exam_preparation
docker ejs expressjs nginx nodejs traefik
Last synced: 3 months ago
JSON representation
Simple blog app with local HTTP deployment via Docker Compose, using Node.js API, EJS frontend, and Nginx-served admin dashboard routed through Traefik.
- Host: GitHub
- URL: https://github.com/sidge4real/devops_exam_preparation
- Owner: Sidge4real
- Created: 2025-08-02T16:04:13.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-02T16:34:30.000Z (11 months ago)
- Last Synced: 2025-08-02T18:37:40.789Z (11 months ago)
- Topics: docker, ejs, expressjs, nginx, nodejs, traefik
- Language: CSS
- Homepage:
- Size: 1.09 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 📝 Simple Blog App – DevOps Exam Preparation
[](https://www.docker.com/) [](https://traefik.io/) [](https://nodejs.org/) [](https://nginx.org/) [](https://www.postgresql.org/)
This is a **practice project** created in preparation for a **DevOps exam**. It demonstrates the deployment of a full-stack blog application using **Docker Compose** and **Traefik**, running locally over **HTTP**.
## 🎯 Features
- 🔄 **Containerized Architecture** with Docker Compose
- 🌐 **Reverse Proxy** with Traefik
- 🔒 **Basic Auth** protection for admin dashboard
- 📊 **PostgreSQL** database with volume persistence
- 🖥️ **Modern Frontend** using EJS templating
- 🛡️ **Admin Dashboard** for content management
## 🚀 Tech Stack
| Component | Technology | Description |
|-----------|------------|-------------|
| Backend API | Node.js | RESTful API service |
| Database | PostgreSQL | Data persistence |
| Frontend | EJS | Server-side rendering |
| Admin Panel | Nginx | Static file serving |
| Proxy | Traefik | HTTP routing & load balancing |
## 📁 Project Structure
```
.
├── api/ # Node.js backend (REST API)
├── frontend/ # EJS-based frontend
├── admin/ # Nginx static admin dashboard
├── .env # Shared environment variables
├── docker-compose.yml # Container orchestration
└── etc/
└── traefik/ # Traefik configuration
└── traefik.yml
```
## 🛠️ Prerequisites
- Docker Engine (20.10.x or newer)
- Docker Compose v2.x
- Git
- Text editor for configuration
## ⚙️ Configuration
### Base Application Configuration
**Environment Variables (.env)**
```env
# Database Configuration
POSTGRES_HOST=db
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=
DB_PORT=5432
# API Configuration
API_HOST=api
API_PORT=3000
```
### Traefik Authentication
**Basic Auth Credentials**
```env
TRAEFIK_AUTH_USER=:
```
**Generate New Encrypted Credentials**
```bash
docker run --rm httpd:2.4 htpasswd -nbB
```
## 🚀 Quick Start
### 1. Repository Setup
```bash
# Clone the repository
git clone
# Navigate to project directory
cd
```
### 2. Host Configuration
**Add Local Domain Entries**
```bash
# For Linux/macOS: Add to /etc/hosts
# For Windows: Add to C:\Windows\System32\drivers\etc\hosts
127.0.0.1 base-app.localhost traefik.localhost
```
### 3. Launch Application
```bash
# Build and start all services
docker compose up --build
```
## 🌐 Access Points
| Service | URL | Description |
|---------|-----|-------------|
| Frontend | http://base-app.localhost | Main blog interface |
| Admin Dashboard | http://base-app.localhost/admin | Content management |
| API | http://base-app.localhost/api/ | Backend API |
| Traefik Dashboard | http://traefik.localhost | Proxy monitoring |
## 🐳 Container Images
| Service | Image | Version |
|---------|-------|----------|
| API | node | 23.6 |
| Frontend | node | 23.6 |
| Admin | nginx | 1.27 |
| Database | postgres | 15.10 |
| Proxy | traefik | 3.3 |
## 🔍 Troubleshooting
### Diagnostic Commands
**View Service Logs**
```bash
# View logs for all services
docker compose logs
# View logs for specific service
docker compose logs [service-name]
# Follow log output
docker compose logs -f [service-name]
```
**Container Shell Access**
```bash
# Access container shell
docker exec -it sh
# Access PostgreSQL container
docker exec -it db psql -U user -d mydatabase
```
### Common Issues
**Port Conflicts**
```bash
# Check if ports are in use (Windows)
netstat -ano | findstr :80
netstat -ano | findstr :5432
```
**DNS Resolution**
```bash
# Test DNS resolution
ping base-app.localhost
ping traefik.localhost
```
**Database Connection**
```bash
# Test database connection from API container
docker exec -it api node -e "const { Client } = require('pg'); const client = new Client(); client.connect()"
```