Loading repository data…
Loading repository data…
senura-medagoda / repository
DevOps project - A production-style URL shortener built with Python and Flask, featuring a full multi-container architecture, live monitoring dashboard, reverse proxy, and automated CI/CD pipeline.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A production-style URL shortener built with Python and Flask, featuring a full multi-container architecture, live monitoring dashboard, reverse proxy, and automated CI/CD pipeline.
Five containers running together via Docker Compose, connected through a private Docker network:
Browser → Nginx (port 80) → Flask app → Redis
↓
Prometheus → Grafana (port 3000)
| Service | Role | Image |
|---|---|---|
| Flask | URL shortener application | Built from Dockerfile |
| Nginx | Reverse proxy — public front door | nginx:alpine |
| Redis | Key-value database for URLs | redis:7-alpine |
| Prometheus | Metrics collection every 15s | prom/prometheus:latest |
| Grafana | Live monitoring dashboards | grafana/grafana:latest |
Every git push to main triggers the pipeline:
latest — most recent buildabc1234 — exact git commit SHA for traceabilityIf any test fails the pipeline stops. Nothing gets deployed.
Prerequisites: Docker Desktop installed and running
git clone https://github.com/senura-medagoda/url-shortener.git
cd url-shortener
docker-compose up -d --build
That single command starts all five containers.
| URL | What you see |
|---|---|
| http://localhost | URL shortener app |
| http://localhost/health | Health check with Redis status |
| http://localhost/metrics | Prometheus metrics endpoint |
| http://localhost:3000 | Grafana dashboard (admin/admin123) |
Stop everything:
docker-compose down
python -m venv venv
venv\Scripts\activate # Windows
pip install -r app/requirements.txt
pytest tests/ -v
Expected output:
test_home_page_loads PASSED
test_shorten_url_success PASSED
test_shorten_url_adds_https PASSED
test_shorten_empty_url_returns_400 PASSED
test_redirect_existing_url PASSED
test_redirect_nonexistent_code PASSED
test_health_endpoint_redis_up PASSED
test_health_endpoint_redis_down PASSED
8 passed in 0.61s
| Endpoint | Method | Description |
|---|---|---|
/ | GET | URL shortener web interface |
/shorten | POST | Accepts a URL, returns short link |
/<code> | GET | Redirects to original URL |
/health | GET | Health check including Redis status |
/metrics | GET | Prometheus metrics endpoint |
docker pull senuramedagoda/url-shortener:latest
url-shortener/
├── images/
│ ├── grafana-dashboard.png
│ └── app-screenshot.png
├── app/
│ ├── app.py Flask URL shortener
│ ├── requirements.txt Python dependencies
│ └── templates/
│ └── index.html Web interface
├── tests/
│ ├── __init__.py
│ └── test_app.py 8 automated tests with mocking
├── nginx/
│ └── nginx.conf Reverse proxy configuration
├── prometheus/
│ └── prometheus.yml Metrics scraping configuration
├── .github/
│ └── workflows/
│ └── ci.yml GitHub Actions pipeline
├── Dockerfile Flask container blueprint
└── docker-compose.yml All 5 containers wired together