mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-10-21 13:36:39 +00:00
feat(web-app-gitea): add optional Redis integration for caching, sessions, and queues
This update introduces conditional Redis support for Gitea, allowing connection to either a local or centralized Redis instance depending on configuration. Includes resource limits for the Redis service and corresponding environment variables for cache, session, and queue backends. Reference: ChatGPT conversation on centralized vs per-app Redis architecture (2025-10-15). https://chatgpt.com/share/68ef5930-49c8-800f-b6b8-069e6fefda01
This commit is contained in:
@@ -47,7 +47,17 @@ docker:
|
||||
version: "latest"
|
||||
backup:
|
||||
no_stop_required: true
|
||||
port: 3000
|
||||
name: "gitea"
|
||||
port: 3000
|
||||
name: "gitea"
|
||||
cpus: 1.0
|
||||
mem_reservation: 1g
|
||||
mem_limit: 2g
|
||||
pids_limit: 1024
|
||||
redis:
|
||||
enabled: false
|
||||
cpus: 0.25
|
||||
mem_reservation: 0.2g
|
||||
mem_limit: 0.3g
|
||||
pids_limit: 512
|
||||
volumes:
|
||||
data: "gitea_data"
|
||||
|
@@ -11,7 +11,7 @@ USER_GID=1000
|
||||
|
||||
# Logging configuration
|
||||
GITEA__log__MODE=console
|
||||
GITEA__log__LEVEL={% if MODE_DEBUG | bool %}Debug{% else %}Info{% endif %}
|
||||
GITEA__log__LEVEL={% if MODE_DEBUG | bool %}Debug{% else %}Info{% endif %}
|
||||
|
||||
# Database
|
||||
DB_TYPE=mysql
|
||||
@@ -20,6 +20,28 @@ DB_NAME={{ database_name }}
|
||||
DB_USER={{ database_username }}
|
||||
DB_PASSWD={{ database_password }}
|
||||
|
||||
|
||||
{% if GITEA_REDIS_ENABLED | bool %}
|
||||
# ------------------------------------------------
|
||||
# Redis Configuration for Gitea
|
||||
# ------------------------------------------------
|
||||
# @see https://docs.gitea.com/administration/config-cheat-sheet#cache-cache
|
||||
|
||||
GITEA__cache__ENABLED=true
|
||||
GITEA__cache__ADAPTER=redis
|
||||
# use a different Redis DB index than oauth2-proxy
|
||||
GITEA__cache__HOST=redis://{{ GITEA_REDIS_ADDRESS }}/1
|
||||
|
||||
# Store sessions in Redis (instead of the internal DB)
|
||||
GITEA__session__PROVIDER=redis
|
||||
GITEA__session__PROVIDER_CONFIG=network=tcp,addr={{ GITEA_REDIS_ADDRESS }},db=2,pool_size=100,idle_timeout=180
|
||||
|
||||
# Use Redis for background task queues
|
||||
GITEA__queue__TYPE=redis
|
||||
GITEA__queue__CONN_STR=redis://{{ GITEA_REDIS_ADDRESS }}/3
|
||||
{% endif %}
|
||||
|
||||
|
||||
# SSH
|
||||
SSH_PORT={{ports.public.ssh[application_id]}}
|
||||
SSH_LISTEN_PORT=22
|
||||
|
@@ -22,9 +22,13 @@ GITEA_LDAP_AUTH_ARGS:
|
||||
- '--email-attribute "{{ LDAP.USER.ATTRIBUTES.MAIL }}"'
|
||||
- '--public-ssh-key-attribute "{{ LDAP.USER.ATTRIBUTES.SSH_PUBLIC_KEY }}"'
|
||||
- '--synchronize-users'
|
||||
GITEA_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.version') }}"
|
||||
GITEA_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.image') }}"
|
||||
GITEA_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.name') }}"
|
||||
GITEA_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.data') }}"
|
||||
GITEA_USER: "git"
|
||||
GITEA_CONFIG: "/data/gitea/conf/app.ini"
|
||||
GITEA_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.version') }}"
|
||||
GITEA_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.image') }}"
|
||||
GITEA_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.gitea.name') }}"
|
||||
GITEA_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.data') }}"
|
||||
GITEA_USER: "git"
|
||||
GITEA_CONFIG: "/data/gitea/conf/app.ini"
|
||||
|
||||
## Redis
|
||||
GITEA_REDIS_ENABLED: "{{ applications | get_app_conf(application_id, 'docker.services.redis.enabled') }}"
|
||||
GITEA_REDIS_ADDRESS: "redis:6379"
|
||||
|
Reference in New Issue
Block a user