Databases, files and storage
Create MySQL databases, credentials as variables and placeholders, configuration files and persistent folders for uploads.
3 min read
On this page
Databases
Under Deploy → Databases, you create a MariaDB database, compatible with MySQL, in New database. With Connect right away to (optional) you assign it to a project straight away; later you do that on the database under Connected to project. It runs on three servers at once; if one fails, the others carry on. How many databases you can have depends on the plan.
When you assign a database to a project, the project gets the credentials as variables, from the next build:
| Variable | Content |
|---|---|
DB_HOST | mysql |
DB_PORT | 3306 |
DB_NAME, DB_USER, DB_PASSWORD | the credentials |
DATABASE_URL | everything in one line, mysql://… |
This applies to the first assigned database. Every further one is also available under its name, for example DB_SHOP_HOST, DB_SHOP_NAME. A variable of your own with the same name takes precedence.
New password sets a new password. Rebuild connected projects afterwards so they pick it up.
The database can only be reached from your projects, not from the internet. If you delete a project, the database stays. Deleting it is a separate step: type its name to confirm, then click Delete with all data.
Configuration files
In the Files tab, under Configuration files, you use New file to create files that are placed into your project during the build without being in the repository: at most 20 per project, up to 64 KB each, read-only. The Path in the project starts at the project folder, for example config/database.local.php. A changed file applies from the next build.
In the content you use placeholders, which we fill in at deploy time:
<?php
return [
'host' => '${DB_HOST}',
'name' => '${DB_NAME}',
'user' => '${DB_USER}',
'pass' => '${DB_PASSWORD}',
'key' => '${env:APP_KEY}',
];${env:NAME} reads one of your variables. Unknown placeholders stay as they are.
Persistent storage
Everything the app writes at runtime is gone with the next build. That is intended: every version starts clean. For uploads, caches that should stay, or SQLite files, you create a folder in the Storage tab under Persistent storage (Path in the container), for example uploads. It is mounted on the next start, survives every build and is available on all servers.
When you first create it, we copy whatever the repository already has in that folder into it, once. We measure usage hourly; the limit depends on the plan. When the storage is full, the overview shows a notice and new files can no longer be written.
Deleting only works with the path typed to confirm and Delete with content.