Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: connect to redis sentinel for redis cache (backport #25398) #25449

Merged
merged 2 commits into from
Mar 15, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Mar 14, 2024

Please provide enough information so that others can review your pull request:

Use redis sentinel for redis cache connection. It is setup for production only using extra keys from common_site_config.json

Explain the details for making this change. What existing problem does the pull request solve?

At the moment we can connect to single redis master for cache. With this we can connect to sentinel cluster.

https://redis.io/docs/management/sentinel

To try it with frappe_docker/devcontainer make following changes to .devcontainer/docker-compose.yml

version: "3.7"
services:
  mariadb:
    image: docker.io/mariadb:10.6
    command:
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
      - --skip-character-set-client-handshake
      - --skip-innodb-read-only-compressed # Temporary fix for MariaDB 10.6
    environment:
      - MYSQL_ROOT_PASSWORD=123
    volumes:
      - mariadb-data:/var/lib/mysql

  redis-cache:
    image: redis:alpine

  redis-queue:
    image: redis:alpine


## Change begins here ##
  redis-cache-sentinel:
    image: docker.io/bitnami/redis-sentinel:7.2
    environment:
      - REDIS_SENTINEL_PASSWORD=sentinelpassword
      - REDIS_MASTER_HOST=redis-cache-master
      - REDIS_MASTER_PASSWORD=masterpassword

  redis-cache-master:
    image: docker.io/bitnami/redis:7.2
    environment:
      - REDIS_PASSWORD=masterpassword
## Change ends here ##

  frappe:
    image: docker.io/frappe/bench:latest
    command: sleep infinity
    environment:
      - SHELL=/bin/bash
    volumes:
      - ..:/workspace:cached
      - ${HOME}/.ssh:/home/frappe/.ssh
    working_dir: /workspace/development
    ports:
      - 8000-8005:8000-8005
      - 9000-9005:9000-9005

volumes:
  mariadb-data:

add redis_cache_* keys to common_site_config.json

{
 "background_workers": 1,
 "db_host": "mariadb",
 "db_type": "mariadb",
 "developer_mode": 1,
 "file_watcher_port": 6788,
 "frappe_user": "frappe",
 "gunicorn_workers": 25,
 "live_reload": true,
 "rebase_on_pull": false,
 "redis_socketio": "redis://redis-queue:6379",
 "redis_cache": "redis://redis-cache:6379",
 "redis_cache_sentinel_enabled": 1,
 "redis_cache_sentinels": ["redis-cache-sentinel:26379"],
 "redis_cache_sentinel_password": "sentinelpassword",
 "redis_cache_master_service": "mymaster",
 "redis_cache_master_password": "masterpassword",
 "redis_queue": "redis://redis-queue:6379",
 "restart_supervisor_on_update": false,
 "restart_systemd_on_update": false,
 "serve_default_site": true,
 "shallow_clone": true,
 "socketio_port": 9000,
 "use_redis_auth": false,
 "webserver_port": 8000
}

Note: Nothing has changed to the redis_cache key. It will be used during development setup by bench watch command.

Screenshots/GIFs

To do:

  • Docs

This is an automatic backport of pull request #25398 done by [Mergify](https://mergify.com).

(cherry picked from commit 77618cd)

# Conflicts:
#	frappe/__init__.py
#	frappe/utils/redis_wrapper.py
@mergify mergify bot requested a review from a team as a code owner March 14, 2024 14:00
@mergify mergify bot requested review from akhilnarang and removed request for a team March 14, 2024 14:00
@mergify mergify bot added the conflicts label Mar 14, 2024
@mergify mergify bot assigned revant Mar 14, 2024
Copy link
Contributor Author

mergify bot commented Mar 14, 2024

Cherry-pick of 77618cd has failed:

On branch mergify/bp/version-14-hotfix/pr-25398
Your branch is up to date with 'origin/version-14-hotfix'.

You are currently cherry-picking commit 77618cde1f.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   frappe/__init__.py
	both modified:   frappe/utils/redis_wrapper.py

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@ankush ankush removed the conflicts label Mar 15, 2024
@ankush ankush merged commit 6ce4036 into version-14-hotfix Mar 15, 2024
9 of 10 checks passed
@ankush ankush deleted the mergify/bp/version-14-hotfix/pr-25398 branch March 15, 2024 09:33
frappe-pr-bot pushed a commit that referenced this pull request Mar 19, 2024
# [14.68.0](v14.67.1...v14.68.0) (2024-03-19)

### Bug Fixes

* allow exporting large reports that can't be rendered (backport [#25395](#25395)) ([#25404](#25404)) ([b3f4d5d](b3f4d5d))
* allow transitioning to long text (backport [#25419](#25419)) ([#25474](#25474)) ([60d8c1c](60d8c1c))
* avoid closing filter popover on any date picker interactions ([0784e61](0784e61))
* Avoid setting filter on now/today button ([83766c0](83766c0))
* child table rating fields ([#25433](#25433)) ([#25435](#25435)) ([57cf161](57cf161))
* consider all datepicker elements ([#25426](#25426)) ([ad79301](ad79301))
* debounce filter refresh ([7f65916](7f65916))
* don't allow setting an invalid rating ([#22633](#22633)) ([#25432](#25432)) ([502b907](502b907))
* dont add trailing decimal separator ([#25389](#25389)) ([#25390](#25390)) ([08e8d8c](08e8d8c))
* escape text types before setting disp area ([#25520](#25520)) ([#25522](#25522)) ([e446770](e446770))
* escape value in multiselect pill ([#25516](#25516)) ([#25517](#25517)) ([dbcf783](dbcf783))
* filters can use more than 140 chars ([d04bff9](d04bff9))
* handle distinct for fieldname (backport [#25511](#25511)) ([#25514](#25514)) ([3344df0](3344df0))
* handle parent rename in child workspace ([c3d9e1f](c3d9e1f))
* hide datepicker after picking date ([39796ea](39796ea))
* Log ipython commands (backport [#25364](#25364)) ([#25367](#25367)) ([997628c](997628c))
* log mariadb console usage ([6f4981c](6f4981c))
* show attachments on notifications too ([#25443](#25443)) ([#25448](#25448)) ([3251586](3251586))
* skip virtual doctype in tags ([b2ae437](b2ae437))
* Skip virtual doctype rename for dynamic links ([#25479](#25479)) ([#25480](#25480)) ([f368236](f368236))
* Skip virtual doctypes while renaming ([#25473](#25473)) ([#25477](#25477)) ([c423223](c423223))
* validate homepage paths (backport [#25409](#25409)) ([#25411](#25411)) ([ee1c8e3](ee1c8e3))

### Features

* connect to redis sentinel for redis cache (backport [#25398](#25398)) ([#25449](#25449)) ([6ce4036](6ce4036))
* debug stuck process by sending SIGUSR1 (backport [#25502](#25502)) ([#25526](#25526)) ([95d1224](95d1224))
* move bulk print operation to the background (backport [#25358](#25358)) ([#25396](#25396)) ([4508239](4508239))
* Store printed PDF attachments on communication (backport [#25439](#25439)) ([#25447](#25447)) ([9b7a02f](9b7a02f))

### Performance Improvements

* cap max count on list views (backport [#25348](#25348)) ([#25463](#25463)) ([3bc5d8a](3bc5d8a)), closes [#25361](#25361)
* compact prepared report files ([0aa3c8e](0aa3c8e))

### Reverts

* Revert "feat: move bulk print operation to the background (backport #25358) (#25396)" (#25400) ([490f031](490f031)), closes [#25358](#25358) [#25396](#25396) [#25400](#25400)
@frappe-pr-bot
Copy link
Collaborator

🎉 This PR is included in version 14.68.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants