This project involves deploying a web application with a Postgres database, a Django application, an NGINX reverse proxy, and monitoring tools (Prometheus and Grafana). The deployment uses Docker and Docker Compose.
-
System Requirements:
- Linux-based OS (Ubuntu/Debian recommended).
-
Installed Tools:
- Docker (>= 20.x).
- Docker Compose (>= 2.x).
-
Required Files:
docker-compose.yaml
deployment.yaml
start.yaml
-
Clone the repository:
#bash git clone https://github.com/Nobodyknwme/Testtask cd Testtask
-
Install the required packages: #bash sudo apt update && sudo apt install -y docker.io docker-compose
A. Using script setup.sh (Recommended for Automation) #bash cd Testtask chmod +x setup.sh ./setup.sh
B. Manual Deployment
-
Build and Start the Containers:
#bash sudo docker-compose -f deployment.yaml up --build
-
Verify Running Containers: Run the following command to ensure all services are running:
#bash sudo docker ps
Expected output:
- Postgres database container (Testtask-db-1)
- Django application container (Testtask-django-1)
- NGINX proxy container (Testtask-nginx-1)
- Prometheus monitoring container (prometheus)
- Grafana visualization container (grafana)
-
Access the Services:
- NGINX reverse proxy:
http://<your_server_ip>
- Prometheus:
http://<your_server_ip>:9090
- Grafana:
http://<your_server_ip>:3000
(default username/password:admin/admin
)
- NGINX reverse proxy:
- Open the NGINX URL (
http://<your_server_ip>
). - Verify the Django application is accessible and functioning as expected.
- Log in to Grafana and navigate to the "Dashboards" section.
- Verify the pre-provisioned dashboard is loading and displaying data collected by Prometheus.
-
For advanced debugging, check container logs:
#bash sudo docker logs <container_name>