adding redis support for shinyproxy

This commit is contained in:
Marco Procaccini 2025-07-21 13:06:10 +02:00
parent 0c85d7a90a
commit 88b23a2fa9
6 changed files with 83 additions and 0 deletions

View File

@ -125,3 +125,13 @@ shinyproxy_max_log_size: 20MB
# Springboot options
shinyproxy_max_file_size: 10MB
shinyproxy_max_request_size: "{{ shinyproxy_max_file_size }}"
# REDIS for shinyproxy
shinyproxy_redis_installation: false
shinyproxy_redis_image: "redis:bookworm"
# shinyproxy_redis_compose_dir: "/srv/shinyproxy_redis_stack"
# shinyproxy_redis_docker_stack_name: ""
# shinyproxy_redis_docker_network:""
# shinyproxy_redis_service_name: ""
# shinyproxy_redis_user: ""
# shinyproxy_redis_password: ""

View File

@ -9,6 +9,12 @@
- shinyproxy_container_backend == 'docker'
- name: Shinyproxy as a Docker Swarm stack
ansible.builtin.import_tasks: shinyproxy_docker_stack_service.yml
when:
- shinyproxy_as_docker_service
- shinyproxy_container_backend == 'docker-swarm
- name: Shiniproxy REDIS service as docker swarm stack'
ansible.builtin.import_tasks: shinyproxy_redis_service.yml
when:
- shinyproxy_as_docker_service
- shinyproxy_container_backend == 'docker-swarm'
- shinyproxy_redis_installation

View File

@ -30,3 +30,4 @@
community.docker.docker_compose:
project_src: '{{ shinyproxy_as_docker_src_dir }}'
build: true

View File

@ -0,0 +1,27 @@
---
- name: Manage the installation of the REDIS service
run_once: true
tags: shinyproxy_redis
block:
- name: Create the compose directory for the REDIS Swarm stack
ansible.builtin.file:
dest: "{{ shinyproxy_redis_compose_dir }}"
state: directory
owner: root
group: root
mode: "0700"
- name: Install the docker compose file of the REDIS Swarm stack
ansible.builtin.template:
src: shinyproxy-redis-docker-compose.yml.j2
dest: "{{ redis_compose_dir }}/shinyproxy-redis-docker-compose.yml"
owner: root
group: root
mode: "0400"
- name: Start the REDIS Swarm stack
community.docker.docker_stack:
name: "{{ shinyproxy_redis_docker_stack_name }}"
state: present
compose:
- "{{ shinyproxy_redis_compose_dir }}/shinyproxy-redis-docker-compose.yml"

View File

@ -208,8 +208,24 @@ spring:
multipart:
max-file-size: {{ shinyproxy_max_file_size }}
max-request-size: {{ shinyproxy_max_request_size }}
{% if shinyproxy_redis_installation is true %}
session:
store-type: redis
redis:
host: {{ shinyproxy_redis_service_name | default('redis') }}
port: {{ shinyproxy_redis_port | default(6379) }}
{% if redis_username is defined %}
username: {{ shinyproxy_redis_username }}
{% endif %}
{% if redis_password is defined %}
password: {{ shinyproxy_redis_password }}
{% endif %}
{% endif %}
{% endif %}
logging:
file: {{ shinyproxy_log_dir }}/shinyproxy.log
#max-size: {{ shinyproxy_max_log_size }}

View File

@ -0,0 +1,23 @@
services:
{{ shinyproxy_redis_service_name }}:
image: {{ shiniproxy_redis_image }}
networks:
- haproxy-public
- {{ shinyproxy_redis_docker_network }}
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: any
delay: 5s
window: 120s
placement:
constraints: [node.role == worker]
logging:
driver: "journald"
networks:
haproxy-public:
external: true
{{ shinyproxy_redis_docker_network }}:
external: true