Files
computer-playbook/roles/svc-db-redis
Kevin Veen-Birkenbach c0980e91c0 Fix CI Docker-in-Docker deployment, introduce vfs storage-driver, add inner dockerd bootstrap, enable portable json-file logging when running inside a container, and update workflow triggers for multi-branch testing.
Includes:
- Rewrite of test-deploy workflow to use isolated inner dockerd with privileged mode.
- Switch logging drivers to 'json-file' when IS_CONTAINER=true for compatibility with non-systemd CI runners.
- Adjust Dockerfile to install docker CLI and simplify package setup.
- Improve inventory creation and deploy steps for CI stability.
- Fully compatible with Ansible 2.20 variable handling.

Conversation reference:
https://chatgpt.com/share/6930e285-9604-800f-aad8-7a81c928548c
2025-12-04 02:24:10 +01:00
..

Redis

Description

This Ansible role provides a Jinja2 snippet to inject a Redis service definition into your Docker Compose setup. It renders a service.yml.j2 template that defines a redis container with sensible defaults.

Overview

The roles service.yml.j2 template includes:

  • An Alpine-based Redis image (redis:alpine)

  • Container naming based on application_id (defaults to redis)

  • Restart policy

  • Journald logging driver

  • A named volume (redis:/data) for persistence

  • A basic healthcheck using redis-cli ping

  • Attachment to the default network

Include this snippet in your top-level docker-compose.yml.j2 where you want Redis to appear.

Features

  • Configurable application_id
    Sets container name ({{ application_id }}-redis).

  • Restart policy
    Controlled by DOCKER_RESTART_POLICY.

  • Journald logging
    Ensures logs are captured by systemds journal.

  • Persistent storage
    Declares and mounts redis:/data.

  • Built-in healthcheck
    Uses redis-cli ping with configurable intervals and retries.

Further Resources