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