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

Support for Redis Sentinel #501

Merged
merged 5 commits into from
Nov 15, 2017
Merged

Conversation

XVincentX
Copy link
Member

@XVincentX XVincentX commented Nov 3, 2017

Connects #499

ioredis

Mock library issues

Solution

  • Get rid of the emulate option and use Redis for everything, even for testing on CircleCI (we should do that anyway) 4deacf9

Compatibility problems

  • All methods already return a Promise, there's no need for promisify/Async version 5efe867

  • hgetall reply must be modified to guarantee compatibility 6c12cfd

  • exec function is using a Pipelining feature and has a different response type fix

  •  bluebird is overriding the default Promise implementation and this is preventing the migrate framework to work detect a Promise and react accordingly issue 4ad3cfc

@XVincentX XVincentX force-pushed the feature/redis-client-sentinel-support branch 4 times, most recently from c951dc8 to eb4482c Compare November 6, 2017 09:55
@XVincentX
Copy link
Member Author

Interesting followups:

  1. Take advantage of transparent key prefixing so we can remove some boilerplate code
  2. Scan commands can return a stream — it is a great idea in order to avoid killing the server (both redis and the gateway)
  3. Cluster support. This is a different connection object with a different set of connection options as well.

@XVincentX XVincentX force-pushed the feature/redis-client-sentinel-support branch 3 times, most recently from 3331944 to 4e9ec0f Compare November 6, 2017 17:53
@ExpressGateway ExpressGateway deleted a comment from codecov bot Nov 7, 2017
@XVincentX XVincentX force-pushed the feature/redis-client-sentinel-support branch from 4e9ec0f to 65d137f Compare November 8, 2017 14:30
@DrMegavolt DrMegavolt self-requested a review November 8, 2017 21:16
Copy link
Contributor

@DrMegavolt DrMegavolt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See one comment for tls test. once fixed\reimplemented let's merge (probably a matter of rebase)

test/db.test.js Outdated
@@ -1,79 +0,0 @@
const path = require('path');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file was added to test ssl connection just recently why it is removed ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question.
I deleted it temporarily because I'll have to figure out how to test that part.

The problem here is — ioredis gets created using a constructor and not using a function such as Redis.createClient()

sinon, the stub library we're using, does not support spies on constructors.

I deleted this test just to verify it was working correctly. I'll now figure out another way to test this part.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@DrMegavolt
Copy link
Contributor

If the emulate option is working I'm thinking that we can land this massive PR, and break in memory a bit. so it will be another bug to fix it

@XVincentX
Copy link
Member Author

The emulate option is working correctly, yes.

I'm not really sure we should land this thing into master as it is.

I'm imagining somebody that wants to contribute or even simply trying the source code: they would clone the repository, install and run it: they would have a broke experience by default (as in-memory is not working and they would need a Redis instance), which is not very pleasant. I'd rather keep this branch here and resurrect it once ioredis-mock will be ready.

@agonbina
Copy link

agonbina commented Nov 9, 2017

Just for the record, I am using(developing against) this branch to run EG and I haven't run into any issues when running with a single redis host or the sentinel mode.

@DrMegavolt
Copy link
Contributor

@agonbina thanks for active testing. the only reason we cannot merge it to master is some issues with InMemory mode. Which is implemented as mock of redis client. once fixed it will land into master

@XVincentX XVincentX force-pushed the feature/redis-client-sentinel-support branch 2 times, most recently from 22821e6 to 6029f65 Compare November 13, 2017 10:46
@XVincentX
Copy link
Member Author

I've updated the ioredis-mock package and rebased with latest master.

Two points still have to be solved — see here

@XVincentX XVincentX force-pushed the feature/redis-client-sentinel-support branch 3 times, most recently from 020cf71 to 1296d57 Compare November 13, 2017 19:40
@XVincentX
Copy link
Member Author

Rebase is going to be fun.

@DrMegavolt
Copy link
Contributor

squash manually, it will be way easier.

@ExpressGateway ExpressGateway deleted a comment from codecov bot Nov 14, 2017
@DrMegavolt DrMegavolt force-pushed the feature/redis-client-sentinel-support branch 2 times, most recently from 93e8940 to 7def2c9 Compare November 15, 2017 11:37
@DrMegavolt DrMegavolt force-pushed the feature/redis-client-sentinel-support branch from 9602e31 to 6cdd2bb Compare November 15, 2017 17:28
@ExpressGateway ExpressGateway deleted a comment from codecov bot Nov 15, 2017
@codecov
Copy link

codecov bot commented Nov 15, 2017

Codecov Report

Merging #501 into master will decrease coverage by 0.07%.
The diff coverage is 90.9%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #501      +/-   ##
==========================================
- Coverage   88.61%   88.54%   -0.08%     
==========================================
  Files         114      114              
  Lines        3540     3553      +13     
==========================================
+ Hits         3137     3146       +9     
- Misses        403      407       +4
Impacted Files Coverage Δ
lib/services/consumers/application.service.js 91.3% <100%> (+0.49%) ⬆️
lib/services/tokens/token.dao.js 95.61% <100%> (+0.03%) ⬆️
lib/services/consumers/user.dao.js 97.82% <100%> (+0.04%) ⬆️
lib/services/consumers/application.dao.js 98.59% <100%> (+0.06%) ⬆️
lib/db.js 76.66% <75%> (-20%) ⬇️
...ices/authorization-codes/authorization-code.dao.js 90.47% <83.33%> (ø) ⬆️
lib/services/credentials/credential.dao.js 95.32% <96%> (+0.13%) ⬆️
lib/rest/routes/scopes.js 75.67% <0%> (+2.7%) ⬆️
bin/generators/scopes/create.js 100% <0%> (+7.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff7c212...447d910. Read the comment docs.

@DrMegavolt DrMegavolt force-pushed the feature/redis-client-sentinel-support branch from b27ef79 to 2c8ae64 Compare November 15, 2017 21:58
@XVincentX XVincentX merged commit 80dd9b4 into master Nov 15, 2017
@XVincentX XVincentX deleted the feature/redis-client-sentinel-support branch November 15, 2017 22:30
@DrMegavolt
Copy link
Contributor

LGTM

@agonbina
Copy link

Nice to see this was merged! I will switch to using the master branch now 👍 I'm curious as to when is the next release planned?

@XVincentX
Copy link
Member Author

Hard work, but we made it!

These two images will summarize last couple of hours here:

image
firecomputer

@DrMegavolt
Copy link
Contributor

DrMegavolt commented Nov 15, 2017

@agonbina waiting for multi-auth merge.
Expected Thursday Nov 16. If something goes wrong, then next week

gatherchou pushed a commit to yilu-tech/express-gateway that referenced this pull request Jul 29, 2021
* Replacing redis client to ioredis that support Sentinel; replace in-memory to ioredis-mock
* A lot of test fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants