Official Redis Image Not Passing Through Environment

Hi All,

I’m following the official documentation on deploying the official Redis image from the Fly Docs, and I’m having an issue connecting to my application, it seems Redis isn’t reading my REDIS_PASSWORD environment variable. My toml:

app = 'example-redis'
primary_region = 'lhr'
swap_size_mb = 1024
auto_stop_machines = false
auto_start_machines = true

[build]
image = 'redis:latest'

[[mounts]]
destination = "/data"
source = "redis_server"

[http_service]
app = "sh -c exec redis-server --requirepass \"$REDIS_PASSWORD\""

[[vm]]
memory = '512mb'
cpu_kind = 'shared'
cpus = 1

I didn’t think that http_service was needed, but there where else does app go?
Thanks

You need to replace [http_service] with [processes]. The processes section is where you can set the command to run redis and set the password.

Thanks - I updated my configuration, but now there seems to be a disk error:

[info] ERROR error umounting /data: EBUSY: Device or resource busy, retrying in a bit

Is the order of items important in the config file?

app = 'example-redis'
primary_region = 'lhr'
swap_size_mb = 1024
auto_stop_machines = true
auto_start_machines = true

[build]
image = 'redis:latest'

[[mounts]]
destination = "/data"
source = "redis_server"

[processes]
app = "sh -c exec redis-server --requirepass \"$REDIS_PASSWORD\""

[[vm]]
memory = '512mb'
cpu_kind = 'shared'
cpus = 1

Thanks

Seems /data is still used by some processes. Was Redis still running at that time? Can you share us the logs before/after EBUSY?

No, Redis doesn’t start at all. The volume I have is 2GB and has 123mb used, here are the full machine startup logs:

2024-02-27T08:24:52.041 app[] lhr [info] [ 0.051020] PCI: Fatal: No config space access function found
2024-02-27T08:24:52.302 app[] lhr [info] INFO Starting init (commit: 913ad9c)...
2024-02-27T08:24:52.338 app[] lhr [info] INFO Mounting /dev/vdb at /data w/ uid: 0, gid: 0 and chmod 0755
2024-02-27T08:24:52.347 app[] lhr [info] INFO Resized /data to 2130706432 bytes
2024-02-27T08:24:52.349 app[] lhr [info] INFO Preparing to run: `docker-entrypoint.sh sh -c exec redis-server --requirepass $REDIS_PASSWORD` as root
2024-02-27T08:24:52.362 app[] lhr [info] INFO [fly api proxy] listening at /.fly/api
2024-02-27T08:24:52.375 app[] lhr [info] 2024/02/27 08:24:52 listening on [fdaa:6:1263:a7b:172:5cc:b75a:2]:22 (DNS: [fdaa::3]:53)
2024-02-27T08:24:52.416 runner[] lhr [info] Machine started in 608ms
2024-02-27T08:24:53.363 app[] lhr [info] INFO Main child exited normally with code: 0
2024-02-27T08:24:53.363 app[] lhr [info] INFO Starting clean up.
2024-02-27T08:24:53.364 app[] lhr [info] INFO Umounting /dev/vdb from /data
2024-02-27T08:24:53.365 app[] lhr [info] ERROR error umounting /data: EBUSY: Device or resource busy, retrying in a bit
2024-02-27T08:24:53.368 app[] lhr [info] WARN hallpass exited, pid: 314, status: signal: 15 (SIGTERM)
2024-02-27T08:24:53.372 app[] lhr [info] 2024/02/27 08:24:53 listening on [fdaa:6:1263:a7b:172:5cc:b75a:2]:22 (DNS: [fdaa::3]:53)
2024-02-27T08:24:54.117 app[] lhr [info] ERROR error umounting /data: EBUSY: Device or resource busy, retrying in a bit
2024-02-27T08:24:54.869 app[] lhr [info] ERROR error umounting /data: EBUSY: Device or resource busy, retrying in a bit
2024-02-27T08:24:55.621 app[] lhr [info] ERROR error umounting /data: EBUSY: Device or resource busy, retrying in a bit
2024-02-27T08:24:57.381 app[] lhr [info] [ 5.390073] reboot: Restarting system
2024-02-27T08:24:57.577 runner[] lhr [info] machine exited with exit code 0, not restarting

Thanks

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