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
24 changes: 24 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM golang:1.24.5-alpine AS builder

WORKDIR /src

COPY go.mod ./
RUN go mod download

COPY . .

RUN CGO_ENABLED=0 go build \
-trimpath \
-ldflags="-s -w" \
-o /quicknotes

FROM gcr.io/distroless/static:nonroot

COPY --from=builder /quicknotes /quicknotes
COPY --from=builder /src/seed.json /seed.json

EXPOSE 8080

USER 65532:65532

ENTRYPOINT ["/quicknotes"]
51 changes: 51 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
services:
quicknotes:
image: quicknotes:lab6
build:
context: ./app
user: "0:0"

ports:
- "8080:8080"

environment:
ADDR: ":8080"
DATA_PATH: "/data/notes.json"
SEED_PATH: "/seed.json"

volumes:
- quicknotes-data:/data

restart: unless-stopped


prometheus:
image: prom/prometheus:v3.3.1

ports:
- "9090:9090"

volumes:
- ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro

depends_on:
- quicknotes
grafana:
image: grafana/grafana:11.6.16

ports:
- "3000:3000"

environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: supersecret123

volumes:
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning
- ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards

depends_on:
- prometheus

volumes:
quicknotes-data:
16 changes: 16 additions & 0 deletions docs/runbook/high-error-rate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# High Error Rate Alert

## What this alert means
More than 5% of requests to QuickNotes are failing with HTTP 4xx or 5xx statuses over the last 5 minutes.

## Triage steps
1. Check the Grafana dashboard → Errors panel to confirm the error ratio and see which endpoints are affected.
2. Look at the QuickNotes logs (`docker logs quicknotes`) for stack traces or specific error messages.
3. Verify the health of dependent services (database, external APIs) by checking their connectivity and response times.

## Mitigations
- **Rollback** the latest deployment if a code change was recently pushed (revert to the previous image tag).
- **Increase logging** and enable debug mode to capture more details, then restart the service to clear any transient state.

## Post-incident
After resolving, create a postmortem following the [template](https://github.com/your-repo/docs/postmortem-template.md) to document the root cause, impact, and action items.
9 changes: 9 additions & 0 deletions monitoring/grafana/provisioning/dashboards/dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: 1

providers:
- name: default
folder: ""
type: file

options:
path: /var/lib/grafana/dashboards
8 changes: 8 additions & 0 deletions monitoring/grafana/provisioning/datasources/datasource.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: 1

datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
9 changes: 9 additions & 0 deletions monitoring/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
global:
scrape_interval: 15s

scrape_configs:
- job_name: quicknotes

static_configs:
- targets:
- quicknotes:8080
Binary file added submissions/image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submissions/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading