]> Untitled Git - lemmy.git/blob - docker/docker-compose.yml
add enable_federated_downvotes site option
[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     # use "image" to pull down an already compiled lemmy. make sure to comment out "build".
28     # image: dessalines/lemmy:0.18.1
29     # platform: linux/x86_64 # no arm64 support. uncomment platform if using m1.
30     # use "build" to build your local lemmy server image for development. make sure to comment out "image".
31     # run: docker compose up --build
32
33     build:
34       context: ../
35       dockerfile: docker/Dockerfile
36       # args:
37       #   RUST_RELEASE_MODE: release
38       #   CARGO_BUILD_FEATURES: default
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     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     ports:
46       # prometheus metrics available at the path /metrics on port 10002 by default
47       # enable prometheus metrics by setting the CARGO_BUILD_FEATURES build arg above to "prometheus-metrics"
48       - "10002:10002"
49     volumes:
50       - ./lemmy.hjson:/config/config.hjson:Z
51     depends_on:
52       - postgres
53       - pictrs
54     logging: *default-logging
55
56   lemmy-ui:
57     # use "image" to pull down an already compiled lemmy-ui. make sure to comment out "build".
58     image: dessalines/lemmy-ui:0.18.1
59     # platform: linux/x86_64 # no arm64 support. uncomment platform if using m1.
60     # use "build" to build your local lemmy ui image for development. make sure to comment out "image".
61     # run: docker compose up --build
62
63     # build:
64     #   context: ../../lemmy-ui # assuming lemmy-ui is cloned besides lemmy directory
65     #   dockerfile: dev.dockerfile
66     environment:
67       # this needs to match the hostname defined in the lemmy service
68       - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
69       # set the outside hostname here
70       - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:1236
71       - LEMMY_UI_HTTPS=false
72       - LEMMY_UI_DEBUG=true
73     depends_on:
74       - lemmy
75     restart: always
76     logging: *default-logging
77     init: true
78
79   pictrs:
80     image: asonix/pictrs:0.4.0-beta.19
81     # this needs to match the pictrs url in lemmy.hjson
82     hostname: pictrs
83     # we can set options to pictrs like this, here we set max. image size and forced format for conversion
84     # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp
85     environment:
86       - PICTRS_OPENTELEMETRY_URL=http://otel:4137
87       - PICTRS__API_KEY=API_KEY
88       - RUST_LOG=debug
89       - RUST_BACKTRACE=full
90       - PICTRS__MEDIA__VIDEO_CODEC=vp9
91       - PICTRS__MEDIA__GIF__MAX_WIDTH=256
92       - PICTRS__MEDIA__GIF__MAX_HEIGHT=256
93       - PICTRS__MEDIA__GIF__MAX_AREA=65536
94       - PICTRS__MEDIA__GIF__MAX_FRAME_COUNT=400
95     user: 991:991
96     volumes:
97       - ./volumes/pictrs:/mnt:Z
98     restart: always
99     logging: *default-logging
100
101   postgres:
102     image: postgres:15-alpine
103     # this needs to match the database host in lemmy.hson
104     # Tune your settings via
105     # https://pgtune.leopard.in.ua/#/
106     # You can use this technique to add them here
107     # https://stackoverflow.com/a/30850095/1655478
108     hostname: postgres
109     command:
110       [
111         "postgres",
112         "-c",
113         "session_preload_libraries=auto_explain",
114         "-c",
115         "auto_explain.log_min_duration=5ms",
116         "-c",
117         "auto_explain.log_analyze=true",
118         "-c",
119         "track_activity_query_size=1048576",
120       ]
121     ports:
122       # use a different port so it doesnt conflict with potential postgres db running on the host
123       - "5433:5432"
124     environment:
125       - POSTGRES_USER=lemmy
126       - POSTGRES_PASSWORD=password
127       - POSTGRES_DB=lemmy
128     volumes:
129       - ./volumes/postgres:/var/lib/postgresql/data:Z
130     restart: always
131     logging: *default-logging