Skip to content

Connections

A connection is one Redis and the BullMQ key prefix its queues use. Each connection appears in the sidebar with its own queues, alerts and settings. Bullship holds one Redis connection per configured Redis, shared by every request and every person.

REDIS_URL=redis://localhost:6379

That’s a connection named “Default” with the prefix bull. If your queues use another prefix, such as new Queue('email', { prefix: 'jobs' }), set BULLSHIP_PREFIX=jobs.

Add one BULLSHIP_REDIS_URL_<NAME> per Redis. Each becomes a connection named after <NAME>:

BULLSHIP_REDIS_URL_PROD=rediss://default:password@prod-redis.example.com:6380
BULLSHIP_REDIS_URL_PROD_PREFIX=bull
BULLSHIP_REDIS_URL_STAGING=redis://staging-redis.internal:6379

PROD shows as “Prod” and EU_WEST as “Eu west”; connections are sorted by name. When any BULLSHIP_REDIS_URL_<NAME> is set, REDIS_URL is ignored. Use rediss:// for TLS.

Admins can add connections on the Connections page with Add connection: a name, the Redis URL and the prefix. Bullship connects and checks the Redis before it saves anything, then keeps the connection in connections.json in the data directory.

Admins can do the same through the API. API tokens are never admins, so sign in for a session cookie first:

curl -c cookies.txt -H "Content-Type: application/json" \
-d '{"email":"ada@example.com","password":"…"}' \
https://bullship.example.com/api/auth/sign-in/email
curl -b cookies.txt -H "Content-Type: application/json" \
-d '{"name":"Production","url":"redis://:password@redis.internal:6379","prefix":"bull"}' \
https://bullship.example.com/api/connections

DELETE /api/connections/<id> removes a saved one. A connection from an environment variable can’t be removed in the app; remove the variable instead.

The API never returns a connection’s username or password: it shows the address and a masked URL such as redis://••••••••@redis.internal:6379. To encrypt the saved URLs (and alert destinations) on disk, set BULLSHIP_SECRET_KEY to a long random key:

openssl rand -base64 32

Bullship encrypts with AES-256-GCM under a key stretched with scrypt and a random salt it keeps in secret-salt in the data directory; values saved by older versions are encrypted again at start. Keep the key outside the data directory, for example in a secret manager, and back up secret-salt with the rest of the data directory.

Adding a connection makes the server connect to whatever host an admin names. Two settings limit that:

  • BULLSHIP_CONNECTIONS_EDITABLE=false stops the app from adding, changing or removing connections; configure them with environment variables only.
  • BULLSHIP_BLOCK_PRIVATE_ADDRESSES=true lets admins add connections and alert destinations, but not to loopback, private, link-local (cloud metadata) or other non-public addresses. It is checked when Bullship connects, so a host name whose DNS answer changes can’t get around it.

The Connections page shows each Redis’s version, memory and whether it answers, checked when the page asks and at most every 10 seconds. A Redis that is down doesn’t hold up the others: its commands fail fast while Bullship reconnects, backing off up to 60 seconds, and requests answer 503 with Retry-After while it does.

See What Bullship needs from Redis for ACL permissions and Redis Cluster.