Skip to content

Data libraries

conceptconfiguration-data-libraries

Let users import input data from the buckets and folders of your company.

A data librarydata library — A folder or bucket with input data of the company. Users select files from it in the Desktop App. Platforma only reads it. Glossary is a bucket or a folder with input data of your company, for example the output of a sequencer. Users see each library in 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 and import files from it into their projects, so large data does not go through their computers. Platforma only reads a data library: the results go to the primary storageprimary storage — The bucket (Amazon S3 or Google Cloud Storage) or folder where Platforma keeps all results and uploaded files. Glossary.

Each library has two names:

  • the library IDlibrary ID — The fixed name of a data library inside Platforma. Projects keep links to files through this ID; a new ID makes a new library. Glossary: projects keep links to the imported files through it, so do not change it;
  • the display name, which users see. You can change it at any time.

The BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary reads each library in one of five access modes. Choose the mode for each library, then set it:

The Helm chart and the 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 set the first two modes and the folder. The two modes with an identity for each user need Backend options. For how the modes differ for the users, the cloud and the audit log, see Data library access modes. For what Platforma expects from a library, see Data libraries. For an installation made with an installer, see Install in cloud with installer.

Add a library

Platforma reads three kinds of library: an Amazon S3 bucket (also S3-compatible storage, for example MinIO), a Google Cloud Storage bucket, and a folder (in KubernetesKubernetes — A system that runs programs on a group of machines (a cluster). Platforma can run in a Kubernetes cluster. Glossary, a PersistentVolumeClaim). The Backend gets the list of libraries at start, so users see a new library after the Backend restarts. At start, the Backend lists each library, and it does not start when it cannot read one. The Backend does not check a library in the federated or the Google account mode at start, because it reads such a library with the identity of each user.

Terraform modules, AWS or Google Cloud. Two steps:

  1. In platforma-tf-cloud-base, add the bucket to data_libraries. The module gives the cloud identity of the Backend read access to it. A prefix limits the access to one folder.

    cloud.tfvars
    data_libraries = [
    { bucket = "my-sequencing-bucket" },
    ]
  2. In platforma-tf-services, add the library to backend_service.data_libraries, with its id, its name and exactly one of s3, gcs and pvc. Two libraries cannot have the same ID.

    services.tfvars
    backend_service = {
    data_libraries = [
    { id = "sequencing-archive", name = "Sequencing archive",
    s3 = { bucket = "my-sequencing-bucket", region = "eu-central-1" } },
    ]
    }
  3. Run terraform apply in the root cloud, then in the root services, with the same values and files as at the installation (see Install in cloud with Terraform). The apply of the root services restarts the Backend by itself: the old pod stops before the new pod starts, so users cannot connect for about 20 seconds. Result: the new library is in the list of libraries in the Desktop App.

Terraform modules, own cluster. Do steps 2 and 3, with the apply in the root services only. The team that runs the cluster gives the identity of the Backend read access: see Storage rights of the Backend.

Helm chart. Add the library to dataLibraries, then upgrade the release:

values.yaml
dataLibraries:
- id: sequencing-archive # library ID: do not change it later
name: "Sequencing archive" # the name that users see
s3:
bucket: my-sequencing-bucket
region: eu-central-1

The values of s3 and gcs are the same as for the primary storage: see Primary storage. The chart does not share the file system of the Backend pod as a library.

MiLaboratories demo data library

With the demo data library of MiLaboratories, you can do a test run when the installation is ready, without data of your own: the library holds sample sequencing data for the test projects. When the test run is green, you know that the infrastructure and the installation work.

The library is an Amazon S3 bucket of MiLaboratories. The Backend reads it with an access key that can only read this bucket. MiLaboratories publishes this key on purpose, so it is not a secret of your company:

Setting Value
Library ID milabs-demo-data
Bucket milab-euce1-prod-eks-s3-farm-library
Region eu-central-1
Prefix none (the whole bucket)
Access key ID AKIAXOL6R5EBCOHXV7PC
Secret access key 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

The installers add the library for you. In the AWS CloudFormation installer, it is the parameter Enable MiLaboratories demo data library (EnableDemoLibrary); in the Google Cloud installer, the question “Enable MiLaboratories demo data library?” (ENABLE_DEMO). Both are true by default and add the same bucket with the same key. On the other paths, add it as an S3 library with access keys (see Access keys).

First, put the key into a Secret in the namespace of Platforma:

Terminal window
kubectl create secret generic platforma-library-demo-creds -n <namespace> \
--from-literal=access-key='AKIAXOL6R5EBCOHXV7PC' \
--from-literal=secret-key='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'

Terraform modules. Add the library to backend_service.data_libraries of platforma-tf-services. Do not add the bucket to data_libraries of platforma-tf-cloud-base: the bucket is in an AWS account of MiLaboratories, and the key gives the access.

services.tfvars
backend_service = {
data_libraries = [
{ id = "milabs-demo-data",
s3 = {
bucket = "milab-euce1-prod-eks-s3-farm-library"
region = "eu-central-1"
secret = {
access_key = { name = "platforma-library-demo-creds", key = "access-key" }
secret_key = { name = "platforma-library-demo-creds", key = "secret-key" }
}
} },
]
}

Helm chart. Add the library to dataLibraries, then upgrade the release:

values.yaml
dataLibraries:
- id: milabs-demo-data
s3:
bucket: milab-euce1-prod-eks-s3-farm-library
region: eu-central-1
secret:
accessKey: { name: platforma-library-demo-creds, key: access-key }
secretKey: { name: platforma-library-demo-creds, key: secret-key }

Users see the library with the name milabs-demo-data after the Backend restarts. To give it a different name, set name (Terraform, Helm) or PL_DATA_LIBRARY_NAME (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); do not change the ID.

Access modes

Identity of the Backend

The Backend reads the library with its own cloud identity. For what this means for users and the audit log, see Identity of the Backend.

Do not give a secret in the library settings. 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, the entry in data_libraries of platforma-tf-cloud-base gives the read rights (see Add a library). On an own cluster, the team that runs the cluster gives them: see Storage rights of the Backend.

For a Google Cloud Storage library, set gcs.service_account (gcs.serviceAccount): the Google service account of the Backend, which signs the download links.

Access keys

The Backend reads the library with static keys, for a bucket that its cloud identity cannot reach. For the risks of keys that do not expire, see Access keys.

Put the keys into a Secret in the namespace of Platforma, and give its name and keys in the S3 library:

values.yaml
dataLibraries:
- id: partner-archive
name: "Partner archive"
s3:
bucket: partner-bucket
endpoint: https://s3.example.com
secret:
accessKey: { name: partner-archive-keys, key: access-key }
secretKey: { name: partner-archive-keys, key: secret-key }

In the Terraform modules, the same values are s3.secret.access_key and s3.secret.secret_key of the library in backend_service.data_libraries:

services.tfvars
backend_service = {
data_libraries = [
{ id = "partner-archive", name = "Partner archive",
s3 = {
bucket = "partner-bucket"
endpoint = "https://s3.example.com"
secret = {
access_key = { name = "partner-archive-keys", key = "access-key" }
secret_key = { name = "partner-archive-keys", key = "secret-key" }
}
} },
]
}

The Helm chart gives the keys of each library to the Backend as files from the Secret, readable by the user and the group of the Backend (mode 0440). Each S3 library can have its own keys: there is no limit on the number of libraries.

In Kubernetes, a Google Cloud Storage library cannot use a key file.

Federated user access

Each user reads the library with a cloud identity of their own, which the cloud gets from the SSOsingle sign-on — Sign-in through the identity service of the company, with the same account as for other company systems. Glossary token of the user. The cloud account must trust the corporate identity provider first: for what the cloud needs and what users see, see Federated user access. The mode needs sign-in with SSO: see Authentication.

Add the library as an S3 or a Google Cloud Storage library without keys, then give these Backend options for its ID:

  • Amazon S3:
    • --data-library-s3-federation-role-arn <id>=<ARN>: the IAM role that each user gets. The library also needs its region; it cannot have keys.
    • --data-library-s3-federation-auth-token <id>=<kind>: required with --data-library-s3-federation-role-arn. It selects the token of the identity provider that the Backend gives to the cloud: id_token or access_token. Google as the identity provider needs id_token.
    • --data-library-s3-federation-auth-provider <id>=<provider>: the name of the SSO provider that the role trusts. Required when there is more than one SSO provider.
  • Google Cloud Storage:
    • --data-library-gcs-service-account <id>=federated;
    • --data-library-gcs-federation-audience <id>=<audience>: the provider of the workload identity pool, //iam.googleapis.com/.../providers/...;
    • --data-library-gcs-federation-auth-token <id>=<kind>: required with --data-library-gcs-federation-audience. It selects the token, as for Amazon S3;
    • --data-library-gcs-federation-auth-provider <id>=<provider>, as for Amazon S3;
    • optional: --data-library-gcs-federation-token-url and --data-library-gcs-federation-scopes, when the defaults of Google do not fit.

These options are not covered by the chart values or the module inputs. Add the library in dataLibraries (Helm) or backend_service.data_libraries (Terraform), and give the options in extraArgs or backend_service.extra_args:

values.yaml
dataLibraries:
- id: lab-archive
name: "Lab archive"
s3: { bucket: lab-archive-bucket, region: eu-central-1 }
extraArgs:
- "--data-library-s3-federation-role-arn=lab-archive=arn:aws:iam::123456789012:role/platforma-users"
- "--data-library-s3-federation-auth-token=lab-archive=id_token"
services.tfvars
backend_service = {
data_libraries = [
{ id = "lab-archive", name = "Lab archive",
s3 = { bucket = "lab-archive-bucket", region = "eu-central-1" } },
]
extra_args = [
"--data-library-s3-federation-role-arn=lab-archive=arn:aws:iam::123456789012:role/platforma-users",
"--data-library-s3-federation-auth-token=lab-archive=id_token",
]
}

A library that users already use. With federated access, imports copy the files into the primary storage. Files that users imported before, in another mode, stay links to the library. Before you change a library to federated access, copy these files into the primary storage: see Change the access mode of a data library.

Google account of the user

Each user reads a Google Cloud Storage library with their own Google account. For the scopes of the token and what users see, see Google account of the user. Users must sign in with SSO through Google, and the sign-in must ask for access to Cloud Storage and for a refresh token: see Authentication.

Set these values for the library:

  • the service account authenticated-user: --data-library-gcs-service-account <id>=authenticated-user;
  • --data-library-gcs-auth-provider <id>=<provider>: the name of the Google SSO provider.

The provider option is not covered by the chart values or the module inputs. Set serviceAccount: authenticated-user in the library, and give the provider in extraArgs (backend_service.extra_args in Terraform):

values.yaml
dataLibraries:
- id: shared-references
name: "Shared references"
gcs: { bucket: shared-references-bucket, projectID: my-project, serviceAccount: authenticated-user }
extraArgs:
- "--data-library-gcs-auth-provider=shared-references=google"
services.tfvars
backend_service = {
data_libraries = [
{ id = "shared-references", name = "Shared references",
gcs = { bucket = "shared-references-bucket", project_id = "my-project", service_account = "authenticated-user" } },
]
extra_args = ["--data-library-gcs-auth-provider=shared-references=google"]
}

Folder on the server or a volume

The Backend reads the files itself, with its own system user. For what this means for users, see Folder on the server or a volume.

Create the PersistentVolumeClaim in the namespace of Platforma first, then give it in pvc of the library. The chart mounts it read-only into the Backend pod only. A sub-path (subPath, sub_path) uses one folder of the volume.

values.yaml
dataLibraries:
- id: shared-folder
name: "Shared folder"
pvc:
existingClaim: shared-data
services.tfvars
backend_service = {
data_libraries = [
{ id = "shared-folder", name = "Shared folder",
pvc = { existing_claim = "shared-data" } },
]
}

The files must be readable by the user and the group of the Backend pod (1010 by default).

Host library

The host library exists only in Single Server mode, and only when the primary storage is a folder on the server. Then the Backend by default shares the file system of the server with all users as a read-only data library with the ID host. Users can then import any file that the system user of the Backend can read, with no copy into a library folder. With a bucket as the primary storage, and in Kubernetes, there is no host library.

MiLaboratories recommends to turn the host library off: it shows the files of the server to every user who signs in, also the files of the Backend itself. To turn it off, give --no-host-data-library (PL_NO_HOST_DATA_LIBRARY=true), and give the folders that users need as folder libraries.

Change or remove a library

A project keeps links to the files that users imported from a library in the modes Identity of the Backend, Access keys and Folder on the server or a volume, not copies. Thus some changes of a library change what projects can read. To add a library and to change its display name is safe. A new library ID makes a new library: the Backend keeps the old ID as a removed library, and the imported files stay linked to it.

  • To move a library to a per-user mode, copy its imported files into the primary storage first: see Change the access mode of a data library.
  • To remove a library, choose what happens to the projects that use it: see Remove a data library. The Backend checks a removed library at each start too, and it does not start when it cannot list it.

Problems

Users do not see the library

Cause: the Backend did not get the new settings. Fix: make sure that the Backend restarted after the change. When the Backend cannot read the library, it does not start: see the next problem.

The Backend does not start after a change of a library

Cause: the Backend cannot list a library that is in its settings: the bucket, its access rights or its keys changed. The log of the Backend says Cannot list storage with the library ID. Fix: give the Backend read access to the library again. This is also necessary for a library that you removed from the settings: the Backend checks it at each start too. See Remove a data library.

Users see “access denied” for some files

Cause: in the federated and the Google account modes, the cloud decides what each user can read. Fix: none is necessary when this is the intended rule; else change the rights of the user in the cloud.

Limits

  • Platforma cannot write to a data library.
  • In Kubernetes, the federated and the Google account modes are set with Backend options in extraArgs: the Helm chart does not check them.
  • In Kubernetes, a Google Cloud Storage library cannot use a key file.

Next