Skip to content

Databases ​

Orbit runs PostgreSQL, MySQL 8.4, MongoDB 8.0, Redis 7.4, Neo4j Community and OpenSearch next to your applications, each with a volume on the server's disk under /var/lib/rancher/k3s/storage. New PostgreSQL databases run on CloudNativePG. Files, such as uploads, go in Spaces.

The data lives on a server's disk

If that server is lost, so is the data, unless backups go to external storage. Storage sizes are requested, not enforced.

Creating a database ​

Open Databases → Create database and choose Independent to create it directly in the current workspace, even when there are no projects. Choose In a project to select a project and environment instead. Both options let you choose a server, memory, storage and an initial backup schedule for engines with managed backups.

Connecting applications ​

  • Project databases accept applications in the same environment. Independent databases accept explicit connections from applications in any project in the same workspace; other workspaces cannot see or connect to them. The address is <name>.orbit-<project>-<environment>.svc.cluster.local, or <name>.orbit-workspace-<workspace-id-suffix>-production.svc.cluster.local for an independent database. For relational engines and MongoDB, Orbit creates the database and its user with the service's name (- becomes _) and a random password.
  • Connect on an application adds a reference such as DATABASE_URL (MONGODB_URL for MongoDB, REDIS_URL for Redis, four of them for a Space) to its variables. The value is filled in when the application deploys, so redeploy it after connecting. The database's page lists the applications that use it.
  • The same database can serve several applications in its environment: connect each one, or pick the database when you add an application to the project.

Both engines run as a single instance with a persistent volume. Choose Independent to connect applications across projects within one workspace, or In a project to keep connections in one environment.

EngineMinimum memoryApplication connection
Neo4j Community 5.26 LTS1 GiBConnect the driver using NEO4J_URI and pass NEO4J_USERNAME and NEO4J_PASSWORD as authentication. Bolt listens on port 7687. The initial database and user are both neo4j.
OpenSearch 32 GiBUse the authenticated REST endpoint in OPENSEARCH_URL on port 9200. The application can create and query its own indexes. Applications connected to the same instance share its credentials and indexes.

Orbit keeps these endpoints private. Show credentials provides an SSH tunnel for desktop clients. For recovery, plan a Neo4j offline dump or an OpenSearch snapshot with operator access. Scheduled backups, import, restore and password rotation through Orbit are currently unavailable for these engines. A persistent volume protects against pod restarts; losing the server can also lose its volume.

Explore a Neo4j graph ​

Open a Neo4j database, select Data, then Browse data. The graph explorer shows a read-only sample of up to 80 nodes and 160 relationships. These counts describe the current view, not the entire database.

Search node property text or enter an exact label to narrow the sample. Select a node to inspect its labels and properties; Explore connections loads that node and its immediate neighbors. Select a relationship to see its direction, type and properties. Back to overview clears the neighborhood and filters. Drag the canvas to move it, use the zoom controls, or switch to Records for a list. Nodes, relationships and controls can also be selected with the keyboard.

The canvas uses short spring transitions for zoom and changes to the graph. Selection traces the connected edges once. Reduced motion applies changes immediately, and leaving the page stops its animations.

Properties are previews: up to 50 keys, 1,024 characters per value and 50 array items. A limit notice means more data exists outside the sample. Refine your search or explore a neighborhood. If a read fails, the previous graph and search remain available for retry. New databases show an empty state until your application or the Cypher terminal writes nodes.

Orbit runs fixed, parameterized reads through the private pod, with a 15-second process timeout. It does not expose Bolt, enable HTTP, send credentials to the browser or accept arbitrary Cypher in this view. The demonstration console uses sample data.

Search OpenSearch documents ​

Open an OpenSearch database, select Data, then Browse data. The index strip shows up to 100 open, non-system indices with their health and indexed counts. Those counts include nested documents and can differ from the number of search results. Select one index or search across the listed indices.

Search supports words, quoted phrases and a trailing * for a prefix, using the simple query string syntax. Results are ordered by relevance, with 25 documents per page and navigation through the first 1,000 matches. Counts are exact up to 10,000 matches; a + marks a lower bound. Refine the query when a limit is reached. When nothing matches, Show all documents clears the search and the chosen index.

Select a document with the pointer or keyboard to inspect its fields, switch to formatted JSON, or copy its source preview. Large sources are shortened while preserving valid JSON; a notice identifies them. If a read fails, the last successful results and your search remain available for retry. Empty databases show how to add the first index through your application.

Orbit sends fixed read requests through the private database pod. Credentials stay there, request bodies accept no arbitrary DSL or scripts, searches have a ten-second query timeout and network reads are bounded to 8 MiB. The local demonstration uses sample documents. Motion settles immediately when reduced motion is enabled or the page is hidden.

Connecting from your computer ​

Show credentials on the database's page reveals the user, password and database with two ways in:

  • An SSH tunnel through the server the database runs on, which keeps the database private: run the command it shows, then connect psql, DBeaver or TablePlus to 127.0.0.1:15432 (13306 for MySQL, 37017 for MongoDB, 16379 for Redis, 13900 for a Space). The tunnel forwards to the database's address inside the cluster, so any client with SSH tunnel settings can save it: the server as SSH host, and that address and port as the database host.
  • Open in Lily DB saves the database in Lily DB with that tunnel set. Lily opens it by itself on every connection and asks for the password once.
  • The public address, when access is public.

Every reveal is recorded in Activity.

Browsing data ​

Browse data opens a dedicated explorer for each engine. PostgreSQL and MySQL show the table list, estimated rows and size, and pages of 50 records. MongoDB shows collections with one column per top-level document field. The first available table opens automatically; filter the list, switch tables, or open a read-only query. Columns stay within a scrollable grid on small screens.

Redis scans keys by pattern in batches. Select a key to inspect its type, size, expiration and value. Strings containing valid JSON can switch between formatted JSON and the original text; hashes, lists, sets, sorted sets and streams use the grid. Load more continues scanning even if a batch has no matches. These values are bounded previews, not exports.

Short transitions accompany selections. Keyboard controls, visible focus and reduced motion work throughout. A failed table or key read preserves the previous value; a failed query preserves both your text and its last successful result with an error notice.

  • Queries: the Query tab runs one SQL statement (a SELECT, WITH, VALUES or TABLE) in a read-only transaction. It stops after 15 seconds, returns up to 500 rows and cuts cells at 1,000 characters. Every query is recorded in Activity with its text.
  • MongoDB queries are a find in the shell's syntax, such as db.orders.find({status: "paid"}).sort({_id: -1}).limit(20), with an optional projection, sort, skip and limit. Orbit reads the query itself and runs nothing else, so a method that writes is refused.
  • Read-only is a guard, not a permission: a statement that writes is refused before it runs, and the transaction catches the rest. To change data, connect from your computer.

Shell ​

Shell on a database's page opens the database's own client, psql, mysql, mongosh or redis-cli, inside its primary instance, connected as the database's user. Unlike browsing data, it writes, so it needs the admin role. It closes after 15 minutes without input, when you sign out or when your role changes, and the activity records who opened and closed it; what you type is never recorded. Spaces have no shell.

Public access ​

Making a database public publishes it on the server's IP at the engine's port (5432, 3306, 27017, 6379 or 3900, or the next free one). Open that port in your provider's firewall only for the addresses that need it, and make the database private again when they no longer do.

Memory and storage ​

Memory and storage on the database's page changes both, with a preview first: how much memory the server keeps free after the change, how the database restarts and what to watch out for. A change that does not fit the server is refused before anything restarts.

  • A new memory limit restarts the database once. With one instance it is unavailable for the restart, usually under a minute. With replicas on CloudNativePG, the replicas restart first and then the primary moves to one of them. Orbit waits until every instance runs with the new limit and answers with its credentials; if it does not, the previous limit is put back.
  • Storage is a plan, not a resize. Local volumes are neither enforced nor resized, so the planned storage is what Orbit reserves and uses for the storage warning. The volume keeps the size it was created with, and the page says so once they differ.
  • Running out of memory opens an incident, as it does for applications: after two restarts for memory within 30 minutes, the incident shows the evidence and Raise the limit goes through the same preview.
  • The creation form applies the minimum memory for the selected engine. Raise the limit here as the workload grows.

Size suggestions ​

The same panel can suggest a smaller memory size. Orbit reads the working set of every instance every 30 seconds and keeps eight days of readings; the suggestion uses the largest reading of any instance over the last seven days at the current size, since a resize changes how much the engine uses. It adds a 50% margin, or 100% for Neo4j and OpenSearch, whose heap is a fixed share of the size and fails at once when it is too small, and for Redis, which keeps its whole dataset in memory. It rounds up to 64 MB and never goes below the engine's minimum. It needs at least 95% coverage, no gap longer than five minutes and a fresh reading; an out-of-memory restart in the last seven days or an open memory incident blocks it.

The settings an engine derives from its size are written again when it restarts with the new size, so they shrink with it: Neo4j keeps a quarter for its heap and a quarter for its page cache, OpenSearch half for its heap, MySQL a third for its buffer pool and MongoDB half of what is above 512 MB for its cache. PostgreSQL and Redis have no such setting. The suggestion lists them for the current and the proposed size. Review size suggestion fills the form; applying goes through the same preview and restart as any other change, and the seven days start over at the new size.

What takes the space ​

What takes the space, under Storage on the database's page, measures the volume from inside the database when the page opens and again with Measure again. It needs the developer role, as browsing data does.

  • PostgreSQL splits into the data of its databases, the WAL and the rest. The WAL is the log PostgreSQL writes before it changes the data. It usually stays between a few hundred MB and a little over 1 GB, as wal_keep_size and max_wal_size allow, and the page says so when that is all it is.
  • When the WAL grows, the page says why:
    • Archiving fails. With point-in-time recovery, PostgreSQL keeps every WAL file until it reaches the backup storage. If the storage refuses it (wrong keys, a deleted bucket, a full disk), the WAL piles up and the volume can pass its planned size. The page shows when the last file was archived, the file that fails and the error the archiver gives, such as an endpoint it cannot reach or a key it is not allowed to write with. Fix the storage and the waiting WAL is sent and removed.
    • Archiving falls behind when the database writes WAL faster than it can be sent.
    • A replication slot nobody reads keeps every WAL file since its reader left. If no replica or tool needs it, drop it with pg_drop_replication_slot.
  • MySQL splits into data, binary logs and the rest. MySQL keeps binary logs for 30 days by default, which can take more space than the data; if no replica needs them, lower binlog_expire_logs_seconds or run PURGE BINARY LOGS.
  • Largest tables lists the ten biggest, with their dead rows on PostgreSQL: the rows that updates and deletes leave behind until VACUUM clears them. A table with many dead rows is pointed out. Autovacuum makes that space reusable for new rows; VACUUM FULL gives it back to the disk, but locks the table while it runs.
  • Redis and MongoDB show only the total, and a Space shows how many files it holds.

Rotating credentials ​

Orbit changes the password, updates every application that uses the database (including the releases kept for rollbacks) and restarts them, then checks that the old password is refused. Applications that read the password from anywhere other than their Orbit variables have to be updated by hand. A Space keeps its keys; see Spaces.

Upgrading ​

Orbit backs the database up first, then runs the new version and checks that it holds the same tables and rows (or keys).

  • On CloudNativePG, PostgreSQL upgrades in place with pg_upgrade, and the previous version comes back if that fails.
  • On the older StatefulSet runtime, moving PostgreSQL to a new major version restores the backup into a new volume, so it takes about as long as a restore. A failed upgrade starts the previous version again on its own data.

PostgreSQL on CloudNativePG ​

Orbit installs the CloudNativePG operator and its Barman Cloud plugin when the first PostgreSQL database is created. CloudNativePG brings replicas on other servers and point-in-time recovery.

Moving an older database: a PostgreSQL database created before CloudNativePG shows Move to CloudNativePG on its page. The preview says how long writes pause, where the backup goes, whether the server has the disk for a second copy, and that the current volume is kept.

  1. Orbit backs the database up.
  2. It starts the cluster next to the current database.
  3. It pauses writes (reads keep working) and copies the data, checking that the cluster holds the same tables and rows.
  4. It points the address the applications use to the cluster and restarts them, with the same variables.

If a step fails, Orbit removes the cluster and the old database accepts writes again. The old volume stays on the server, frozen and read-only, until Remove old volume.

When the cluster is not healthy, the database's page says what CloudNativePG reports: a change in progress, such as a switchover or a new replica, shows the database as degraded, and a cluster that cannot recover, for example after losing every instance, shows it as failed with CloudNativePG's reason. A failed cluster cannot bring its data back from its own instances: rebuild it from its archive or restore a verified backup.

PostGIS and pgvector ​

A PostgreSQL database on CloudNativePG can have two extensions, chosen when it is created or added later under Resources → Extensions:

ExtensionForWhat adding it does
PostGISMaps, distances and areas, with geography and geometry typesThe database moves to the PostGIS image of the same PostgreSQL release, so it restarts once
pgvectorSimilarity search over embeddingsNothing restarts: it is already in the image every PostgreSQL database runs

Orbit creates the extension in the application's database, so the application only uses it: CREATE EXTENSION is not part of your migrations.

  • Adding PostGIS to a running database closes its connections for about a minute while it comes back on the new image. With replicas, they restart first and the primary last. If the database does not come back, or PostgreSQL refuses the extension, Orbit puts the previous image back and the database is as it was.
  • Backups record the extensions the database had. Their restore test runs on the image that carries those extensions, and a restore into the database brings them back.
  • Upgrading PostgreSQL keeps the extensions: the new release also runs on the PostGIS image when the database has it.
  • Row counts in restore tests and upgrades leave out the tables an extension owns, such as PostGIS's spatial_ref_sys.
  • Removing an extension is done in SQL with DROP EXTENSION. It also drops what was built on it, so Orbit does not do it for you. A database that had PostGIS keeps running on the PostGIS image.
  • An extension you created yourself before this, such as vector, keeps working. Add it here as well, so Orbit knows about it and tests the backups on the right image.
  • A PostgreSQL database that was not moved to CloudNativePG shows why it cannot have extensions. Move it first, under Runtime.

A Compose file that uses a postgis/postgis or pgvector/pgvector image becomes a managed PostgreSQL with that extension.

MySQL ​

  • It needs at least 512 MB.
  • The application's user only reaches its own database. A local root, whose password Orbit keeps and never shows, runs backups, restores and password changes.
  • A restore first checks that the dump is complete and loads it into a staging database, and only then replaces the live one, so a broken backup leaves the data as it was.

MongoDB ​

  • MongoDB 8.0 runs as a single instance, without a replica set.
  • It needs at least 512 MB. Its cache gets half of the memory above 512 MB, and at least 256 MB.
  • On x86 servers it needs a processor with AVX, and on ARM servers ARMv8.2-A, as every MongoDB since 5.0 does. Most VPS have them; a Raspberry Pi 4 does not.
  • The application's user can read, write and manage indexes in its own database only. A root user, whose password Orbit keeps and never shows, runs backups, restores and password changes. A database cannot be called admin, config or local.
  • The pod has a second container, client, for mongosh and the database tools, with its own memory limit, so a backup or a query never takes memory from the database.
  • Backups are mongodump --archive --gzip files. A single instance has no point-in-time snapshot, so a backup of a database that is being written reads one collection after another.
  • A restore loads the archive into a staging database first, and only then replaces the live one, so a broken backup leaves the data as it was.
  • MongoDB Community Server is published under the SSPL. Orbit pulls the official mongo image onto your server; it does not ship MongoDB itself.

Looking inside ​

sh
sudo k3s kubectl -n orbit-<project>-<environment> get clusters.postgresql.cnpg.io,pods,pvc
sudo k3s kubectl -n orbit-<project>-<environment> exec -it <name>-1 -c postgres -- sh -c 'psql -U "$POSTGRES_USER" -d "$POSTGRES_DB"'

Checking PostgreSQL after a provider resize ​

A provider resize can stop the machine abruptly and boot an installed kernel for the first time. Before scheduling it, check the server's pending-kernel warning, the last verified backup and which server hosts the primary and its replicas.

After the boot, compare the running kernel with the previous version. On the database page, wait for the expected number of ready instances. Check that the application can read from the database. During crash recovery the operator may retain its previous healthy phase. Repeated checkpoint failures or “could not signal for checkpoint: Permission denied” alongside a server warning about AppArmor indicate that recovery needs attention: see Containers and AppArmor. Compare the PostgreSQL and kernel logs for the same boot and keep both with the incident. If the database remains unavailable, use your maintenance recovery plan and a known-working kernel.

Orbit by Cortex Labs