mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-12-15 21:33:05 +00:00
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
37 lines
1.3 KiB
Django/Jinja
37 lines
1.3 KiB
Django/Jinja
# This template needs to be included in docker-compose.yml, which depend on redis
|
|
{% set redis_image = applications | get_app_conf('svc-db-redis', 'docker.services.redis.image') %}
|
|
{% set redis_version = applications | get_app_conf('svc-db-redis', 'docker.services.redis.version')%}
|
|
redis:
|
|
image: "{{ redis_image }}:{{ redis_version }}"
|
|
container_name: {{ application_id | get_entity_name }}-redis
|
|
restart: {{ DOCKER_RESTART_POLICY }}
|
|
logging:
|
|
driver: {{ "json-file" if IS_CONTAINER else 'journald' }}
|
|
volumes:
|
|
- redis:/data
|
|
# Just save in memory and prevent huge redis_volumes
|
|
command:
|
|
- redis-server
|
|
- --appendonly
|
|
- "no"
|
|
- --save
|
|
- ""
|
|
- --maxmemory {{ applications | redis_maxmemory_mb(application_id, 0.8, RESOURCE_MEM_LIMIT | int ) }}mb
|
|
- --maxmemory-policy
|
|
- "allkeys-lru"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 1s
|
|
timeout: 3s
|
|
retries: 30
|
|
networks:
|
|
- default
|
|
{% macro include_resource_for(svc, indent=4) -%}
|
|
{% set service_name = svc -%}
|
|
{%- set _snippet -%}
|
|
{% include 'roles/docker-container/templates/resource.yml.j2' %}
|
|
{%- endset -%}
|
|
{{ _snippet | indent(indent, true) }}
|
|
{%- endmacro %}
|
|
{{ include_resource_for('redis') }}
|
|
{{ "\n" }} |