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

Connect a plugin with sentinels 3 nodes #67

Open
faceless49 opened this issue Aug 24, 2023 · 2 comments
Open

Connect a plugin with sentinels 3 nodes #67

faceless49 opened this issue Aug 24, 2023 · 2 comments
Labels
version: Strapi 4 Issues related to the versions supported by Strapi 4

Comments

@faceless49
Copy link

I want to connect a plugin with sentinels 3 nodes Is this possible? like here https://github.com/strapi-community/strapi-plugin-redis

How I should connect with sentinels?
I tried
redis: {
config: {
connections: {
default: {
connections: {
sentinels: [{ {host: "master", port: 6379}, {host: "sentinel" port: 6379}].
and
"rest-cache": {
config: {
provider: {
name: 'redis',
options: {
max: 32767,
connection: 'default'
}
,
},

It gives the error that connection default not found.
image

@derrickmehaffy
Copy link

Please share your full plugin.js config file (with proper markdown formatting) and your package.json please.

@faceless49
Copy link
Author

faceless49 commented Aug 25, 2023

@derrickmehaffy sure.

package.json

`{
  "name": "strapi",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "dependencies": {
    "@aws-sdk/client-s3": "^3.306.0",
    "@aws-sdk/node-http-handler": "^3.306.0",
    "@strapi/plugin-i18n": "4.6.1",
    "@strapi/plugin-seo": "^1.8.0",
    "@strapi/plugin-users-permissions": "4.6.1",
    "@strapi/provider-upload-aws-s3": "^4.8.2",
    "@strapi/strapi": "4.6.1",
    "hpagent": "^1.2.0",
    "pg": "8.8.0",
    "proxy-agent": "^5.0.0",
    "strapi-plugin-comments": "^2.2.6",
    "strapi-plugin-component-preview": "^1.0.8",
    "strapi-plugin-country-select": "^1.0.1",
    "strapi-plugin-duplicate-button": "^1.1.7",
    "strapi-plugin-multi-select": "^1.1.0",
    "strapi-plugin-preview-button": "^1.1.2",
    "strapi-plugin-sitemap": "^2.1.0-beta.2",
    "yarn": "^1.22.19"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "engines": {
    "node": ">=14.19.1 <=18.x.x",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}
`

Plugins.js

const ProxyAgent = require("proxy-agent");
module.exports = ({env = {}}) => ({
    redis: {
        config: {
            connections: {
               default: {
                    connection: {
                        sentinels: [
                            {
                                host: "host1",
                                port: port1,
                                password: pass,
                            },
                            {
                                host: host2,
                                port: port2,
                                password: pass,
                            }],
                    },
                    settings: {
                        debug: true,
                    },
                },
        }
    },
    // Step 2: Configure the redis cache plugin
    "rest-cache": {
        config: {
            provider: {
                name: 'redis',
                options: {
                    max: 32767,
                    connection: 'default'
                },
            },
            strategy: {
                keysPrefix: "<redis_>",
                enableEtagSupport: true,
                logs: true,
                clearRelatedCache: true,
                maxAge: 5000,
                contentTypes: [
                    // list of Content-Types UID to cache
                    {contentType: "api::article.article", hitpass: false}
                ],
                debug: true
            },
        },
    }
})

@derrickmehaffy derrickmehaffy added the version: Strapi 4 Issues related to the versions supported by Strapi 4 label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
version: Strapi 4 Issues related to the versions supported by Strapi 4
Projects
None yet
Development

No branches or pull requests

2 participants