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