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

Update redis module so that it can work with redis-stack similar to testcontainers-go #827

Open
kevbook opened this issue Aug 28, 2024 · 1 comment

Comments

@kevbook
Copy link

kevbook commented Aug 28, 2024

Expected Behaviour

const container = new RedisContainer('redis/redis-stack-server:7.2.0-v12')

This will fail because of the redis-server command.

this.withCommand([
"redis-server",
...(this.password ? [`--requirepass "${this.password}"`] : []),
...(this.persistenceVolume ? ["--save 1 1 ", "--appendonly yes"] : []),

As you can see from the docker images, redis uses CMD [redis-server] but redis-stack-server uses a custom entrypoint script. So I'm happy to open a PR, basically based on image string passed, we'll need to change how container.start() is handled (It's messy but not sure how else to solve it when you have 2 Redis images now!)

@kevbook
Copy link
Author

kevbook commented Aug 28, 2024

Just add this line. All tests should pass

/* Make sure the redis image is a not a `redis-stack` image as `redis-stack` images have a custom entrypoint, see https://hub.docker.com/r/redis/redis-stack-server */
    if (!this.imageName.image.includes("redis-stack")) {
      this.withCommand([
        "redis-server",
        ...(this.password ? [`--requirepass "${this.password}"`] : []),
        ...(this.persistenceVolume ? ["--save 1 1 ", "--appendonly yes"] : []),
      ]);
    }

With redis-stack this.withCommand will not be applicable as all custom args are passed via env vars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant