From 031f7b96acceb7dcdd157554fd111f16abbacdec Mon Sep 17 00:00:00 2001 From: Kevin Meinhardt Date: Tue, 5 Nov 2024 15:40:54 +0100 Subject: [PATCH] Remove redunant docker volumes, remove shared docker volumes, remove renew-anon-volumes, strict filter on volume cleaning (#22780) --- Makefile-os | 7 +++++-- docker-compose.ci.yml | 2 -- docker-compose.yml | 29 +++-------------------------- docker/nginx/addons.conf | 2 +- 4 files changed, 9 insertions(+), 31 deletions(-) diff --git a/Makefile-os b/Makefile-os index 39174affdc..0af7990eb8 100644 --- a/Makefile-os +++ b/Makefile-os @@ -133,8 +133,11 @@ docker_compose_down: ## Stop the docker containers docker compose down --rmi local --remove-orphans --volumes .PHONY: docker_clean_volumes -docker_clean_volumes: ## Remove dangling volumes - docker volume prune --force +docker_clean_volumes: ## Remove dangling volumes, skipping the mysqld volume + docker volume prune \ + --filter label=com.docker.compose.project=addons-server \ + --all \ + --force .PHONY: docker_clean_images docker_clean_images: ## Remove dangling images diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 72863e4377..519116402e 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -9,5 +9,3 @@ services: extends: service: worker -volumes: - data_olympia: diff --git a/docker-compose.yml b/docker-compose.yml index 27eb9eca3e..480e955add 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,12 +52,11 @@ services: "celery -A olympia.amo.celery:app worker -E -c 2 --loglevel=INFO", ] volumes: - - data_olympia:/data/olympia + - .:/data/olympia # Don't mount generated files. They only exist in the container - # and would otherwiser be deleted by mounbting data_olympia + # and would otherwiser be deleted by mounting the cwd volume above - /data/olympia/static-build - /data/olympia/site-static - - storage:/data/olympia/storage - ./package.json:/deps/package.json - ./package-lock.json:/deps/package-lock.json extra_hosts: @@ -99,8 +98,7 @@ services: image: nginx volumes: - ./docker/nginx/addons.conf:/etc/nginx/conf.d/addons.conf - - ./static:/srv/static - - storage:/srv/user-media + - .:/srv ports: - "80:80" networks: @@ -143,13 +141,9 @@ services: - "discovery.type=single-node" - "ES_JAVA_OPTS=-Xms512m -Xmx512m" mem_limit: 2g - volumes: - - data_elasticsearch:/usr/share/elasticsearch/data redis: image: redis:6.2 - volumes: - - data_redis:/data rabbitmq: image: rabbitmq:3.12 @@ -160,8 +154,6 @@ services: - RABBITMQ_DEFAULT_USER=olympia - RABBITMQ_DEFAULT_PASS=olympia - RABBITMQ_DEFAULT_VHOST=olympia - volumes: - - data_rabbitmq:/var/lib/rabbitmq autograph: image: mozilla/autograph:3.3.2 @@ -191,23 +183,8 @@ networks: default: volumes: - data_redis: - data_elasticsearch: data_mysqld: # Keep this value in sync with Makefile-os # External volumes must be manually created/destroyed name: addons-server_data_mysqld external: true - data_rabbitmq: - data_olympia: - driver: local - driver_opts: - type: none - o: bind - device: ${PWD} - storage: - driver: local - driver_opts: - type: none - o: bind - device: ./storage diff --git a/docker/nginx/addons.conf b/docker/nginx/addons.conf index 3948258aa4..d4493caee7 100644 --- a/docker/nginx/addons.conf +++ b/docker/nginx/addons.conf @@ -20,7 +20,7 @@ server { } location /user-media/ { - alias /srv/user-media/shared_storage/uploads/; + alias /srv/storage/shared_storage/uploads/; } location ~ ^/api/ {