OnePloy runs databases as standalone containers on your servers. Add one to a project environment, start it, and connect your applications through the internal connection URL that OnePloy shows on the database page.
Which databases are supported?
| Engine | Type |
|---|---|
| PostgreSQL | Relational database |
| MySQL | Relational database |
| MariaDB | Relational database, MySQL compatible |
| MongoDB | Document database |
| Redis | In-memory key-value store |
| KeyDB | Multithreaded, Redis-compatible store |
| Dragonfly | In-memory store compatible with Redis and Memcached |
| ClickHouse | Column-oriented analytics database |
You can change the Docker Image on the database’s settings page to pin a specific version.
How do I create a database?
- Open a project environment and choose Add resource.
- Pick the database engine.
- Choose the server if you have more than one.
- Review the generated username, password and initial database name, and change them if needed.
- Start the database.
You can also create databases through the API, for example POST /api/v1/databases/postgresql.
How do I connect my application to the database?
Copy the URL (internal) from the database page, for example the PostgreSQL URL, and set it as an environment variable in your application. The internal URL uses the container name as host, so it works for applications on the same server and Docker network without exposing the database to the internet.
Only team admins and owners can see the connection URLs and passwords.
How do I make a database publicly accessible?
- Set a Public port on the database settings page, for example
5433. - Change Access from Private to Public through TCP proxy.
- Open that port in the server’s firewall.
OnePloy starts a small TCP proxy that forwards the public port to the database and shows a URL (public) you can use from outside. The proxy has its own logs, and you can adjust the Proxy timeout.
Warning: A public database is reachable by anyone who can reach the port. Use a strong password, restrict the port in your firewall to known IP addresses, and switch back to Private when you no longer need outside access.
What else can I configure?
- Custom configuration, such as a custom PostgreSQL configuration file.
- Initialisation scripts that run when the database is first created (PostgreSQL).
- Persistent storage, resource limits, health checks and log forwarding.
- A terminal into the database container, and live logs.