Data

How data connects

Databases, caches, queues, and buckets live next to your services in the same environment. You never paste a connection string: every service receives it as a variable.

Resources belong to an environment

Create a resource in an environment and every service in that environment — web services, workers, jobs, one-off commands — can reach it. Nothing is attached by hand. The service page in the console shows exactly which resources a service can reach and which variables carry each connection.

Terminal
apprail databases create shop main
apprail caches create shop sessions --env staging
ResourceConventional variableAlways also
PostgresDATABASE_URLAPPRAIL_DATABASE_<NAME>_*
CacheREDIS_URLAPPRAIL_CACHE_<NAME>_*
QueueAMQP_URL, RABBITMQ_URLAPPRAIL_QUEUE_<NAME>_*
BucketS3_*, AWS_*APPRAIL_BUCKET_<NAME>_*

Several of the same kind

The oldest ready resource of each kind is the environment’s default and gets the conventional names (DATABASE_URL and friends). Every resource, default or not, also gets its own APPRAIL_<KIND>_<NAME>_* variables. Adding a second database therefore never takes DATABASE_URL away from a running app; if the default is deleted, the next-oldest takes over.

When services see changes

Private by design

Resources have no public address. Their hostnames resolve only inside the environment’s private network, and other environments and workspaces can’t reach them. To reach a database from your own machine, open a tunnel:

Terminal
apprail databases connect shop main
# then, in another terminal:
psql "postgres://…@127.0.0.1:54329/…"

For caches, queues, and buckets there’s no tunnel yet. Inspect them from inside the environment with apprail run, for example apprail run shop/web -- node scripts/inspect-queue.js.

Limits per environment

ResourceAt mostSizes
Postgres databases51–50 GB storage
Caches564 MB–4 GB memory; 1–20 GB disk with persistence
Queues3256–2048 MB memory, 1–20 GB disk
BucketsCounted in your workspace’s data resources1–100 GB quota each

All of them also count toward your workspace’s limits.