Make volumes used in docker compose work when running on machines with SELinux enabled (#2853)

* Make volumes used in docker compose work when running on machines with SELinux enabled

* Switch lemmy-ui comments

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
SleeplessOne1917 2023-05-12 00:15:12 +00:00 committed by GitHub
parent af5175a282
commit 0379c9e4c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 41 deletions

View file

@ -15,11 +15,11 @@ services:
- lemmyinternal - lemmyinternal
- lemmyexternalproxy - lemmyexternalproxy
ports: ports:
# actual and only port facing any connection from outside # actual and only port facing any connection from outside
- "1236:1236" - "1236:1236"
- "8536:8536" - "8536:8536"
volumes: volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro - ./nginx.conf:/etc/nginx/nginx.conf:ro,Z
restart: always restart: always
depends_on: depends_on:
- pictrs - pictrs
@ -29,10 +29,10 @@ services:
# image: dessalines/lemmy:dev # image: dessalines/lemmy:dev
# use this to build your local lemmy server image for development # use this to build your local lemmy server image for development
# run docker compose up --build # run docker compose up --build
build: build:
context: ../ context: ../
dockerfile: docker/Dockerfile dockerfile: docker/Dockerfile
# args: # args:
# RUST_RELEASE_MODE: release # RUST_RELEASE_MODE: release
# this hostname is used in nginx reverse proxy and also for lemmy ui to connect to the backend, do not change # this hostname is used in nginx reverse proxy and also for lemmy ui to connect to the backend, do not change
hostname: lemmy hostname: lemmy
@ -43,7 +43,7 @@ services:
- 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" - 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"
- RUST_BACKTRACE=full - RUST_BACKTRACE=full
volumes: volumes:
- ./lemmy.hjson:/config/config.hjson - ./lemmy.hjson:/config/config.hjson:Z
depends_on: depends_on:
- postgres - postgres
- pictrs - pictrs
@ -53,9 +53,9 @@ services:
# use this to build your local lemmy ui image for development # use this to build your local lemmy ui image for development
# run docker compose up --build # run docker compose up --build
# assuming lemmy-ui is cloned besides lemmy directory # assuming lemmy-ui is cloned besides lemmy directory
# build: # build:
# context: ../../lemmy-ui # context: ../../lemmy-ui
# dockerfile: dev.dockerfile # dockerfile: dev.dockerfile
networks: networks:
- lemmyinternal - lemmyinternal
environment: environment:
@ -89,7 +89,7 @@ services:
- PICTRS__MEDIA__GIF__MAX_FRAME_COUNT=400 - PICTRS__MEDIA__GIF__MAX_FRAME_COUNT=400
user: 991:991 user: 991:991
volumes: volumes:
- ./volumes/pictrs:/mnt - ./volumes/pictrs:/mnt:Z
restart: always restart: always
postgres: postgres:
@ -100,26 +100,31 @@ services:
# You can use this technique to add them here # You can use this technique to add them here
# https://stackoverflow.com/a/30850095/1655478 # https://stackoverflow.com/a/30850095/1655478
hostname: postgres hostname: postgres
command: [ command:
"postgres", [
"-c", "session_preload_libraries=auto_explain", "postgres",
"-c", "auto_explain.log_min_duration=5ms", "-c",
"-c", "auto_explain.log_analyze=true", "session_preload_libraries=auto_explain",
"-c", "track_activity_query_size=1048576" "-c",
] "auto_explain.log_min_duration=5ms",
"-c",
"auto_explain.log_analyze=true",
"-c",
"track_activity_query_size=1048576",
]
networks: networks:
- lemmyinternal - lemmyinternal
# adding the external facing network to allow direct db access for devs # adding the external facing network to allow direct db access for devs
- lemmyexternalproxy - lemmyexternalproxy
ports: ports:
# use a different port so it doesnt conflict with potential postgres db running on the host # use a different port so it doesnt conflict with potential postgres db running on the host
- "5433:5432" - "5433:5432"
environment: environment:
- POSTGRES_USER=lemmy - POSTGRES_USER=lemmy
- POSTGRES_PASSWORD=password - POSTGRES_PASSWORD=password
- POSTGRES_DB=lemmy - POSTGRES_DB=lemmy
volumes: volumes:
- ./volumes/postgres:/var/lib/postgresql/data - ./volumes/postgres:/var/lib/postgresql/data:Z
restart: always restart: always
otel: otel:
@ -131,13 +136,11 @@ services:
ports: ports:
- "4317:4317" - "4317:4317"
volumes: volumes:
- type: bind - ./otel.yaml:/otel-local-config.yaml:Z
source: ./otel.yml
target: /otel-local-config.yaml
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- jaeger - jaeger
jaeger: jaeger:
image: jaegertracing/all-in-one:1 image: jaegertracing/all-in-one:1
networks: networks:

View file

@ -1,4 +1,4 @@
version: '3.3' version: "3.3"
services: services:
nginx: nginx:
@ -10,7 +10,7 @@ services:
- "8570:8570" - "8570:8570"
- "8580:8580" - "8580:8580"
volumes: volumes:
- ./nginx.conf:/etc/nginx/nginx.conf - ./nginx.conf:/etc/nginx/nginx.conf:Z
restart: always restart: always
depends_on: depends_on:
- pictrs - pictrs
@ -25,7 +25,7 @@ services:
image: asonix/pictrs:0.4.0-beta.19 image: asonix/pictrs:0.4.0-beta.19
user: 991:991 user: 991:991
volumes: volumes:
- ./volumes/pictrs_alpha:/mnt - ./volumes/pictrs_alpha:/mnt:Z
lemmy-alpha-ui: lemmy-alpha-ui:
image: dessalines/lemmy-ui:0.17.1 image: dessalines/lemmy-ui:0.17.1
@ -38,14 +38,14 @@ services:
lemmy-alpha: lemmy-alpha:
image: lemmy-federation:latest image: lemmy-federation:latest
volumes: volumes:
- ./lemmy_alpha.hjson:/config/config.hjson - ./lemmy_alpha.hjson:/config/config.hjson:Z
environment: environment:
- RUST_BACKTRACE=1 - RUST_BACKTRACE=1
- 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" - 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"
depends_on: depends_on:
- postgres_alpha - postgres_alpha
restart: always restart: always
ports: ports:
- "8541:8541" - "8541:8541"
postgres_alpha: postgres_alpha:
image: postgres:15-alpine image: postgres:15-alpine
@ -55,7 +55,7 @@ services:
- POSTGRES_DB=lemmy - POSTGRES_DB=lemmy
restart: always restart: always
volumes: volumes:
- ./volumes/postgres_alpha:/var/lib/postgresql/data - ./volumes/postgres_alpha:/var/lib/postgresql/data:Z
lemmy-beta-ui: lemmy-beta-ui:
image: dessalines/lemmy-ui:0.17.1 image: dessalines/lemmy-ui:0.17.1
@ -68,14 +68,14 @@ services:
lemmy-beta: lemmy-beta:
image: lemmy-federation:latest image: lemmy-federation:latest
volumes: volumes:
- ./lemmy_beta.hjson:/config/config.hjson - ./lemmy_beta.hjson:/config/config.hjson:Z
environment: environment:
- RUST_BACKTRACE=1 - RUST_BACKTRACE=1
- 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" - 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"
depends_on: depends_on:
- postgres_beta - postgres_beta
restart: always restart: always
ports: ports:
- "8551:8551" - "8551:8551"
postgres_beta: postgres_beta:
image: postgres:15-alpine image: postgres:15-alpine
@ -85,7 +85,7 @@ services:
- POSTGRES_DB=lemmy - POSTGRES_DB=lemmy
restart: always restart: always
volumes: volumes:
- ./volumes/postgres_beta:/var/lib/postgresql/data - ./volumes/postgres_beta:/var/lib/postgresql/data:Z
lemmy-gamma-ui: lemmy-gamma-ui:
image: dessalines/lemmy-ui:0.17.1 image: dessalines/lemmy-ui:0.17.1
@ -98,14 +98,14 @@ services:
lemmy-gamma: lemmy-gamma:
image: lemmy-federation:latest image: lemmy-federation:latest
volumes: volumes:
- ./lemmy_gamma.hjson:/config/config.hjson - ./lemmy_gamma.hjson:/config/config.hjson:Z
environment: environment:
- RUST_BACKTRACE=1 - RUST_BACKTRACE=1
- 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" - 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"
depends_on: depends_on:
- postgres_gamma - postgres_gamma
restart: always restart: always
ports: ports:
- "8561:8561" - "8561:8561"
postgres_gamma: postgres_gamma:
image: postgres:15-alpine image: postgres:15-alpine
@ -115,7 +115,7 @@ services:
- POSTGRES_DB=lemmy - POSTGRES_DB=lemmy
restart: always restart: always
volumes: volumes:
- ./volumes/postgres_gamma:/var/lib/postgresql/data - ./volumes/postgres_gamma:/var/lib/postgresql/data:Z
# An instance with only an allowlist for beta # An instance with only an allowlist for beta
lemmy-delta-ui: lemmy-delta-ui:
@ -129,14 +129,14 @@ services:
lemmy-delta: lemmy-delta:
image: lemmy-federation:latest image: lemmy-federation:latest
volumes: volumes:
- ./lemmy_delta.hjson:/config/config.hjson - ./lemmy_delta.hjson:/config/config.hjson:Z
environment: environment:
- RUST_BACKTRACE=1 - RUST_BACKTRACE=1
- 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" - 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"
depends_on: depends_on:
- postgres_delta - postgres_delta
restart: always restart: always
ports: ports:
- "8571:8571" - "8571:8571"
postgres_delta: postgres_delta:
image: postgres:15-alpine image: postgres:15-alpine
@ -146,7 +146,7 @@ services:
- POSTGRES_DB=lemmy - POSTGRES_DB=lemmy
restart: always restart: always
volumes: volumes:
- ./volumes/postgres_delta:/var/lib/postgresql/data - ./volumes/postgres_delta:/var/lib/postgresql/data:Z
# An instance who has a blocklist, with lemmy-alpha blocked # An instance who has a blocklist, with lemmy-alpha blocked
lemmy-epsilon-ui: lemmy-epsilon-ui:
@ -160,14 +160,14 @@ services:
lemmy-epsilon: lemmy-epsilon:
image: lemmy-federation:latest image: lemmy-federation:latest
volumes: volumes:
- ./lemmy_epsilon.hjson:/config/config.hjson - ./lemmy_epsilon.hjson:/config/config.hjson:Z
environment: environment:
- RUST_BACKTRACE=1 - RUST_BACKTRACE=1
- 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" - 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"
depends_on: depends_on:
- postgres_epsilon - postgres_epsilon
restart: always restart: always
ports: ports:
- "8581:8581" - "8581:8581"
postgres_epsilon: postgres_epsilon:
image: postgres:15-alpine image: postgres:15-alpine
@ -177,4 +177,4 @@ services:
- POSTGRES_DB=lemmy - POSTGRES_DB=lemmy
restart: always restart: always
volumes: volumes:
- ./volumes/postgres_epsilon:/var/lib/postgresql/data - ./volumes/postgres_epsilon:/var/lib/postgresql/data:Z