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.
apprail databases create shop main
apprail caches create shop sessions --env staging| Resource | Conventional variable | Always also |
|---|---|---|
| Postgres | DATABASE_URL | APPRAIL_DATABASE_<NAME>_* |
| Cache | REDIS_URL | APPRAIL_CACHE_<NAME>_* |
| Queue | AMQP_URL, RABBITMQ_URL | APPRAIL_QUEUE_<NAME>_* |
| Bucket | S3_*, 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
- When a resource becomes ready, is removed, or has its password rotated, Apprail updates every live service in the environment automatically. Services whose variables didn’t change aren’t restarted.
- Variables you set yourself take effect on the next deployment.
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:
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
| Resource | At most | Sizes |
|---|---|---|
| Postgres databases | 5 | 1–50 GB storage |
| Caches | 5 | 64 MB–4 GB memory; 1–20 GB disk with persistence |
| Queues | 3 | 256–2048 MB memory, 1–20 GB disk |
| Buckets | Counted in your workspace’s data resources | 1–100 GB quota each |
All of them also count toward your workspace’s limits.