Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions LAB6.md

This file was deleted.

31 changes: 31 additions & 0 deletions LAB7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 7

## Monitoring: logging

In this lab you need to get familiar with a logging stack - Promtail, Loki, Grafana. Then prepare a docker-compose file and config files to setup the stack.

### 10 points

1. Read about the logging stack:

* https://grafana.com/go/webinar/loki-getting-started/
* https://grafana.com/docs/loki/latest/overview/

2. Prepare a docker-compose file with the stack and your app.

* [examples of docker-compose](https://github.com/grafana/loki)
* [example of promtail configuration](https://github.com/black-rosary/loki-nginx), but be smart

3. Test that it works, prepare a `LOGGING.md` report.
4. Create a monitoring folder, put report, docker-compose.yml and config files inside.
5. Provide screenshots of your success in the report.
6. Create a PR to the forked repo lab7 branch, ask your teammates to review it and review PRs of your teammates.
7. Create a PR in your own repository from the lab7 branch to the lab6 one. It will help us with grading.

## Bonus

### 2 points

1. Add your extra app to the `docker-compose.yml`.
2. Configure stack to get logs from all containers from docker-compose.yml. Provide
screenshots of your success in the report.
9 changes: 9 additions & 0 deletions monitoring/LOGGING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Logging

Match timeweb proxy container logs:

![](https://i.ibb.co/hdGcSB1/1.png)

Filter by `GET /`:

![](https://i.ibb.co/f9vnr34/2.png)
60 changes: 60 additions & 0 deletions monitoring/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version: '3.3'
services:
timeweb:
image: passkeyra/timeweb:latest
restart: unless-stopped

nginx:
build: ./nginx
image: nginx.timeweb
ports:
- "80:80"
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
tag: "{{.ImageName}}|{{.Name}}"

grafana:
image: grafana/grafana
ports:
- 3000:3000
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning/:/etc/grafana/provisioning/
env_file:
- ./grafana/config.monitoring
restart: unless-stopped

promtail:
image: grafana/promtail
expose:
- 9080
ports:
- "9080:9080"
volumes:
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- promtail_data:/var/lib/promtail/positions
- ./promtail/promtail.yml:/etc/promtail/promtail.yml
command:
- '-config.file=/etc/promtail/promtail.yml'
restart: unless-stopped

loki:
image: grafana/loki
expose:
- 3100
ports:
- "3100:3100"
volumes:
- ./loki/loki-config.yml:/etc/loki-config.yml
- loki_data:/loki
command: -config.file=/etc/loki-config.yml
restart: unless-stopped

volumes:
grafana_data: {}
loki_data: {}
promtail_data: {}
3 changes: 3 additions & 0 deletions monitoring/grafana/config.monitoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GF_SECURITY_ADMIN_USER=admin
GF_SECURITY_ADMIN_PASSWORD=gO/JrMlJorSkUJcg
GF_USERS_ALLOW_SIGN_UP=false
11 changes: 11 additions & 0 deletions monitoring/grafana/provisioning/dashboards/dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: 1

providers:
- name: 'Prometheus'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /etc/grafana/provisioning/dashboards
Loading