]> Untitled Git - lemmy.git/blob - docker/docker-compose.yml
Add Prometheus endpoint (#3456)
[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     # image: dessalines/lemmy:0.18.0
28     # use this to build your local lemmy server image for development
29     # run docker compose up --build
30     build:
31       context: ../
32       dockerfile: docker/Dockerfile
33       # args:
34       #   RUST_RELEASE_MODE: release
35       #   CARGO_BUILD_FEATURES: default
36     # this hostname is used in nginx reverse proxy and also for lemmy ui to connect to the backend, do not change
37     hostname: lemmy
38     restart: always
39     environment:
40       - 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"
41       - RUST_BACKTRACE=full
42     ports:
43       # prometheus metrics available at the path /metrics on port 10002 by default
44       # enable prometheus metrics by setting the CARGO_BUILD_FEATURES build arg above to "prometheus-metrics"
45       - "10002:10002"
46     volumes:
47       - ./lemmy.hjson:/config/config.hjson:Z
48     depends_on:
49       - postgres
50       - pictrs
51     logging: *default-logging
52
53   lemmy-ui:
54     image: dessalines/lemmy-ui:0.18.0
55     # use this to build your local lemmy ui image for development
56     # run docker compose up --build
57     # assuming lemmy-ui is cloned besides lemmy directory
58     # build:
59     #   context: ../../lemmy-ui
60     #   dockerfile: dev.dockerfile
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_UI_HTTPS=false
67       - LEMMY_UI_DEBUG=true
68     depends_on:
69       - lemmy
70     restart: always
71     logging: *default-logging
72     init: true
73
74   pictrs:
75     image: asonix/pictrs:0.4.0-beta.19
76     # this needs to match the pictrs url in lemmy.hjson
77     hostname: pictrs
78     # we can set options to pictrs like this, here we set max. image size and forced format for conversion
79     # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp
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:Z
93     restart: always
94     logging: *default-logging
95
96   postgres:
97     image: postgres:15-alpine
98     # this needs to match the database host in lemmy.hson
99     # Tune your settings via
100     # https://pgtune.leopard.in.ua/#/
101     # You can use this technique to add them here
102     # https://stackoverflow.com/a/30850095/1655478
103     hostname: postgres
104     command:
105       [
106         "postgres",
107         "-c",
108         "session_preload_libraries=auto_explain",
109         "-c",
110         "auto_explain.log_min_duration=5ms",
111         "-c",
112         "auto_explain.log_analyze=true",
113         "-c",
114         "track_activity_query_size=1048576",
115       ]
116     ports:
117       # use a different port so it doesnt conflict with potential postgres db running on the host
118       - "5433:5432"
119     environment:
120       - POSTGRES_USER=lemmy
121       - POSTGRES_PASSWORD=password
122       - POSTGRES_DB=lemmy
123     volumes:
124       - ./volumes/postgres:/var/lib/postgresql/data:Z
125     restart: always
126     logging: *default-logging