Change the access mode of a data library
Move a data library to a mode in which each user reads it with an identity of their own, and keep the projects that use it.
In the modes Identity of the Backend and Access keys, the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary reads a library with one identity for all users, and every user can read every file. In the per-user modes, Federated user access and Google account of the user, each user reads with an identity of their own, so the cloud account of your company decides what each user can read. A move to a per-user mode changes the projects that already use the library:
- Files that users imported before the change. In a mode with one identity, a project keeps a link to each imported file, not a copy. In a per-user mode, the Backend reads the library only for a signed-in user, so a BlockBlock — A small application for one step of an analysis, for example the import of reads or clustering. It can combine several tools. Glossary that reads such a file again fails. Copy these files into the primary storageprimary storage — The bucket (Amazon S3 or Google Cloud Storage) or folder where Platforma keeps all results and uploaded files. Glossary before the change: the projects then use the copies, and the change does not touch them.
- Files that users import after the change. Each import copies the file into the primary storage, so the project does not need the library for it any more.
These moves are possible:
| The library | Per-user modes |
|---|---|
| Amazon S3 bucket | Federated user access |
| Google Cloud Storage bucket | Federated user access, Google account of the user |
| Folder on the server or a volume | None: the per-user modes read only buckets |
A move back, from a per-user mode to a mode with one identity, does not change the projects: their files are already in the primary storage. After it, every user can read every file of the library.
Before you start
- Sign-insign in — To show the Backend who you are, with a sign-in provider or a single-user token. The verb is "sign in"; the noun and the adjective are "sign-in". Glossary with SSOsingle sign-on — Sign-in through the identity service of the company, with the same account as for other company systems. Glossary. Both per-user modes take the identity of the user from the SSO sign-in: federated user access needs an SSO provider that the cloud account trusts. The Google account of the user needs SSO through Google. When users sign in with a static list of usersstatic list of users — A sign-in provider that is a file with the logins and the password hashes of the users, in the htpasswd format. The Backend reads it again when it changes. Glossary or LDAPLDAP — The directory of users of a company. The Backend can check logins and passwords in it. Glossary now, move them to SSO first, as a separate change: see Migrate between sign-in providers.
- The cloud side. For federated user access, the cloud account trusts the corporate identity provider and gives each user the rights to the bucket. For the Google account of the user, the Google account of each user gets the rights to the bucket. See Federated user access and Google account of the user.
- Space in the primary storage. The copy takes the files of the library that projects use, not the whole library. Make sure that the primary storage has space for them.
- A backup. Make a backup of the database: see Make a backup now.
- A time window. From the start of the copy until the Backend starts in the new mode, users cannot work. The time depends on the size of the imported files. Tell the users before.
- The same 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. Keep the ID of the library. A new ID makes a new library, and the projects keep their links to the old one.
Copy the files of a library into the primary storage
The Backend option --migrate-blobs-to-primary copies the files that projects imported from a
library into the primary storage. It copies each file whose only copy is in the library, and then
the Backend stops. After the copy, the projects do not need the library for these files. Run it
while the library is still in the settings, in its old mode: the Backend reads the library with
its own identity, the access keys or from the folder.
-
Add the option
--migrate-blobs-to-primary=<library ID>toextraArgs(Helm) orbackend_service.extra_args(Terraform), and upgrade the release. This option is not covered by the chart values or the module inputs. The Backend copies the files and then stops; KubernetesKubernetes — A system that runs programs on a group of machines (a cluster). Platforma can run in a Kubernetes cluster. Glossary starts it again, and each new start does the copy again, which does not change the copied files. Users cannot work during this time.terraform.tfvars backend_service = {extra_args = ["--migrate-blobs-to-primary=lab-archive"]}values.yaml extraArgs:- "--migrate-blobs-to-primary=lab-archive" -
Look at the log of the Backend. When it shows
All blobs migrated to primary storage, the copy is complete: remove the option, and in the same upgrade make the change that you prepared. When it showsBlob migration completed with failures, some files were not copied: do not change the access mode or remove the library. Find the cause in the log, then upgrade again.
-
Stop the Backend service, then run the Backend one time with the option
--migrate-blobs-to-primary <library ID>, with all its other settings. It copies the files and then stops. -
Make sure that the copy is complete. When a file cannot be copied, the Backend logs
Blob migration completed with failuresand exits with code 1: do not change the access mode or remove the library. When the copy is complete, make the change that you prepared, then start the Backend service.
Switch the access mode
Make this change in the same upgrade or restart that removes --migrate-blobs-to-primary, so that
users cannot import new files between the copy and the switch. For the options of each mode, see
Federated user access and
Google account of the user.
Keep the library in dataLibraries (Helm) or backend_service.data_libraries (Terraform) with
the same id. Remove its access keys: a library with federated user access cannot have keys. Add
the options of the new mode to extraArgs or backend_service.extra_args, then upgrade the
release:
dataLibraries: - id: lab-archive # the same ID as before name: "Lab archive" s3: { bucket: lab-archive-bucket, region: eu-central-1 } # no access keysextraArgs: # remove: - "--migrate-blobs-to-primary=lab-archive" - "--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"backend_service = { data_libraries = [ { id = "lab-archive" # the same ID as before name = "Lab archive" s3 = { bucket = "lab-archive-bucket", region = "eu-central-1" } # no access keys }, ] extra_args = [ # remove: "--migrate-blobs-to-primary=lab-archive", "--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", ]}Change the options of the library in the Backend service: keep the library ID, remove the access keys, and add the options of the new mode. Then start the Backend service.
Check the result
- The Backend starts. The Backend does not check a library in a per-user mode at start, so a wrong setting of the mode shows only when a user opens the library.
- A user sees the library. Sign in with SSO as a user who has the rights in the cloud, and open the 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: it shows the files that the cloud lets this user read. When the user sees “access denied”, see Problems.
- Old projects work. Open a project that used files of the library before the change, and run again a Block that reads them. It runs without the library: it reads the copies in the primary storage.
- New imports work. Import a file from the library into a project. The import copies the file into the primary storage.
To go back, set the old mode of the library again and upgrade the release, or restart the Backend 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 copies in the primary storage stay, and the projects keep them.