From 7008c365a65fb601435607e745e7c56305eb4ccd Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Tue, 22 Nov 2022 21:53:21 +0000 Subject: [PATCH] Begin modernising Docker files --- docker-compose.yml | 28 ++++++++++++++++++++++------ docker/docker-compose.prod.yml | 32 ++++++++++++++++++++++++-------- docker/redis.conf | 2 +- 3 files changed, 47 insertions(+), 15 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 563287a..e46123d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,7 @@ version: "2" services: app: image: pathogen/neptune:latest + container_name: neptune build: ./docker volumes: - ${PORTAINER_GIT_DIR}:/code @@ -19,9 +20,14 @@ services: condition: service_healthy migration: condition: service_started + networks: + - default + - pathogen + - elastic migration: image: pathogen/neptune:latest + container_name: migration_neptune command: sh -c '. /venv/bin/activate && python manage.py migrate --noinput' volumes: - ${PORTAINER_GIT_DIR}:/code @@ -44,24 +50,34 @@ services: tmp: image: busybox - command: chmod -R 777 /var/run/redis + container_name: tmp_neptune + command: chmod -R 777 /var/run/socks volumes: - - /var/run/redis + - /var/run/socks redis: image: redis + container_name: redis_neptune command: redis-server /etc/redis.conf + ulimits: + nproc: 65535 + nofile: + soft: 65535 + hard: 65535 volumes: - ${PORTAINER_GIT_DIR}/docker/redis.conf:/etc/redis.conf volumes_from: - tmp healthcheck: - test: "redis-cli -s /var/run/redis/redis.sock ping" + test: "redis-cli -s /var/run/socks/redis.sock ping" interval: 2s timeout: 2s retries: 15 networks: - default: - external: - name: pathogen \ No newline at end of file + default: + driver: bridge + pathogen: + external: true + elastic: + external: true \ No newline at end of file diff --git a/docker/docker-compose.prod.yml b/docker/docker-compose.prod.yml index 866f748..c488a1c 100644 --- a/docker/docker-compose.prod.yml +++ b/docker/docker-compose.prod.yml @@ -1,8 +1,9 @@ -version: "2" - +version: "2.2" + services: app: image: pathogen/neptune:latest + container_name: neptune build: ./docker/prod volumes: - ${PORTAINER_GIT_DIR}:/code @@ -20,9 +21,14 @@ services: condition: service_healthy migration: condition: service_started + networks: + - default + - pathogen + - elastic migration: image: pathogen/neptune:latest + container_name: migration_neptune build: ./docker/prod command: sh -c '. /venv/bin/activate && python manage.py migrate --noinput' volumes: @@ -37,24 +43,34 @@ services: tmp: image: busybox - command: chmod -R 777 /var/run/redis + container_name: tmp_neptune + command: chmod -R 777 /var/run/socks volumes: - - /var/run/redis + - /var/run/socks redis: image: redis + container_name: redis_neptune command: redis-server /etc/redis.conf + ulimits: + nproc: 65535 + nofile: + soft: 65535 + hard: 65535 volumes: - ${PORTAINER_GIT_DIR}/docker/redis.conf:/etc/redis.conf volumes_from: - tmp healthcheck: - test: "redis-cli -s /var/run/redis/redis.sock ping" + test: "redis-cli -s /var/run/socks/redis.sock ping" interval: 2s timeout: 2s retries: 15 networks: - default: - external: - name: pathogen \ No newline at end of file + default: + driver: bridge + pathogen: + external: true + elastic: + external: true \ No newline at end of file diff --git a/docker/redis.conf b/docker/redis.conf index 46366bf..424a612 100644 --- a/docker/redis.conf +++ b/docker/redis.conf @@ -1,2 +1,2 @@ -unixsocket /var/run/redis/redis.sock +unixsocket /var/run/socks/redis.sock unixsocketperm 777 \ No newline at end of file