Deploy a custom Redis Service

Hi, I am working on creating a Staging environment for my PRs. As part of the process, I want to create an ephemeral Redis instance only for this PR.

What I am trying to do is deploy a Fly app using this fly.toml config.

app = 'pr-pullrequest-redis'
primary_region = 'mad'

  image = "redis/redis-stack-server:latest"

  destination = "/data"
  source = "redis_server"

  internal_port = 6379
  force_https = false
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

    handlers = ["http"]
    port = 6379

  memory = '1gb'
  cpu_kind = 'shared'
  cpus = 1

It looks like it works, and I can see the monitoring indicating that the application is up and running, but I cannot connect to my Redis instance from my machine, and I always get this error message:

$ redis-cli -u 'redis://'
Could not connect to Redis at nodename nor servname provided, or not known
not connected>

Could you help me with an idea about what I am doing wrong?



I’m not sure you would use the http handler for Redis. Shouldn’t it be tcp :thinking:

  internal_port = 6379
  protocol = "tcp"

    port = "6379"

It may be a different issue - you’d need to check any docs for redis-stack-server - but that could be worth trying.

Hi Greg,

Thanks for your comment, I tried it. But I am getting the same error.

Super weird, because I can connect to the machine with SSH and work locally with my Redis :(.

Should be a DNS problem or maybe a protocol problem.

1 Like

Note that this way, your Redis instance will be exposed to the internet.

Have you considered using Upstash for Redis instead? Using the default pay-as-you-go plan, you should incur a lower cost, less operational overhead, and keep the database private.


I’m interested in using Upstash, but I need the RedisJSON plugin, which doesn’t seem to be available on Upstash right now.

Isn’t it supposed to be really easy to create and destroy an Upstash instance for each PR?

Creating and destroying Upstash databases is easy using fly redis create and fly redis destroy.

Also, check out this Github action which doesn’t support Upstash Redis, but could be modified to do so. Since you need RedisJSON, you could follow the Redis example in the README.

Sure, I forked the action (GitHub - ClassicManager/fly-pr-review-apps: Github Action for PR Review Apps on to add build arguments and a build target. It works great.

I used the action to install a Redis image, and it works too. However, I’m encountering the same issue: the server is not reachable from my machine or any other machines. I can only access the Redis instance if I SSH into the machine.

By the way, Upstash does support JSON so I’d recommend using that over a Redis instance. In both cases, you’d have to access it using the private IPv6 IP address. It would be great if you added Upstash support to the PR review app repo :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.