]> Untitled Git - lemmy.git/blob - docker/docker-compose.yml
Fix dev setups. (#2944)
[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 80 is already in use on your system (or you want to run a reverse proxy outside this config)
20       - "80:80"
21       - "8536:8536"
22     volumes:
23       - ./nginx.conf:/etc/nginx/nginx.conf:ro,Z
24     restart: always
25     depends_on:
26       - pictrs
27       - lemmy-ui
28
29   lemmy:
30     # image: dessalines/lemmy:dev
31     # use this to build your local lemmy server image for development
32     # run docker compose up --build
33     build:
34       context: ../
35       dockerfile: docker/Dockerfile
36       # args:
37       #   RUST_RELEASE_MODE: release
38     # this hostname is used in nginx reverse proxy and also for lemmy ui to connect to the backend, do not change
39     hostname: lemmy
40     networks:
41       - lemmyinternal
42     restart: always
43     environment:
44       - 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"
45       - RUST_BACKTRACE=full
46     volumes:
47       - ./lemmy.hjson:/config/config.hjson:Z
48     depends_on:
49       - postgres
50       - pictrs
51
52   lemmy-ui:
53     image: dessalines/lemmy-ui:0.17.1
54     # use this to build your local lemmy ui image for development
55     # run docker compose up --build
56     # assuming lemmy-ui is cloned besides lemmy directory
57     # build:
58     #   context: ../../lemmy-ui
59     #   dockerfile: dev.dockerfile
60     networks:
61       - lemmyinternal
62     environment:
63       # this needs to match the hostname defined in the lemmy service
64       - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
65       # set the outside hostname here
66       - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:1236
67       - LEMMY_HTTPS=false
68       - LEMMY_UI_DEBUG=true
69     depends_on:
70       - lemmy
71     restart: always
72
73   pictrs:
74     image: asonix/pictrs:0.4.0-beta.19
75     # this needs to match the pictrs url in lemmy.hjson
76     hostname: pictrs
77     # we can set options to pictrs like this, here we set max. image size and forced format for conversion
78     # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp
79     networks:
80       - lemmyinternal
81     environment:
82       - PICTRS_OPENTELEMETRY_URL=http://otel:4137
83       - PICTRS__API_KEY=API_KEY
84       - RUST_LOG=debug
85       - RUST_BACKTRACE=full
86       - PICTRS__MEDIA__VIDEO_CODEC=vp9
87       - PICTRS__MEDIA__GIF__MAX_WIDTH=256
88       - PICTRS__MEDIA__GIF__MAX_HEIGHT=256
89       - PICTRS__MEDIA__GIF__MAX_AREA=65536
90       - PICTRS__MEDIA__GIF__MAX_FRAME_COUNT=400
91     user: 991:991
92     volumes:
93       - ./volumes/pictrs:/mnt:Z
94     restart: always
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     networks:
117       - lemmyinternal
118       # adding the external facing network to allow direct db access for devs
119       - lemmyexternalproxy
120     ports:
121       # use a different port so it doesnt conflict with potential postgres db running on the host
122       - "5433:5432"
123     environment:
124       - POSTGRES_USER=lemmy
125       - POSTGRES_PASSWORD=password
126       - POSTGRES_DB=lemmy
127     volumes:
128       - ./volumes/postgres:/var/lib/postgresql/data:Z
129     restart: always