diff --git a/redis_dev/README.md b/redis_dev/README.md index bf9d4e1..72fa091 100644 --- a/redis_dev/README.md +++ b/redis_dev/README.md @@ -1,5 +1,62 @@ -# redis +# Redis ## Overview -Docker Hub: https://hub.docker.com/_/redis +Redis is an open-source in-memory data structure store used as a database, cache, and message broker. It's highly popular for its performance and versatility. + +## Project Details + +- **Project Repository:** https://github.com/redis/redis +- **Container Image:** [Docker Hub](https://hub.docker.com/_/redis) +- **Compose Example:** [Redis Docker Compose](https://github.com/redis/redis/tree/7.0/utils#docker) +- **Documentation:** [Redis Docs](https://redis.io/docs/) +- **Reverse Proxy Port:** `6379` + +## Getting Started + +1. Start the container: `docker compose up -d` +2. Connect to Redis using: `redis-cli -h localhost -p 6379` + +## Environment Variable Notes + +- `REDIS_IMAGE` – Redis Docker image to use (default: `redis:alpine`) +- `REDIS_PORT` – Redis port to expose (default: `6379`) +- `TZ` – Timezone for container (default: `UTC`) + +## Volume Notes + +- `/data` – Persistent Redis data directory ( stores Redis data on disk via save configuration) + +## Network Notes + +Requires proxy network + +## Docker Run + +```bash +docker run -d \ + --name redis \ + -e REDIS_IMAGE=redis:alpine \ + -e REDIS_PORT=6379 \ + -e TZ=UTC \ + -v ${VOL_PATH:-/data}/redis:/data \ + -p 6379:6379 \ + redis:alpine +``` + +## Additional Notes / Gotchas + +- Make sure to configure persistence in your Redis setup using the `save` configuration +- Use `docker compose exec redis redis-cli` to access the running container +- Remember to set a strong `redis-cli` password if using Redis in production + +## Dockhand Stack, Deploy from Git + +Cookbooks Repository +stackname: redis +Compose file path: redis_dev/compose.yaml +Additional env file (optional): redis_dev/sample.env + +Then "Load" redis_dev/sample.env into the Environmental variables in dockhand + +Create the Stack diff --git a/redis_dev/compose.yaml b/redis_dev/compose.yaml new file mode 100644 index 0000000..5ea31c0 --- /dev/null +++ b/redis_dev/compose.yaml @@ -0,0 +1,25 @@ +services: + redis: + image: ${REDIS_IMAGE:-redis:alpine} + restart: ${REDIS_RESTART:-unless-stopped} + volumes: + - ${VOL_PATH:-/data}/redis:/data + - /etc/localtime:/etc/localtime:ro + environment: + - TZ=${TZ:-UTC} + ports: + - "${REDIS_PORT:-6379}:6379" + networks: + - proxy + - internal + depends_on: + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: ${REDIS_HEALTHCHECK_INTERVAL:-20s} + timeout: ${REDIS_HEALTHCHECK_TIMEOUT:-3s} + +networks: + proxy: + external: true + internal: + internal: true diff --git a/redis_dev/docker-compose.yml b/redis_dev/docker-compose.yml deleted file mode 100644 index acdd59c..0000000 --- a/redis_dev/docker-compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -services: - redis: - image: ${REDIS_IMAGE:-redis:alpine} - restart: unless-stopped - healthcheck: - test: ["CMD", "redis-cli", "ping"] - interval: 20s - timeout: 3s diff --git a/redis_dev/sample.env b/redis_dev/sample.env index 7ddaa0f..934f1e8 100644 --- a/redis_dev/sample.env +++ b/redis_dev/sample.env @@ -1,5 +1,9 @@ - COOKBOOK=/git/docker-compose-cookbooks #HELP: cookbooks # redis REDIS_IMAGE=redis:alpine +REDIS_PORT=6379 +TZ=UTC +REDIS_RESTART=unless-stopped +REDIS_HEALTHCHECK_INTERVAL=20s +REDIS_HEALTHCHECK_TIMEOUT=3s