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