Giter Site home page Giter Site logo

heroku / heroku-buildpack-ci-redis Goto Github PK

View Code? Open in Web Editor NEW
5.0 90.0 14.0 45 KB

An experimental buildpack to provide Redis running inside CI dynos

Home Page: https://devcenter.heroku.com/articles/heroku-ci-in-dyno-databases

Shell 87.95% Dockerfile 12.05%

heroku-buildpack-ci-redis's Introduction

Warning this is an experimental buildpack and is provided as-is without any promise of support.

Heroku CI buildpack: Redis

This experimental Heroku buildpack vendors Redis into the dyno. It is intended for use with Heroku CI or any other environment where data retention is not important.

Please note that Redis will loose all data each time a dyno restarts.

Usage

The first run of this buildpack will take a while as Redis is downloaded and compiled. Thereafter the compiled version will be cached. Redis will start locally and be available on redis://127.0.0.1:6379 available in the REDIS_URL environment variable.

By default Redis 7 is used, however you can specify a REDIS_VERSION in the env section of your app.json to use a different major (e.g. "4" or "5") or exact (e.g. "6.0.16") version. This feature is experimental and subject to change.

Releasing a new version

Make sure you publish this buildpack in the buildpack registry

heroku buildpacks:publish heroku/ci-redis master

heroku-buildpack-ci-redis's People

Contributors

appleton avatar bensymonds avatar bigkevmcd avatar coreypurcell avatar dz0ny avatar edmorley avatar iriberri avatar isc avatar jabrown85 avatar jdowning avatar joshwlewis avatar jsncmgs1 avatar mitsuhiko avatar raulb avatar subakva avatar treznick avatar verajohne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

heroku-buildpack-ci-redis's Issues

Username "h" in connection string results in WRONGPASS errors for Redis 6+

In the past, Heroku was adding the h username on Redis connection strings (see: https://devcenter.heroku.com/changelog-items/1932). With the release of Redis 6 and ACLs (https://redis.io/docs/manual/security/acl/), Heroku stopped adding the h username for Redis 6 instances (and new Redis add-ons using older Redis versions).

However, this buildpack is still hardcoding the h username: https://github.com/heroku/heroku-buildpack-ci-redis/blob/master/bin/compile#L68 in the connection string config var.

This is resulting in WRONGPASS invalid username-password pair or user is disabled. errors with Redis 6+ if the Redis clients are trying to authenticate using the h username and the given password.

With Redis 6+, using requirepass will configure that pass for the default user. The h user wouldn't exist, neither it's configured with that password, so connections using username=h, password=xxxx would fail. (Although one could use username=default, password=xxx and that'd work). We run requirepass here: https://github.com/heroku/heroku-buildpack-ci-redis/blob/master/bin/compile#L71.

We've seen reports of this issue after 6.2 was made the default version as part of #29. I'm admittedly confused as of why we didn't get reports of the same problem before, when 6.0.9 was the default version, which should have worked similarly in terms of users/ACLs.

As a result, this is resulting in test failures in Heroku CI when the Redis client tries to connect to the locally running instance and authenticate as the h user. We've seen this happen with redis-py (3.5.3, and also tested with 4.3.1 through a console directly - outside of Heroku CI).

Some other clients like redis-rb are handling this scenario specifically but raising a warning:

[redis-rb] The Redis connection was configured with username "h", but the provided password was for the default user. This will start failing in redis-rb 5.0.0.

(https://github.com/redis/redis-rb/blob/4724c1bfde2d5679128ced8ec7b46bac66605b7b/lib/redis/client.rb#L124-L134)

To sort this out, the REDIS_URL config var shouldn't include the h username at least if the version is 6 or higher.

heroku-buildpack-ci-redis does not invalidate cache when switching stack

The cached Redis build is used even if $STACK has changed.

To fix this, the cached build directory could be made to include not only the Redis version string, but also the stack.

However the buildpack should also probably clean up old build directories (currently no cleanup is performed at all, so the cache will gradually become bloated even for version changes). To do that it's likely best to pick a directory namespace under the cache dir (eg .indyno/redis or ci-redis/) that way cleanup could remove that directory entirely rather than need to use globbing.

Tracked internally at W-7501650.

Does not export REDIS_URL

The buildpack starts Redis with a predefined, hard-coded configuration. It currently requires buildpack consumers to also make those assumptions. For flexibility and consistency with the Postgres CI buildpack, this buildpack should export a REDIS_URL.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.