]> Untitled Git - lemmy.git/blob - docker/docker-compose.yml
Remove networks from docker-compose.yml (#3356)
[lemmy.git] / docker / docker-compose.yml
1 version: "3.7"
2
3 x-logging: &default-logging
4   driver: "json-file"
5   options:
6     max-size: "50m"
7     max-file: 4
8
9 services:
10   proxy:
11     image: nginx:1-alpine
12     ports:
13       # actual and only port facing any connection from outside
14       # Note, change the left number if port 1236 is already in use on your system
15       # You could use port 80 if you won't use a reverse proxy
16       - "1236:1236"
17       - "8536:8536"
18     volumes:
19       - ./nginx.conf:/etc/nginx/nginx.conf:ro,Z
20     restart: always
21     depends_on:
22       - pictrs
23       - lemmy-ui
24     logging: *default-logging
25
26   lemmy:
27     # image: dessalines/lemmy:0.18.0
28     # use this to build your local lemmy server image for development
29     # run docker compose up --build
30     build:
31       context: ../
32       dockerfile: docker/Dockerfile
33       # args:
34       #   RUST_RELEASE_MODE: release
35     # this hostname is used in nginx reverse proxy and also for lemmy ui to connect to the backend, do not change
36     hostname: lemmy
37     restart: always
38     environment:
39       - RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
40       - RUST_BACKTRACE=full
41     volumes:
42       - ./lemmy.hjson:/config/config.hjson:Z
43     depends_on:
44       - postgres
45       - pictrs
46     logging: *default-logging
47
48   lemmy-ui:
49     image: dessalines/lemmy-ui:0.18.0
50     # use this to build your local lemmy ui image for development
51     # run docker compose up --build
52     # assuming lemmy-ui is cloned besides lemmy directory
53     # build:
54     #   context: ../../lemmy-ui
55     #   dockerfile: dev.dockerfile
56     environment:
57       # this needs to match the hostname defined in the lemmy service
58       - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
59       # set the outside hostname here
60       - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:1236
61       - LEMMY_UI_HTTPS=false
62       - LEMMY_UI_DEBUG=true
63     depends_on:
64       - lemmy
65     restart: always
66     logging: *default-logging
67     init: true
68
69   pictrs:
70     image: asonix/pictrs:0.4.0-beta.19
71     # this needs to match the pictrs url in lemmy.hjson
72     hostname: pictrs
73     # we can set options to pictrs like this, here we set max. image size and forced format for conversion
74     # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp
75     environment:
76       - PICTRS_OPENTELEMETRY_URL=http://otel:4137
77       - PICTRS__API_KEY=API_KEY
78       - RUST_LOG=debug
79       - RUST_BACKTRACE=full
80       - PICTRS__MEDIA__VIDEO_CODEC=vp9
81       - PICTRS__MEDIA__GIF__MAX_WIDTH=256
82       - PICTRS__MEDIA__GIF__MAX_HEIGHT=256
83       - PICTRS__MEDIA__GIF__MAX_AREA=65536
84       - PICTRS__MEDIA__GIF__MAX_FRAME_COUNT=400
85     user: 991:991
86     volumes:
87       - ./volumes/pictrs:/mnt:Z
88     restart: always
89     logging: *default-logging
90
91   postgres:
92     image: postgres:15-alpine
93     # this needs to match the database host in lemmy.hson
94     # Tune your settings via
95     # https://pgtune.leopard.in.ua/#/
96     # You can use this technique to add them here
97     # https://stackoverflow.com/a/30850095/1655478
98     hostname: postgres
99     command:
100       [
101         "postgres",
102         "-c",
103         "session_preload_libraries=auto_explain",
104         "-c",
105         "auto_explain.log_min_duration=5ms",
106         "-c",
107         "auto_explain.log_analyze=true",
108         "-c",
109         "track_activity_query_size=1048576",
110       ]
111     ports:
112       # use a different port so it doesnt conflict with potential postgres db running on the host
113       - "5433:5432"
114     environment:
115       - POSTGRES_USER=lemmy
116       - POSTGRES_PASSWORD=password
117       - POSTGRES_DB=lemmy
118     volumes:
119       - ./volumes/postgres:/var/lib/postgresql/data:Z
120     restart: always
121     logging: *default-logging