]> Untitled Git - lemmy.git/blob - docker/docker-compose.yml
Fixing slow joins to post_read, post_saved, and comment_saved . (#2738)
[lemmy.git] / docker / 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     # actual and only port facing any connection from outside 
19       - "1236:1236"
20       - "8536:8536"
21     volumes:
22       - ./nginx.conf:/etc/nginx/nginx.conf:ro
23     restart: always
24     depends_on:
25       - pictrs
26       - lemmy-ui
27
28   lemmy:
29     # image: dessalines/lemmy:dev
30     # use this to build your local lemmy server image for development
31     # run docker compose up --build
32     build: 
33       context: ../
34       dockerfile: docker/Dockerfile
35       # args: 
36       #   RUST_RELEASE_MODE: release
37     # this hostname is used in nginx reverse proxy and also for lemmy ui to connect to the backend, do not change
38     hostname: lemmy
39     networks:
40       - lemmyinternal
41     restart: always
42     environment:
43       - 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"
44       - RUST_BACKTRACE=full
45     volumes:
46       - ./lemmy.hjson:/config/config.hjson
47     depends_on:
48       - postgres
49       - pictrs
50
51   lemmy-ui:
52     image: dessalines/lemmy-ui:0.17.1
53     # use this to build your local lemmy ui image for development
54     # run docker compose up --build
55     # assuming lemmy-ui is cloned besides lemmy directory
56     # build: 
57     #  context: ../../../lemmy-ui
58     #  dockerfile: dev.dockerfile
59     networks:
60       - lemmyinternal
61     environment:
62       # this needs to match the hostname defined in the lemmy service
63       - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
64       # set the outside hostname here
65       - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:1236
66       - LEMMY_HTTPS=false
67       - LEMMY_UI_DEBUG=true
68     depends_on:
69       - lemmy
70     restart: always
71
72   pictrs:
73     image: asonix/pictrs:0.3.1
74     # this needs to match the pictrs url in lemmy.hjson
75     hostname: pictrs
76     # we can set options to pictrs like this, here we set max. image size and forced format for conversion
77     # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp
78     networks:
79       - lemmyinternal
80     environment:
81       - PICTRS_OPENTELEMETRY_URL=http://otel:4137
82       - PICTRS__API_KEY=API_KEY
83       - RUST_LOG=debug
84       - RUST_BACKTRACE=full
85     user: 991:991
86     volumes:
87       - ./volumes/pictrs:/mnt
88     restart: always
89
90   postgres:
91     image: postgres:15-alpine
92     # this needs to match the database host in lemmy.hson
93     # Tune your settings via
94     # https://pgtune.leopard.in.ua/#/
95     # You can use this technique to add them here
96     # https://stackoverflow.com/a/30850095/1655478
97     hostname: postgres
98     command: [
99       "postgres",
100       "-c", "session_preload_libraries=auto_explain",
101       "-c", "auto_explain.log_min_duration=5ms",
102       "-c", "auto_explain.log_analyze=true",
103       "-c", "track_activity_query_size=1048576"
104     ]
105     networks:
106       - lemmyinternal
107     # adding the external facing network to allow direct db access for devs
108       - lemmyexternalproxy
109     ports:
110     # use a different port so it doesnt conflict with potential postgres db running on the host
111       - "5433:5432"
112     environment:
113       - POSTGRES_USER=lemmy
114       - POSTGRES_PASSWORD=password
115       - POSTGRES_DB=lemmy
116     volumes:
117       - ./volumes/postgres:/var/lib/postgresql/data
118     restart: always
119
120   otel:
121     image: otel/opentelemetry-collector:latest
122     command: --config otel-local-config.yaml
123     networks:
124       - lemmyinternal
125       - lemmyexternalproxy
126     ports:
127       - "4317:4317"
128     volumes:
129       - type: bind
130         source: ./otel.yml
131         target: /otel-local-config.yaml
132     restart: unless-stopped
133     depends_on:
134       - jaeger
135   
136   jaeger:
137     image: jaegertracing/all-in-one:1
138     networks:
139       - lemmyinternal
140       - lemmyexternalproxy
141     ports:
142       - "14250:14250"
143       # To view traces, visit http://localhost:16686
144       - "16686:16686"
145     restart: unless-stopped