]> Untitled Git - lemmy.git/blob - docker/prod/docker-compose.yml
More real-world prod config, separate lemmy config (#2487)
[lemmy.git] / docker / prod / docker-compose.yml
1 version: "3.3"
2
3 networks:
4   # communication to web and clients
5   lemmyexternalproxy:
6   # communication between lemmy services
7   lemmyinternal:
8     driver: bridge
9     internal: true
10
11 services:
12   proxy:
13     image: nginx:1-alpine
14     networks:
15       - lemmyinternal
16       - lemmyexternalproxy
17     ports:
18       # only ports facing any connection from outside
19       - 80:80 
20       - 443:443
21     volumes:
22       - ./nginx.conf:/etc/nginx/nginx.conf:ro
23       # setup your certbot and letsencrypt config 
24       - ./certbot:/var/www/certbot
25       - ./letsencrypt:/etc/letsencrypt/live
26     restart: always
27     depends_on:
28       - pictrs
29       - lemmy-ui
30
31   lemmy:
32     image: dessalines/lemmy:0.16.7
33     hostname: lemmy
34     networks:
35       - lemmyinternal
36     restart: always
37       - RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info"
38     volumes:
39       - ./lemmy.hjson:/config/config.hjson
40     depends_on:
41       - postgres
42       - pictrs
43
44   lemmy-ui:
45     image: dessalines/lemmy-ui:0.16.7
46     networks:
47       - lemmyinternal
48     environment:
49       # this needs to match the hostname defined in the lemmy service
50       - LEMMY_INTERNAL_HOST=lemmy:8536
51       # set the outside hostname here
52       - LEMMY_EXTERNAL_HOST=localhost:1236
53       - LEMMY_HTTPS=true
54     depends_on:
55       - lemmy
56     restart: always
57
58   pictrs:
59     image: asonix/pictrs:0.3.1
60     # this needs to match the pictrs url in lemmy.hjson
61     hostname: pictrs
62     # we can set options to pictrs like this, here we set max. image size and forced format for conversion
63     # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp
64     networks:
65       - lemmyinternal
66     environment:
67       - PICTRS__API_KEY=API_KEY
68     user: 991:991
69     volumes:
70       - ./volumes/pictrs:/mnt
71     restart: always
72
73   postgres:
74     image: postgres:14-alpine
75     # this needs to match the database host in lemmy.hson
76     hostname: postgres
77     networks:
78       - lemmyinternal
79     environment:
80       - POSTGRES_USER=lemmy
81       - POSTGRES_PASSWORD=password
82       - POSTGRES_DB=lemmy
83     volumes:
84       - ./volumes/postgres:/var/lib/postgresql/data
85     restart: always