]> Untitled Git - lemmy.git/blob - docker/docker-compose.yml
Add Custom Emojis Support (#2616)
[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.4.0-beta.19
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       - PICTRS__MEDIA__VIDEO_CODEC=vp9
86       - PICTRS__MEDIA__GIF__MAX_WIDTH=256
87       - PICTRS__MEDIA__GIF__MAX_HEIGHT=256
88       - PICTRS__MEDIA__GIF__MAX_AREA=65536
89       - PICTRS__MEDIA__GIF__MAX_FRAME_COUNT=400
90     user: 991:991
91     volumes:
92       - ./volumes/pictrs:/mnt
93     restart: always
94
95   postgres:
96     image: postgres:15-alpine
97     # this needs to match the database host in lemmy.hson
98     # Tune your settings via
99     # https://pgtune.leopard.in.ua/#/
100     # You can use this technique to add them here
101     # https://stackoverflow.com/a/30850095/1655478
102     hostname: postgres
103     command: [
104       "postgres",
105       "-c", "session_preload_libraries=auto_explain",
106       "-c", "auto_explain.log_min_duration=5ms",
107       "-c", "auto_explain.log_analyze=true",
108       "-c", "track_activity_query_size=1048576"
109     ]
110     networks:
111       - lemmyinternal
112     # adding the external facing network to allow direct db access for devs
113       - lemmyexternalproxy
114     ports:
115     # use a different port so it doesnt conflict with potential postgres db running on the host
116       - "5433:5432"
117     environment:
118       - POSTGRES_USER=lemmy
119       - POSTGRES_PASSWORD=password
120       - POSTGRES_DB=lemmy
121     volumes:
122       - ./volumes/postgres:/var/lib/postgresql/data
123     restart: always
124
125   otel:
126     image: otel/opentelemetry-collector:latest
127     command: --config otel-local-config.yaml
128     networks:
129       - lemmyinternal
130       - lemmyexternalproxy
131     ports:
132       - "4317:4317"
133     volumes:
134       - type: bind
135         source: ./otel.yml
136         target: /otel-local-config.yaml
137     restart: unless-stopped
138     depends_on:
139       - jaeger
140   
141   jaeger:
142     image: jaegertracing/all-in-one:1
143     networks:
144       - lemmyinternal
145       - lemmyexternalproxy
146     ports:
147       - "14250:14250"
148       # To view traces, visit http://localhost:16686
149       - "16686:16686"
150     restart: unless-stopped