Skip to content

Storage

conceptconfiguration-storage

Choose where Platforma keeps its data, and set each storage.

Each kind of data is on the storage that fits it. The results are in a bucket that is cheap to keep and that the Desktop AppDesktop App — The program that each user installs on their own computer to work with Platforma. It is a client of the Backend. Glossary reads directly. The jobsjob — One run of a tool on data. The Backend starts jobs on the server where it runs, or in a Kubernetes cluster. Glossary work in a fast workspaceworkspace — The storage where the Backend and all jobs keep the working files of running jobs. The Backend and the jobs use it at the same time. In Kubernetes, it is a network file system; in Single Server mode, it is a folder on the server. Glossary, and the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary keeps its state on a disk of its own. You set these parts:

For what Platforma expects from each storage, see Storage. For the temporary disks of jobs, see Scratch volumes. For an installation made with an installer, see Install in cloud with installer.

Data folder in Single Server mode

In Single Server modeSingle Server mode — The mode in which the Backend and all its jobs run on one Linux machine, the server, with no Kubernetes cluster. Glossary, the Backend keeps its data in one folder: the data folder, set with --main-root (PL_MAIN_ROOT). By default, it is .platforma/backend in the home folder of the system user that runs the Backend. Set it to a folder on a disk with enough space, for example /data/platforma. The data folder holds:

Folder What it holds Option to put it elsewhere
rocksdb The database --db-dir (PL_DB_DIR)
work The workspace: the working files of running jobs --work-dir (PL_WORK_DIR)
packages The software that the Backend downloaded for the jobs --packages-dir (PL_PACKAGES_DIR)
primary The results and the uploaded files, when the primary storage is not a bucket. The Desktop App gets them from the Backend on port 6347: see Open ports Give a bucket: see Primary storage

For the disk size that these folders need, see Disk space. With a folder as the primary storage, back up the data folder with the backup of the server: see Backups and recovery.

Primary storage

The primary storage holds all results and uploaded files of all projects, and the backups of the database. The Desktop App uploads and downloads files directly from it, with links that the Backend signs, so large files do not go through the Backend. Platforma supports these kinds:

  • Amazon S3;
  • storage with an S3-compatible interface, with an endpoint and static keys;
  • Google Cloud Storage;
  • in Single Server mode only, a folder on the server.

For the requirements of the bucket (presigned URLs, S3 API features, lifecycle rules, network access), see Primary storage. The bucket does not need a CORS rule: the Desktop App is a desktop program, not a page in a browser.

Terraform modulesTerraform modules — The Terraform code that MiLaboratories provides to install Platforma. The cloud-specific Terraform modules make the cluster and its cloud parts in AWS or Google Cloud; the cloud-agnostic Terraform modules install Platforma into the cluster. Glossary, AWS or Google Cloud. The module platforma-tf-cloud-base makes the bucket and gives it to the next modules: you do not write the bucket into the services settings. In platforma-tf-cloud-base, you can set:

  • primary_storage.prefix: a folder in the bucket for the data of Platforma. Empty by default.
  • primary_storage.abort_incomplete_multipart_days: the lifecycle rule that removes incomplete uploads, 7 days by default.
  • The name of a new bucket is fixed: <name>-primary-<account ID> on AWS, <name>-primary-<project number> on Google Cloud. For a bucket with a different name, make it first and give it in existing_storages.bucket.
  • existing_storages.bucket: the name of a bucket that exists. The module then uses it and does not make a new one (see Kept data and reuse). Leave it unset (null) to make a new bucket; the module refuses an empty string.
Inputs of platforma-tf-cloud-base
primary_storage = { prefix = "platforma/" }

Terraform modules, own cluster. Set exactly one of s3 and gcs in cloud_values.primary_storage of the input cluster_config of platforma-tf-services-cluster. The module gives it to platforma-tf-services as infrastructure.primary_storage. The bucket is required.

cluster-config.json (part)
"cloud_values": {
"primary_storage": {
"s3": { "bucket": "my-platforma-results", "region": "eu-central-1" }
}
}

Helm chart. Set primaryStorage.s3 or primaryStorage.gcs:

values.yaml
primaryStorage:
s3:
bucket: my-platforma-results
region: eu-central-1

The values of the two ways are the same; the Terraform inputs use snake_case and the Helm values camelCase:

Value What it does Default
s3.bucket, s3.region, s3.prefix The bucket, its region (required for Amazon S3) and a folder in it —
s3.endpoint The address of S3-compatible storage, for example MinIO. Empty: Amazon S3 empty
s3.external_endpoint (externalEndpoint) The address that the Desktop App uses, when it is not the same as endpoint empty
s3.data_integrity_checks (dataIntegrityChecks) SHA-256 checksums on upload. Set false for storage that does not support them true
s3.secret.access_key, s3.secret.secret_key (accessKey, secretKey) The name and the key of the Secret with the access keys. Empty names: the Backend uses its cloud identitycloud identity — The identity that the cloud gives to the Platforma pod (IAM roles for service accounts on AWS, Workload Identity on Google Cloud). With it, Platforma needs no access keys. Glossary empty
gcs.bucket, gcs.project_id (projectID), gcs.prefix The bucket, its project and a folder in it —
gcs.service_account (serviceAccount) The Google service account that signs the download links —

A change of the primary storage. Do not change the bucket, the endpoint or the prefix of a running installation. The database keeps links to the results in the primary storage: with a different bucket, the projects lose their results. To move an installation from a server to a cluster, see Migrate from server to cloud. With the Terraform modules, a change of the settings in one root needs an apply of the later roots too: see The roots.

Workspace

The workspace is the file system that the Backend and all jobs share: the Backend puts the input files of a job into its working folder, and the job writes its results there. For what Platforma expects from it, see Workspace.

Terraform modules, AWS. platforma-tf-cloud-base makes an Amazon EFS file system. In its input workspace, you can set:

  • throughput_mode: the throughput mode of EFS, elastic by default;
  • base_path: the folder of Platforma in the file system, /platforma by default.

Terraform modules, Google Cloud. platforma-tf-cloud-base makes a Filestore instance. In its input workspace, you can set:

  • tier: ZONAL by default; also BASIC_HDD, BASIC_SSD or REGIONAL;
  • capacity_gib: 1024 by default. Each tier has a minimum: 2560 for BASIC_SSD, 1024 for the others. Filestore bills the full capacity all the time (see Size and cost);
  • share_name: workspace by default;
  • deletion_protection: true by default, for the ZONAL and REGIONAL tiers only.
Inputs of platforma-tf-cloud-base (Google Cloud)
workspace = { tier = "BASIC_SSD", capacity_gib = 2560 }

Terraform modules, own cluster, and Helm chart. The workspace comes from one of three sources:

Source Terraform modules Helm chart
A StorageClass (default platforma-workspace) cloud_values.volumes.workspace.storage_class in cluster_config volumes.workspace.storageClass
An existing PersistentVolume cloud_values.volumes.workspace.volume_name in cluster_config volumes.workspace.volumeName
An existing PersistentVolumeClaim backend_service.volumes.workspace.existing_claim volumes.workspace.existingClaim

The size of the claim is 1Ti by default (backend_service.volumes.workspace.size, volumes.workspace.size). A sub-path (sub_path, subPath) puts the instance into a folder of the volume. When several instances use one file system, give each instance its own folder and its own PersistentVolume. In this example, the instance uses a claim that exists, in the folder platforma of its volume:

platforma-tf-services
backend_service = {
volumes = {
workspace = { existing_claim = "shared-workspace", sub_path = "platforma" }
}
}
values.yaml
volumes:
workspace:
existingClaim: shared-workspace
subPath: platforma

A change of the workspace. The workspace holds only the working files of running jobs and, in Kubernetes, the software that the Backend downloaded: the results go to the primary storage. Thus you can give the Backend a new, empty workspace when no job runs. Stop the running BlocksBlock — A small application for one step of an analysis, for example the import of reads or clustering. It can combine several tools. Glossary first, so that no job loses its working files. The Backend downloads the software again when the jobs need it.

Database and logs disks

The Backend keeps its database (the projects, the users, the state of the Blocks) on a disk of its own, and writes its logs to a second disk.

Setting Terraform modules Helm chart Default
Size of the database disk backend_service.volumes.database.size volumes.database.size 50Gi
Logs disk on or off backend_service.volumes.logs.enabled volumes.logs.enabled on
Size of the logs disk backend_service.volumes.logs.size volumes.logs.size 30Gi
Rotation of the log files backend_service.logging.rotation logging.rotation 10 files of 1 GiB
StorageClass of each disk cloud_values.volumes.<disk>.storage_class in cluster_config volumes.<disk>.storageClass platforma-database, platforma-logs

With the cloud-specific Terraform modulescloud-specific Terraform modules — The Terraform modules platforma-tf-cloud-base and platforma-tf-cloud-cluster. There is one pair for each cloud, AWS and Google Cloud. The roots cloud and cluster apply them. They make the network, the Kubernetes cluster, the storage, the cloud identities and the registry caches. They give the hand-off file cluster_config to the cloud-agnostic Terraform modules. Glossary, platforma-tf-cloud-base also sets the speed of the disks in its input disks: 3000 IOPS by default, and 125 MiB/s on AWS (gp3) or 140 MiB/s on Google Cloud (hyperdisk-balanced). For what the StorageClasses must have, see Database volume.

platforma-tf-services
backend_service = {
volumes = {
database = { size = "100Gi" }
logs = { enabled = true, size = "50Gi" }
}
logging = {
rotation = { size = "1Gi", count = 20 }
}
}
values.yaml
volumes:
database: { size: 100Gi }
logs: { enabled: true, size: 50Gi }
logging:
rotation: { size: 1Gi, count: 20 }

A larger database disk. Set a larger size and apply the change (terraform apply or helm upgrade): the disk grows in place, and the Backend keeps its data. The StorageClasses of the modules allow this. A disk cannot become smaller: a smaller size fails.

A kept database disk that a new installation uses again (see Kept data and reuse) does not grow this way. Grow the disk in the cloud first, then set the size; the size must not be more than the size of the disk.

Logs disk off. With enabled = false, the Backend writes its logs only to its standard error output: Kubernetes keeps these logs only while the pod exists. With the cloud-specific modules, the logs disk is deleted with the installation by default; to keep it, set disks.logs.reclaim_policy = "Retain" in platforma-tf-cloud-base. A new, empty logs disk works the same.

Restart of the Backend

Each installation has one Backend, and the Backend has one database of its own: two copies of the Backend never share a database. Many changes of the settings apply only when the Backend starts again, so it is good to know what a restart does.

The Backend is one pod (one replica). At a restart, the old pod stops before the new pod starts, so a restart is a short outage of 1 to 2 minutes: users cannot connect during this time. No data is lost, and the jobs that run continue: they run in their own pods.

Backups of the database

By default, the Backend backs up its database to the primary storage: for the schedule, the files and how to restore from one, see Automatic backups of the database. These Backend options change it:

Option (environment variable) What it does Default
--db-backup-interval (PL_DB_BACKUP_INTERVAL) Time between two backups. 0 turns the backups off 24h
--db-backup-keep (PL_DB_BACKUP_KEEP) How many of the newest backups stay; the Backend deletes the older ones. 0 keeps all 14
--db-backup-prefix (PL_DB_BACKUP_PREFIX) The folder of the backups in the storage db-backups/
--db-backup-temp-dir (PL_DB_BACKUP_TEMP_DIR) The folder where the Backend makes the backup before the upload the temporary folder of the system
--db-backup-storage-s3, --db-backup-storage-gcs or --db-backup-storage-fs A different destination: a bucket or a folder. Set one of them at most. Each has the same options as the primary storage, for example --db-backup-storage-s3-region the primary storage

These options are not covered by the chart values or the module inputs. Give them in extraArgs (Helm) or backend_service.extra_args (Terraform):

platforma-tf-services
backend_service = {
extra_args = ["--db-backup-keep=30"]
}
values.yaml
extraArgs:
- "--db-backup-keep=30"

In Kubernetes, the destination is a bucket: the chart cannot mount a folder for --db-backup-storage-fs, or a key file for --db-backup-storage-gcs-json-key-file-path. The chart refuses access keys in extraArgs and in env.variables. For a backup bucket with keys, give the keys from a Secret in env.secretVariables (backend_service.env.secret_variables), as PL_DB_BACKUP_STORAGE_S3_KEY and PL_DB_BACKUP_STORAGE_S3_SECRET, or use the cloud identity of the Backend.

Consequences. With the backups off, there is no automatic restore point of the database. With fewer kept backups, the oldest restore point is newer. A separate destination must have the same protection as the primary storage.

Kept data and reuse

With the Terraform modules and the Helm chart, an uninstall keeps the primary storage, the workspace and the database disk: see Uninstall. A new installation can use them again, with the projects and the results. The installers also keep them, but a new installation with an installer does not use them: see Install again with the same names.

Before the uninstall, write down:

  • the name of the bucket;
  • the workspace (AWS: the ID of the EFS file system; Google Cloud: the IP address, the share name and the capacity of the Filestore instance);
  • the database disk (AWS: the ID of the EBS volume; Google Cloud: the name of the disk).

Terraform modules, AWS or Google Cloud. Give the kept parts in the input existing_storages of platforma-tf-cloud-base. For each key that you set, the module uses that part and does not make a new one; for each key that you do not set, it makes a new one.

AWS
existing_storages = {
bucket = "platforma-results-0a1b2c"
workspace = { file_system_id = "fs-0123456789abcdef0" }
database_volume = "vol-0123456789abcdef0"
}
Google Cloud
existing_storages = {
bucket = "platforma-results-0a1b2c"
workspace = { ip_address = "10.10.0.2", share_name = "workspace", capacity_gib = 1024 }
database_volume = "platforma-database-disk"
}

For the database disk:

  • the disk must be in the zone of the node pool of the Backend;
  • the installation must run one instance of Platforma (one namespace): the disk holds the database of one Backend;
  • the size of the database disk in the settings (backend_service.volumes.database.size) must not be more than the size of the disk. Else Kubernetes cannot bind the claim to the disk, and the Backend does not start.

Helm chart. Bind the claims to the existing volumes with volumes.database.volumeName and volumes.workspace.volumeName, or give an existing claim of the workspace in volumes.workspace.existingClaim. Give the kept bucket in primaryStorage.

In each case, start the Backend with the same master secret as before: see Master secret.

Problems

The Backend does not start: access denied to the bucket

Cause: the identity of the Backend, or its keys, do not give read and write access to the primary storage. Fix: give the access. For the rights, see Storage rights of the Backend.

The Backend does not start with S3-compatible storage

Cause: the storage does not support conditional writes (If-None-Match and If-Match). Fix: use storage that supports them. For all the requirements, see Amazon S3 and compatible storage.

Uploads fail with checksum errors on S3-compatible storage

Cause: the storage does not support the SHA-256 checksums of the uploads; the error is, for example, XAmzContentSHA256Mismatch. Fix: set data_integrity_checks = false (dataIntegrityChecks: false, or --primary-storage-s3-no-data-integrity in Single Server mode).

Downloads fail in a client

Only the Desktop App downloads files from the primary storage: pl-clipl-cli — The command-line client of Platforma. Administrators use it to manage users and projects on the Backend. Glossary does not.

Cause: the computers of the users cannot reach the bucket, for example because a bucket policy allows only the internal network, or, on Google Cloud, the service account of the Backend cannot sign the links. Fix: see Primary storage and Google Cloud Storage.

Limits

  • In Kubernetes, the primary storage is a bucket: Amazon S3, S3-compatible storage or Google Cloud Storage. A folder is possible only in Single Server mode.
  • Other object storage is not supported.
  • The database disk can grow, but it cannot become smaller.

Next