django-redis Docker & Self-Hosted Deployment

GitHub

Full featured redis cache backend for Django.

3,086 stars Python Python 1 file ยท ~126 tokens
RAW Compose
1. Pull Image (DOCKERHUB) docker pull library/redis
2. Docker Run (1-Click Launch) docker run -d --name django-redis -p 6379:6379 --restart always redis:alpine
3. Podman Run podman run -d --name django-redis -p 6379:6379 --restart always redis:alpine
4. Skopeo Inspect (Zero-Pull Manifest) skopeo inspect docker://docker.io/library/redis:alpine
5. ORAS Pull (OCI Artifact) oras pull redis:alpine
6. Compose Deployment docker compose up -d
tests/compose.yml
Download .yml
services:
  redis:
    image: redis:alpine
    healthcheck:
      test: ['CMD', 'redis-cli', 'ping']
      start_period: 1m
      start_interval: 1s
    ports:
      - 6379:6379

  redis-sentinel:
    command:
      # Force `sh` as the shell as the multiline quoted string below is not
      # being written correctly, and it's not clear what shell is being run.
      - sh
      - -c
      # Generate a sentinel configuration that is writable by the sentinel
      - |
        echo '
        sentinel resolve-hostnames yes
        sentinel monitor redis redis 6379 1
        sentinel down-after-milliseconds redis 3200
        sentinel failover-timeout redis 10000
        sentinel parallel-syncs redis 1
        ' > /etc/redis-sentinel.conf

        exec redis-server /etc/redis-sentinel.conf --sentinel
    depends_on:
      redis:
        condition: service_healthy
    image: redis:alpine
    healthcheck:
      test: ['CMD', 'redis-cli', '-p', '26379', 'ping']
      start_period: 1m
      start_interval: 1s
    ports:
      - 26379:26379