]> Untitled Git - lemmy.git/blob - docker/dev/docker-compose.yml
e38d0ca1d076b3d1c4d0a2743c910f143791a724
[lemmy.git] / docker / dev / 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       - "1236:1236"
20       - "8536:8536"
21     volumes:
22       - ./nginx.conf:/etc/nginx/nginx.conf:ro
23     restart: always
24     depends_on:
25       - pictrs
26       - lemmy-ui
27
28   lemmy:
29     # image: dessalines/lemmy:dev
30     # use this to build your local lemmy server image for development
31     # run docker compose up --build
32     build: 
33       context: ../..
34       dockerfile: docker/dev/Dockerfile
35     # this hostname is used in nginx reverse proxy and also for lemmy ui to connect to the backend, do not change
36     hostname: lemmy
37     networks:
38       - lemmyinternal
39     restart: always
40     environment:
41       - 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"
42       - RUST_BACKTRACE=full
43     volumes:
44       - ./lemmy.hjson:/config/config.hjson
45     depends_on:
46       - postgres
47       - pictrs
48
49   lemmy-ui:
50     image: dessalines/lemmy-ui:dev
51     # use this to build your local lemmy ui image for development
52     # run docker compose up --build
53     # assuming lemmy-ui is cloned besides lemmy directory
54     # build: 
55     #  context: ../../../lemmy-ui
56     #  dockerfile: dev.dockerfile
57     networks:
58       - lemmyinternal
59     environment:
60       # this needs to match the hostname defined in the lemmy service
61       - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
62       # set the outside hostname here
63       - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:1236
64       - LEMMY_HTTPS=false
65       - LEMMY_UI_DEBUG=true
66     depends_on:
67       - lemmy
68     restart: always
69
70   pictrs:
71     image: asonix/pictrs:0.3.1
72     # this needs to match the pictrs url in lemmy.hjson
73     hostname: pictrs
74     # we can set options to pictrs like this, here we set max. image size and forced format for conversion
75     # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp
76     networks:
77       - lemmyinternal
78     environment:
79       - PICTRS_OPENTELEMETRY_URL=http://otel:4137
80       - PICTRS__API_KEY=API_KEY
81       - RUST_LOG=debug
82       - RUST_BACKTRACE=full
83     user: 991:991
84     volumes:
85       - ./volumes/pictrs:/mnt
86     restart: always
87
88   postgres:
89     image: postgres:15-alpine
90     # this needs to match the database host in lemmy.hson
91     # Tune your settings via
92     # https://pgtune.leopard.in.ua/#/
93     # You can use this technique to add them here
94     # https://stackoverflow.com/a/30850095/1655478
95     hostname: postgres
96     command: [
97       "postgres",
98       "-c", "session_preload_libraries=auto_explain",
99       "-c", "auto_explain.log_min_duration=5ms",
100       "-c", "auto_explain.log_analyze=true"
101       # Tuning config
102       # "-c", "max_connections=200",
103       # "-c", "shared_buffers=3GB",
104       # "-c", "effective_cache_size=9GB",
105       # "-c", "maintenance_work_mem=768MB",
106       # "-c", "checkpoint_completion_target=0.9",
107       # "-c", "wal_buffers=16MB",
108       # "-c", "default_statistics_target=100",
109       # "-c", "random_page_cost=4",
110       # "-c", "effective_io_concurrency=2",
111       # "-c", "work_mem=7864kB",
112       # "-c", "min_wal_size=1GB",
113       # "-c", "max_wal_size=4GB",
114       # "-c", "max_worker_processes=4",
115       # "-c", "max_parallel_workers_per_gather=2",
116       # "-c", "max_parallel_workers=4",
117       # "-c", "max_parallel_maintenance_workers=2",
118     ]
119     networks:
120       - lemmyinternal
121     # adding the external facing network to allow direct db access for devs
122       - lemmyexternalproxy
123     ports:
124     # use a different port so it doesnt conflict with potential postgres db running on the host
125       - "5433:5432"
126     environment:
127       - POSTGRES_USER=lemmy
128       - POSTGRES_PASSWORD=password
129       - POSTGRES_DB=lemmy
130     volumes:
131       - ./volumes/postgres:/var/lib/postgresql/data
132     restart: always
133
134   otel:
135     image: otel/opentelemetry-collector:latest
136     command: --config otel-local-config.yaml
137     networks:
138       - lemmyinternal
139       - lemmyexternalproxy
140     ports:
141       - "4317:4317"
142     volumes:
143       - type: bind
144         source: ./otel.yml
145         target: /otel-local-config.yaml
146     restart: unless-stopped
147     depends_on:
148       - jaeger
149   
150   jaeger:
151     image: jaegertracing/all-in-one:1
152     networks:
153       - lemmyinternal
154       - lemmyexternalproxy
155     ports:
156       - "14250:14250"
157       # To view traces, visit http://localhost:16686
158       - "16686:16686"
159     restart: unless-stopped