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