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 args:
26 - API_URL=${API_URL:-http://localhost:3000}
27 container_name: shortener-app
28 ports:
29 - "3000:3000"
30 environment:
31 - DATABASE_URL=postgresql://shortener:shortener123@db:5432/shortener
32 - SERVER_HOST=0.0.0.0
33 - SERVER_PORT=3000
34 depends_on:
35 db:
36 condition: service_healthy
37 healthcheck:
38 test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
39 interval: 30s
40 timeout: 10s
41 retries: 3
42 start_period: 40s
43 networks:
44 - shortener-network
45 deploy:
46 restart_policy:
47 condition: on-failure
48 max_attempts: 3
49 window: 120s
50
51networks:
52 shortener-network:
53 driver: bridge
54
55volumes:
56 shortener-data: