npm init -y
to create a package.json
file.npm install express redis
index.js
file in the project folder with the following content:fly init "your-app-name"
to initialize a new Fly.io application.fly.toml
file that was generated and add the following environment
variable under the [[services]]
section:your-upstash-redis-url
with the Redis URL from your Upstash instance.
fly redis create
, Fly.io establishes a Redis server in its cloud environment, designed specifically for applications running on the Fly.io platform.
fly redis connect
. This command establishes a secure tunnel between your local machine and the Redis instance on Fly.io.
localhost
with the mapped port.fly redis connect
in your terminal.localhost:10000
).localhost:10000
. This address will act as your local Redis endpoint.
fly redis connect
command.
Here’s an example in a Node.js application:
fly redis connect
tunnel should only be used for development and testing purposes.LOCAL_REDIS_URL
in the sample code with the actual local address provided by fly redis connect
.