From 5a18fba9e6e80f69e0efe88db6dd268463c4c5d9 Mon Sep 17 00:00:00 2001 From: Graeme Harris Date: Sat, 31 Dec 2022 01:48:37 +0200 Subject: [PATCH 1/4] Added basic redis + redis insights config for docker and ansible --- ansible/dev.yaml | 18 ++++++++++++++++++ docker-compose.yaml | 27 +++++++++++++++++++++++++++ redis.conf | 2 ++ 3 files changed, 47 insertions(+) create mode 100644 redis.conf diff --git a/ansible/dev.yaml b/ansible/dev.yaml index d022ba3c..53fdc611 100644 --- a/ansible/dev.yaml +++ b/ansible/dev.yaml @@ -32,6 +32,24 @@ - name: oasst-postgres - name: oasst-postgres-web + - name: Setup redis + community.docker.docker_container: + name: "{{ item.name }}" + image: redis + state: started + restart_policy: always + network_mode: oasst + volumes: + - redis:/data + healthcheck: + test: ["CMD-SHELL", "redis-cli ping | grep PONG"] + interval: 2s + timeout: 2s + retries: 10 + ports: + - 6379:6379 + command: redis-server /usr/local/etc/redis/redis.conf + - name: Set up maildev community.docker.docker_container: name: oasst-maildev diff --git a/docker-compose.yaml b/docker-compose.yaml index d329c780..a5b90498 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -27,6 +27,29 @@ services: timeout: 2s retries: 10 + # Redis - caching + rate limiting on BE + redis: + image: redis + restart: always + ports: + - 6379:6379 + healthcheck: + test: ["CMD-SHELL", "redis-cli ping | grep PONG"] + interval: 2s + timeout: 2s + retries : 10 + command: redis-server /usr/local/etc/redis/redis.conf + volumes: + - ./redis.conf:/usr/local/etc/redis/redis.conf + - redis:/data + # insights host - redis:6379 + redis-insights: + image: redislabs/redisinsight:latest + ports: + - 8001:8001 + volumes: + - redis:/data + # This DB is for Web Authentication and data caching. webdb: image: postgres @@ -100,3 +123,7 @@ services: ports: - "3000:3000" command: bash wait-for-postgres.sh node server.js + +volumes: + redis: + driver: local diff --git a/redis.conf b/redis.conf new file mode 100644 index 00000000..c06efe47 --- /dev/null +++ b/redis.conf @@ -0,0 +1,2 @@ +maxmemory 100mb +maxmemory-policy allkeys-lru \ No newline at end of file From 743de0bb18da1f06061630fbcf4eb9cdaa781b90 Mon Sep 17 00:00:00 2001 From: Graeme Harris Date: Sat, 31 Dec 2022 01:49:34 +0200 Subject: [PATCH 2/4] Linting + prettier --- docker-compose.yaml | 2 +- redis.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index a5b90498..27f5d741 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -37,7 +37,7 @@ services: test: ["CMD-SHELL", "redis-cli ping | grep PONG"] interval: 2s timeout: 2s - retries : 10 + retries: 10 command: redis-server /usr/local/etc/redis/redis.conf volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf diff --git a/redis.conf b/redis.conf index c06efe47..58da1e05 100644 --- a/redis.conf +++ b/redis.conf @@ -1,2 +1,2 @@ maxmemory 100mb -maxmemory-policy allkeys-lru \ No newline at end of file +maxmemory-policy allkeys-lru From 3bb0b04f92c8040ac26b5aebf061d9b911245af6 Mon Sep 17 00:00:00 2001 From: Graeme Harris Date: Sat, 31 Dec 2022 12:56:09 +0200 Subject: [PATCH 3/4] Removed local volume from redis image --- docker-compose.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 27f5d741..ed72c820 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -41,14 +41,11 @@ services: command: redis-server /usr/local/etc/redis/redis.conf volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf - - redis:/data # insights host - redis:6379 redis-insights: image: redislabs/redisinsight:latest ports: - 8001:8001 - volumes: - - redis:/data # This DB is for Web Authentication and data caching. webdb: @@ -123,7 +120,3 @@ services: ports: - "3000:3000" command: bash wait-for-postgres.sh node server.js - -volumes: - redis: - driver: local From 10724411eb139204a7bf435df1312fd5fc16fde3 Mon Sep 17 00:00:00 2001 From: Graeme Harris Date: Sun, 1 Jan 2023 13:37:01 +0200 Subject: [PATCH 4/4] Removed redis from ansible for now --- ansible/dev.yaml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/ansible/dev.yaml b/ansible/dev.yaml index 53fdc611..d022ba3c 100644 --- a/ansible/dev.yaml +++ b/ansible/dev.yaml @@ -32,24 +32,6 @@ - name: oasst-postgres - name: oasst-postgres-web - - name: Setup redis - community.docker.docker_container: - name: "{{ item.name }}" - image: redis - state: started - restart_policy: always - network_mode: oasst - volumes: - - redis:/data - healthcheck: - test: ["CMD-SHELL", "redis-cli ping | grep PONG"] - interval: 2s - timeout: 2s - retries: 10 - ports: - - 6379:6379 - command: redis-server /usr/local/etc/redis/redis.conf - - name: Set up maildev community.docker.docker_container: name: oasst-maildev