A very performant and light (2mb in memory) link shortener and tracker. Written in Rust and React and uses Postgres/SQLite.
1services:
2 db:
3 image: postgres:15-alpine
4 container_name: shortener-db
5 environment:
6 POSTGRES_DB: shortener
7 POSTGRES_USER: shortener
8 POSTGRES_PASSWORD: shortener123
9 ports:
10 - "5432:5432"
11 volumes:
12 - shortener-data:/var/lib/postgresql/data
13 healthcheck:
14 test: ["CMD-SHELL", "pg_isready -U shortener"]
15 interval: 5s
16 timeout: 5s
17 retries: 5
18 networks:
19 - shortener-network
20
21 app:
22 build:
23 context: .
24 dockerfile: Dockerfile
25 container_name: shortener-app
26 ports:
27 - "8080:8080"
28 environment:
29 - DATABASE_URL=postgresql://shortener:shortener123@db:5432/shortener
30 - SERVER_HOST=0.0.0.0
31 - SERVER_PORT=8080
32 - JWT_SECRET=change-me-in-production
33 depends_on:
34 db:
35 condition: service_healthy
36 healthcheck:
37 test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
38 interval: 30s
39 timeout: 10s
40 retries: 3
41 start_period: 40s
42 networks:
43 - shortener-network
44 deploy:
45 restart_policy:
46 condition: on-failure
47 max_attempts: 3
48 window: 120s
49
50networks:
51 shortener-network:
52 driver: bridge
53
54volumes:
55 shortener-data: