june-updates #8
6 changed files with 524 additions and 23 deletions
|
|
@ -113,31 +113,88 @@ steps 1 through 3.
|
||||||
|
|
||||||
### 2. \[Optional\] Create the `files` table
|
### 2. \[Optional\] Create the `files` table
|
||||||
|
|
||||||
The [files
|
The [files table]({{% relref "register-data#table-files" %}}) is an
|
||||||
table]({{% relref "register-data#table-files" %}}) is
|
optional addition to the tabby record and lists one or more files that
|
||||||
an optional addition to the tabby record and lists one or more files
|
form part of the DataLad dataset. Such a file listing can be easily
|
||||||
that form part of the DataLad dataset. Such a file listing can be easily
|
generated based on the output of
|
||||||
generated based on the output of `datalad status` - see the
|
[ls_file_collection](https://docs.datalad.org/projects/next/en/latest/generated/datalad.api.ls_file_collection.html)
|
||||||
[status2tabby.py](https://github.com/sfb1451/tabby-utils/blob/main/status2tabby.py)
|
provided by Datalad-next. Below, we present an example implementation,
|
||||||
script, which uses the `datalad-next` extension, for an example
|
which you can also use directly.
|
||||||
implementation that you can also use directly:
|
|
||||||
|
|
||||||
``` None
|
Note that files which are present will be checksummed; for annexed
|
||||||
usage: status2tabby.py [-h] dataset outfile
|
files which are not present locally the checksum will be taken from
|
||||||
|
the annex key. This assumes that DataLad's default backend (MD5E) is
|
||||||
|
used; adjust the code for different checksums if necessary.
|
||||||
|
|
||||||
positional arguments:
|
|
||||||
dataset Dataset for which files will be listed
|
|
||||||
outfile Name of tsv file to write
|
|
||||||
|
|
||||||
options:
|
```python {lineNos=true, style=catppuccin-latte}
|
||||||
-h, --help show this help message and exit
|
"""Generate a TSV file listing the files in a dataset
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
python this_file.py dataset outfile
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
from csv import DictWriter
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
from datalad.api import ls_file_collection
|
||||||
|
|
||||||
|
|
||||||
|
def match_md5(key):
|
||||||
|
"""Report MD5 checksum contained in annex key
|
||||||
|
|
||||||
|
Assumes MD5E backend (DataLad's default).
|
||||||
|
https://git-annex.branchable.com/internals/key_format/
|
||||||
|
|
||||||
|
"""
|
||||||
|
m = re.match(r"MD5E-s\d+--([a-f0-9]{32})", key)
|
||||||
|
return m.group(1) if m is not None else None
|
||||||
|
|
||||||
|
|
||||||
|
def transform_result(res):
|
||||||
|
"""Transform results to get required information
|
||||||
|
|
||||||
|
Processes the outputs of ls_file_collection to get relative path,
|
||||||
|
size in bytes, and md5 checksum. For annex keys which are not
|
||||||
|
present, the checksum will be taken from the annex key, if
|
||||||
|
possible. Keys match the sfb1451 tabby specification.
|
||||||
|
|
||||||
|
"""
|
||||||
|
path = res["item"].relative_to(res["collection"]).as_posix()
|
||||||
|
size = res["annexsize"] if res["type"] == "annexed file" else res["size"]
|
||||||
|
checksum = res.get("hash-md5")
|
||||||
|
|
||||||
|
if checksum is None and res["type"] == "annexed file":
|
||||||
|
checksum = match_md5(res["annexkey"])
|
||||||
|
|
||||||
|
return {"path[POSIX]": path, "size[bytes]": size, "checksum[md5]": checksum}
|
||||||
|
|
||||||
|
|
||||||
|
parser = ArgumentParser()
|
||||||
|
parser.add_argument("dataset", type=Path, help="Dataset for which files will be listed")
|
||||||
|
parser.add_argument("outfile", type=Path, help="Name of the tsv file to write")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
fc = ls_file_collection(
|
||||||
|
"annexworktree",
|
||||||
|
args.dataset,
|
||||||
|
hash="md5",
|
||||||
|
result_renderer="disabled",
|
||||||
|
result_xfm=transform_result,
|
||||||
|
return_type="generator",
|
||||||
|
)
|
||||||
|
|
||||||
|
with args.outfile.open("w", encoding="utf-8", newline="") as tsvfile:
|
||||||
|
fieldnames = ["path[POSIX]", "size[bytes]", "checksum[md5]"]
|
||||||
|
writer = DictWriter(tsvfile, delimiter="\t", fieldnames=fieldnames)
|
||||||
|
writer.writeheader()
|
||||||
|
for row in fc:
|
||||||
|
writer.writerow(row)
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!INFO]
|
|
||||||
> Another (more performant) alternative is to use the
|
|
||||||
> [ls_file_collection](http://docs.datalad.org/projects/next/en/latest/generated/datalad.api.ls_file_collection.html)
|
|
||||||
> function from DataLad-next, and transform its output.
|
|
||||||
|
|
||||||
### 3. Publish the metadata
|
### 3. Publish the metadata
|
||||||
|
|
||||||
For manual deposition, copy and send all tabby records to the INF
|
For manual deposition, copy and send all tabby records to the INF
|
||||||
|
|
|
||||||
191
content/walkthroughs/forgejo-encryption.md
Normal file
191
content/walkthroughs/forgejo-encryption.md
Normal file
|
|
@ -0,0 +1,191 @@
|
||||||
|
+++
|
||||||
|
date = '2025-06-17T18:45:00+02:00'
|
||||||
|
draft = false
|
||||||
|
title = 'Forgejo with encryption'
|
||||||
|
+++
|
||||||
|
|
||||||
|
This walkthrough demonstrates how to encrypt annexed file content in Forgejo,
|
||||||
|
a bare Git repository, or another Git hosting platform with annex support.
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
When storing DataLad datasets on third party infrastructure, Git
|
||||||
|
remotes and git-annex special remotes are often configured pointing to
|
||||||
|
different services. However, some repository hosting services
|
||||||
|
(e.g. G-node GIN, or some instances of Forgejo), as well as bare Git
|
||||||
|
repositories[^1] on systems with git-annex installed, support storing
|
||||||
|
annex objects alongside the Git repository, which makes them very
|
||||||
|
convenient in terms of configuration and usage. Throughout the
|
||||||
|
article, we will refer to remotes supporting both Git and annex
|
||||||
|
content as "git+annex". For background, see DataLad handbook's chapter
|
||||||
|
[Beyond shared
|
||||||
|
infrastructure](https://handbook.datalad.org/en/latest/basics/101-138-sharethirdparty.html).
|
||||||
|
|
||||||
|
Some of the SFB1451 datasets may require using data encryption at rest
|
||||||
|
to guarantee data privacy or access control. Git-annex [supports
|
||||||
|
encryption](https://git-annex.branchable.com/encryption/) and it can
|
||||||
|
be very easy to set up. However, encryption is configured for *special
|
||||||
|
remotes* and as such it would not apply to such "git+annex" remotes[^2].
|
||||||
|
|
||||||
|
This has been addressed in [git-annex v.10.20250520](https://git-annex.branchable.com/news/version_10.20250520/)
|
||||||
|
by the addition of the [mask special remote](https://git-annex.branchable.com/special_remotes/mask/).
|
||||||
|
|
||||||
|
With the mask special remote, setting up encrypted storage for
|
||||||
|
git+annex comes down to the following steps:
|
||||||
|
|
||||||
|
- set up a Git remote,
|
||||||
|
- set up a mask special remote with encryption enabled,
|
||||||
|
- make sure that annexed contents are pushed only to the latter.
|
||||||
|
|
||||||
|
The model use case for this workflow is publishing datasets on Forgejo
|
||||||
|
instances with git-annex support. [Forgejo](https://forgejo.org/) is
|
||||||
|
a "self-hosted lightweight software forge", which can be used to set
|
||||||
|
up and maintain a platform similar to GitHub or GitLab.
|
||||||
|
[Forgejo-aneksajo](https://codeberg.org/forgejo-aneksajo/forgejo-aneksajo)
|
||||||
|
is a lightly modified version of Forgejo which adds git-annex support.
|
||||||
|
While no public instances are readily available, and the SFB1451 does
|
||||||
|
not (currently) maintain its own instance, it is nevertheless very
|
||||||
|
relevant for the SFB1451 community because Forgejo-aneksajo can be
|
||||||
|
deployed by individual groups (see [Collaborative infrastructure for a
|
||||||
|
lab: Forgejo](https://blog.datalad.org/posts/lab-infra-forgejo/) for
|
||||||
|
more background information).
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- git-annex v.10.20250520 or newer
|
||||||
|
- gpg, and a generated private/public key
|
||||||
|
- DataLad-next (optional but highly recommended)
|
||||||
|
|
||||||
|
## Walkthrough
|
||||||
|
|
||||||
|
### Initial set-up and publishing
|
||||||
|
|
||||||
|
Publishing a dataset requires having a dataset in the first place.
|
||||||
|
In this example we create a dataset with one file in Git (README) and one file annexed (an image).
|
||||||
|
|
||||||
|
```
|
||||||
|
datalad create foo
|
||||||
|
cd foo
|
||||||
|
echo "Hello world" > README
|
||||||
|
datalad download https://images.pexels.com/photos/21533358/pexels-photo-21533358.jpeg
|
||||||
|
datalad save --to-git -m "Add a readme" README
|
||||||
|
datalad save -m "Add a photo of a penguin" pexels-photo-21533358.jpeg
|
||||||
|
```
|
||||||
|
|
||||||
|
Add a Git remote pointing to a valid address -- for example, an empty Forgejo-aneksajo repository,
|
||||||
|
or (for easier testing) a local bare git repository.
|
||||||
|
|
||||||
|
{{< tabs >}}
|
||||||
|
{{% tab title="forgejo" %}}
|
||||||
|
```
|
||||||
|
git remote add origin https://hub.example.com/user/dataset.git
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{% tab title="local" %}}
|
||||||
|
```
|
||||||
|
git init --bare /tmp/foo.git
|
||||||
|
git remote add origin /tmp/foo.git
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
Push (only the Git part -- we do not want to send unencrypted data)
|
||||||
|
to ensure that the remote repository is initialized with annex UUID.
|
||||||
|
|
||||||
|
```
|
||||||
|
datalad push --to origin --data nothing
|
||||||
|
```
|
||||||
|
|
||||||
|
At this point, the remote should be recognized by Git-annex, and have an annex UUID.
|
||||||
|
You can check this with `git annex info origin`.
|
||||||
|
If the UUID is present, the mask remote can be set up[^3].
|
||||||
|
Replace the value of the `keyid` parameter with the ID (either e-mail or the numeric key ID) of your GPG key.
|
||||||
|
|
||||||
|
```
|
||||||
|
git annex initremote encrypted-origin type=mask remote=origin encryption=hybrid keyid=me@example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
With the remote configuration, the annexed content and the Git content can be pushed *separately* to these remotes.
|
||||||
|
|
||||||
|
```
|
||||||
|
datalad push --to encrypted-origin
|
||||||
|
datalad push --data nothing --to origin
|
||||||
|
```
|
||||||
|
|
||||||
|
That's it! The repository is a regular repository, but the annexed content can not be accessed.
|
||||||
|
The web interface will show the file tree, but report that the files are unavailable.
|
||||||
|
Cloning the repository is possible, but getting the annexed content requires possession of a private GPG key
|
||||||
|
for which the encryption has been enabled[^4].
|
||||||
|
|
||||||
|
### Automating
|
||||||
|
|
||||||
|
Remembering to push to the mask remote first, and to use `--data nothing` with the unencrypted remote
|
||||||
|
can be tedious and error prone.
|
||||||
|
However, both of these behaviors can be automated.
|
||||||
|
Git-annex wanted mechanism can be used to state that no data are wanted by the unencrypted remote.
|
||||||
|
DataLad's publication dependency can be used to say that the encrypted remote should be pushed automatically
|
||||||
|
when a push to origin is requested.
|
||||||
|
|
||||||
|
```
|
||||||
|
git annex wanted origin "exclude=*"
|
||||||
|
datalad siblings configure -s origin --publish-depends encrypted-origin
|
||||||
|
```
|
||||||
|
|
||||||
|
With this, it is sufficient to `datalad push --to origin`[^5].
|
||||||
|
|
||||||
|
This can be taken even further.
|
||||||
|
For example, only *some* annexed files can be pushed encrypted.
|
||||||
|
It is advisable to configure the encrypted and regular remotes with opposite settings to avoid duplicating the storage.
|
||||||
|
For example, consider a situation where raw images are stored encrypted, but jpegs are not:
|
||||||
|
|
||||||
|
```
|
||||||
|
git annex wanted origin include=*jpeg
|
||||||
|
git annex wanted encrypted-origin include=*arw
|
||||||
|
```
|
||||||
|
|
||||||
|
## Looking under the hood
|
||||||
|
|
||||||
|
Although we used Forgejo as an example (due to its potential relevance),
|
||||||
|
the walkthrough is valid for any "git+annex" repository. Using a local
|
||||||
|
bare Git repository is a good way to "look under the hood" and see that
|
||||||
|
the annex keys in the bare repository are indeed stored encrypted,
|
||||||
|
with HMAC hashing of the filenames.
|
||||||
|
|
||||||
|
The example below shows the annex objects directory with three files,
|
||||||
|
two encrypted and one unencrypted.
|
||||||
|
|
||||||
|
```
|
||||||
|
❱ tree ../foo.git/annex/objects
|
||||||
|
../foo.git/annex/objects
|
||||||
|
├── 39e
|
||||||
|
│ └── bcf
|
||||||
|
│ └── GPGHMACSHA1--2c4b73cff92c9d186065f338551f8c5c8ec94b5b
|
||||||
|
│ └── GPGHMACSHA1--2c4b73cff92c9d186065f338551f8c5c8ec94b5b
|
||||||
|
├── 727
|
||||||
|
│ └── f52
|
||||||
|
│ └── GPGHMACSHA1--fbcb8f7931cb90c8fa9930368bfae671f36fec6b
|
||||||
|
│ └── GPGHMACSHA1--fbcb8f7931cb90c8fa9930368bfae671f36fec6b
|
||||||
|
└── a45
|
||||||
|
└── ab5
|
||||||
|
└── SHA256E-s2273030--fbeaece1f05264c39781adeac159ba33fbc1f4d2aea273106600bc4e3e3aa6c7.jpeg
|
||||||
|
└── SHA256E-s2273030--fbeaece1f05264c39781adeac159ba33fbc1f4d2aea273106600bc4e3e3aa6c7.jpeg
|
||||||
|
```
|
||||||
|
|
||||||
|
In Forgejo, the layout would be identical.
|
||||||
|
|
||||||
|
|
||||||
|
[^1]: Bare Git repository is a repository which does not contain a working directory.
|
||||||
|
It can be cloned from and pushed to.
|
||||||
|
See [Git on the server](https://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server) in the Pro Git book.
|
||||||
|
[^2]: Git annex does have a [git special remote](https://git-annex.branchable.com/special_remotes/git/),
|
||||||
|
but its purpose is to record a Git remote URL in the repository (normally, Git remote URL is a local configuration)
|
||||||
|
and optionally autoenable it. It does not provide a way to set up encryption.
|
||||||
|
[^3]: In Forgejo-aneksajo versions prior to 11.0-0-git-annex2, the UUID was not always assigned immediately;
|
||||||
|
see discussion in [forgejo-aneksajo/issues/22](https://codeberg.org/forgejo-aneksajo/forgejo-aneksajo/issues/22).
|
||||||
|
A workaround was to perform any action (including viewing the page) in the web interface.
|
||||||
|
If the UUID is empty, visit the repository page in a browser (or refresh it) and try `git annex info origin` again.
|
||||||
|
[^4]: In the hybrid encryption scheme, data is encrypted using a symmetric cipher,
|
||||||
|
and that cipher is asymmetrically encrypted (to selected GPG keys) and stored in the Git repository.
|
||||||
|
This means that new recipient keys can be added without having to re-encrypt the data.
|
||||||
|
See the documentation for [git annex encryption](https://git-annex.branchable.com/encryption/).
|
||||||
|
[^5]: or `git annex push` which by default pushes to all available remotes
|
||||||
253
content/z03/access-data.md
Normal file
253
content/z03/access-data.md
Normal file
|
|
@ -0,0 +1,253 @@
|
||||||
|
+++
|
||||||
|
date = '2025-02-12T18:01:59+01:00'
|
||||||
|
draft = false
|
||||||
|
title = 'Accessing motor assesment data collection on Windows'
|
||||||
|
weight = 4
|
||||||
|
+++
|
||||||
|
|
||||||
|
This note will explain in detail how to set-up your local copy of the aggregated motor assesment data, and help deal with potential configuration-dependent obstacles.
|
||||||
|
|
||||||
|
Overview of the encrypted workflow and prerequisites are explained in the [encrypted workflow](z3-encrypted-workflow/) page. It is highly recommended that you read it first.
|
||||||
|
|
||||||
|
The note assumes that you are working on Windows and using cmd shell. It also assumes that you have access to the shared Sciebo folder, and the data is being encrypted to your GPG key.
|
||||||
|
|
||||||
|
## Before you begin
|
||||||
|
|
||||||
|
### GPG
|
||||||
|
|
||||||
|
If you install Git (which is a requirement for using DataLad), it comes with its own `gpg` executable. If you install gpg4win (which is the solution recommended for digital signatures in our docs on [Input signing](digital-signatures) it naturally comes with a separate `gpg` executable. This means it is possible to have two GPG programs... which store their data (e.g. keys) in completely different locations on your computer.
|
||||||
|
|
||||||
|
What's more, in this case, git-annex operations will default to using the one which came with Git, while user operations (be it via Kleopatra GUI or the command line) will more than likely[^1] use the one which came with gpg4win. This can become confusing. Fortunately, git-annex behaviour is configurable. The goal here is to have both the user and git-annex interact with the same `gpg` executable.
|
||||||
|
|
||||||
|
If you do not have gpg4win: you probably do not need to do anything.
|
||||||
|
|
||||||
|
If you have gpg4win and used it to generate (or import) your private key, you need to configure Git and git-annex to use this one.
|
||||||
|
|
||||||
|
First, find out the path to the gpg executable. The path components would tell you whether it came with Git or gpg4win - the latter is more likely.
|
||||||
|
|
||||||
|
```
|
||||||
|
where gpg
|
||||||
|
```
|
||||||
|
|
||||||
|
Then (if it is gpg4win) tell Git to use this one. Git-annex obeys the same setting. Replace `PATH/TO/GPG` with the path reported by the previous command.
|
||||||
|
|
||||||
|
```
|
||||||
|
git config gpg.program PATH/TO/GPG
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### GPG-agent
|
||||||
|
|
||||||
|
Operations which use your secret key (like downloading encrypted data with git-annex or listing your secret keys with `gpg --list-secret-keys`) require interactions with a program called `gpg-agent` [^2]. Normally, `gpg-agent` should be running in the background, and there is nothing to do.
|
||||||
|
|
||||||
|
If you notice gpg-agent is not running (e.g. `get` fails with an error message which says that gpg-agent is not running, or you can not list your secret keys), you can start the gpg-agent with:
|
||||||
|
|
||||||
|
```
|
||||||
|
gpg-connect-agent reloadagent /bye
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sciebo token (app password)
|
||||||
|
|
||||||
|
Instead of using your pasword (the one you use to log in to Sciebo), it is recommended to generate a token for use with DataLad & git-annex. Tokens are like passwords, but they are generated by the website rather than created by the user. A token can be revoked when it is no longer used or there is a risk that it got exposed.
|
||||||
|
|
||||||
|
To generate a token:
|
||||||
|
|
||||||
|
- log in to Sciebo
|
||||||
|
- click your username on the upper right and go to settings
|
||||||
|
- select Security
|
||||||
|
- scroll down to App passwords / tokens
|
||||||
|
- enter a token name and click "Create new app passcode"
|
||||||
|
- copy (and store safely) the username and token
|
||||||
|
|
||||||
|
The token name can be anything - it is only for your information, and will be displayed in the list of tokens, with the date of last use and an option to delete (revoke) the token.
|
||||||
|
|
||||||
|
|
||||||
|
## WebDAV URLs
|
||||||
|
|
||||||
|
When using DataLad & git-annex, you will connect to Sciebo through a protocol called WebDAV. For this, you need to know your WebDAV URL, which is slightly different than the URL you use to visit Sciebo's web interface.
|
||||||
|
|
||||||
|
### Base WebDAV URL
|
||||||
|
|
||||||
|
To find your WebDAV address:
|
||||||
|
|
||||||
|
- go to Sciebo (file view)
|
||||||
|
- click ⚙️ Settings in the lower left corner
|
||||||
|
- a "drawer" will slide up, showing your WebDAV URL
|
||||||
|
|
||||||
|
The WebDAV URL will look like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
https://fz-juelich.sciebo.de/remote.php/dav/files/j.doe%40fz-juelich.de/
|
||||||
|
```
|
||||||
|
|
||||||
|
### WebDAV URLs to folders
|
||||||
|
|
||||||
|
The URL above is pointing to your home directory. To access a specific folder, you will need to add some path components manually.
|
||||||
|
|
||||||
|
Most likely, a folder named `Z03` will be shared with you. It will contain some folders; `motor_export_data` is the relevant one.
|
||||||
|
|
||||||
|
The folder path relative to your home directory will depend on whether you move the shared folder or not. Assuming that `Z03` is in your home directory on Sciebo, the relative paths will be `Z03/motor_export_repo` and `Z03/motor_export_data`, respectively.
|
||||||
|
|
||||||
|
For use with DataLad, you will need to put the base URL and the relative paths together. Using the example above,
|
||||||
|
and assuming that the shared folder is in the top-level directory, the data folder URL (for initremote) is:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
https://fz-juelich.sciebo.de/remote.php/dav/files/j.doe%40fz-juelich.de/Z03/motor_export_data
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Distributed storage
|
||||||
|
|
||||||
|
There are two components to the dataset:
|
||||||
|
|
||||||
|
- The Git repository (which we can call a "lightweight dataset") contains information about content identity and availability, but does not contain the actual data.
|
||||||
|
- The content managed by git-annex ("annexed data"), i.e. the actual data.
|
||||||
|
|
||||||
|
For technical reasons they are stored and shared separately.
|
||||||
|
In the chart below, a square box symbolizes a Git remote, and cylinders symbolize Git-annex special remotes.
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
A(Your local dataset clone)
|
||||||
|
A ---o |clone, update| B["**JuGit** (public)"]
|
||||||
|
A ---o |initremote, get| C[("**Sciebo**
|
||||||
|
(restricted, encrypted)")]
|
||||||
|
A ---o |"🚫"| D[("**INM-7 storage**
|
||||||
|
(restricted, encrypted)")]
|
||||||
|
```
|
||||||
|
|
||||||
|
Retrieving data requires interacting with both the Git remote and the Git-annex special remote (key commands are shown over the lines).
|
||||||
|
Because no data are stored in JuGit, the repository can be made public, and fetching information from JuGit requires no credentials.
|
||||||
|
However, access to the data stored in Sciebo requires not only credentials, but also posession of a GPG key for which the data are encrypted.
|
||||||
|
Note that the Git repository also indexes data stored in INM7-storage, but that special remote is not accessible outside INM-7.
|
||||||
|
|
||||||
|
## Initial setup
|
||||||
|
|
||||||
|
#### Let git-annex know your token
|
||||||
|
|
||||||
|
Git-annex needs WebDAV credentials to access the stored repository and data.
|
||||||
|
It expects them to be provided via environment variables.
|
||||||
|
Set the environment variables with the `set` command (substitute your Sciebo username and token):
|
||||||
|
|
||||||
|
```
|
||||||
|
set WEBDAV_USERNAME=j.doe@fz-juelich.de
|
||||||
|
set WEBDAV_PASSWORD=XXXXX-XXXXX-XXXXX-XXXXX
|
||||||
|
```
|
||||||
|
|
||||||
|
Important: do not put the password in quotes (`""`), because `set` command treats them literally.
|
||||||
|
|
||||||
|
Tip: you can check the value of an environment variable with `echo`, e.g. `echo %WEBDAV_USERNAME%`.
|
||||||
|
|
||||||
|
The environment variables persist until you close your cmd.
|
||||||
|
However, these credentials will later be cached in a owner-read-only file in the clone,
|
||||||
|
so re-entering the credentials should not be needed for subsequent updates.
|
||||||
|
|
||||||
|
### Clone the dataset
|
||||||
|
|
||||||
|
Clone the (lightweight) dataset from JuGit (using the URL below) into a directory with a name of your choice
|
||||||
|
(here: `motor_export`):
|
||||||
|
|
||||||
|
```
|
||||||
|
datalad clone https://jugit.fz-juelich.de/m.szczepanik/motor-assesment.git motor_export
|
||||||
|
```
|
||||||
|
|
||||||
|
Then change your working directory to go into the dataset:
|
||||||
|
```
|
||||||
|
cd motor_export
|
||||||
|
```
|
||||||
|
|
||||||
|
### Initialize sciebo remote
|
||||||
|
|
||||||
|
Git-annex special remotes represent methods of accessing data, and special remote configuration contains things like access URL or encryption type to be used.
|
||||||
|
|
||||||
|
One weaknes of the Sciebo setup is that WebDAV URLs contain user names and instance names, so will be different for each user (even though the shared folder is, in principle, the same). The dataset already has a sciebo remote, but it points to FZJ's sciebo and Michał Szczepanik's user account. There is no easy way to reconfigure it, other than each user initializing a new remote pointing to *their* sciebo URL.
|
||||||
|
|
||||||
|
The trick is to initialize a special remote, and mark it *same as* the one above (meaning that we expect to reach exactly the same place, just through different means).
|
||||||
|
|
||||||
|
This is by far the most involved part of the setup.
|
||||||
|
|
||||||
|
#### (optional): check available remotes
|
||||||
|
Each special remote has its own ID and assigned name, which can be used interchangeably with git-annex commands. To list remotes known to the dataset, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
git annex info
|
||||||
|
```
|
||||||
|
|
||||||
|
Pending future changes, the remote we want to enable is going to be named sciebo-storage,
|
||||||
|
i.e. it will be this one:
|
||||||
|
|
||||||
|
```
|
||||||
|
325dd4e6-e71b-4512-bce6-0eb574b6ed15 -- sciebo-storage
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Initialize your own private special remote
|
||||||
|
|
||||||
|
As explained above, you will need to initialize a special remote for yourself, and mark it "same as" the one above.
|
||||||
|
|
||||||
|
Here's the command broken up into multiple lines with a caret (`^`) for readability.
|
||||||
|
|
||||||
|
```
|
||||||
|
git annex initremote my-sciebo-storage^
|
||||||
|
--private^
|
||||||
|
--sameas sciebo-storage^
|
||||||
|
type=webdav^
|
||||||
|
url="<url of motor_export_storage>"
|
||||||
|
```
|
||||||
|
|
||||||
|
And this is the same as a one-liner:
|
||||||
|
|
||||||
|
```
|
||||||
|
git annex initremote my-sciebo-storage --private --sameas sciebo-storage type=webdav url="<url of motor_export_storage>"
|
||||||
|
```
|
||||||
|
|
||||||
|
Substitute the `<url of motor_export_storage>` with your data URL (the one which ends with `motor_export_data`)!
|
||||||
|
|
||||||
|
{{% notice style="note" %}}
|
||||||
|
In the example above, we enclosed the URL with double quotes (`"...")`.
|
||||||
|
Keep in mind that cmd distinguishes single- and double quotes and treats them differently!
|
||||||
|
Find out more in https://ss64.com/nt/syntax-esc.html
|
||||||
|
{{% /notice %}}
|
||||||
|
|
||||||
|
#### Troubleshooting
|
||||||
|
|
||||||
|
- If the error message complains about credentials (bearer authentication), most likely the credentials (environment variables) are incorrect.
|
||||||
|
- If the error message complains about gpg-agent not running, it is either not running or git-annex is using a different gpg than intended. See sections on gpg and gpg-agent above.
|
||||||
|
- If there is seemingly no error but data can not be downloaded, then probably the URL given to initremote was incorrect. Make sure that the URL points to `motor_export_data` (not `repo`).
|
||||||
|
|
||||||
|
|
||||||
|
## Data access
|
||||||
|
|
||||||
|
{{% notice style="note" %}}
|
||||||
|
This assumes your working directory is in the dataset (that you `cd`'ed into the dataset).
|
||||||
|
{{% /notice %}}
|
||||||
|
|
||||||
|
To download data, use:
|
||||||
|
|
||||||
|
```
|
||||||
|
datalad get output
|
||||||
|
```
|
||||||
|
|
||||||
|
To remove your local copy of the data, use `drop` which does the opposite of `get`:
|
||||||
|
|
||||||
|
```
|
||||||
|
datalad drop output
|
||||||
|
```
|
||||||
|
|
||||||
|
To obtain the latest version of the data, use:
|
||||||
|
|
||||||
|
```
|
||||||
|
datalad update --how merge
|
||||||
|
datalad get output
|
||||||
|
```
|
||||||
|
|
||||||
|
To see when the data (according to your local state) last changed, use `git log` (up/down arrows scroll, `Q` quits):
|
||||||
|
|
||||||
|
```
|
||||||
|
git log
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
[^1]: It would, at least in theory, be possible to modify the [PATH variable](https://en.wikipedia.org/wiki/PATH_(variable)) so that running `gpg` would use the Git-bundled gpg instead of the gpg4win gpg.
|
||||||
|
[^2]: You call `datalad get`, DataLad calls `git annex get`; git-annex calls `gpg --decrypt`, and gpg asks gpg-agent for a matching secret key.
|
||||||
|
[^3]: The credential name and username are stored in global (i.e. user) Git configuration, the password is stored in Windows' secret storage.
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
date = '2025-02-12T18:01:06+01:00'
|
date = '2025-02-12T18:01:06+01:00'
|
||||||
draft = false
|
draft = false
|
||||||
title = 'Digital signatures'
|
title = 'Digital signatures'
|
||||||
weight = 1
|
weight = 2
|
||||||
+++
|
+++
|
||||||
|
|
||||||
The data entry form supports the submission of a digital signature for
|
The data entry form supports the submission of a digital signature for
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
date = '2025-02-12T18:01:59+01:00'
|
date = '2025-02-12T18:01:59+01:00'
|
||||||
draft = false
|
draft = false
|
||||||
title = 'Encrypted workflow'
|
title = 'Encrypted workflow'
|
||||||
weight = 3
|
weight = 1
|
||||||
+++
|
+++
|
||||||
|
|
||||||
We are using DataLad to track and move around the motor assessment
|
We are using DataLad to track and move around the motor assessment
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
date = '2025-02-12T18:01:47+01:00'
|
date = '2025-02-12T18:01:47+01:00'
|
||||||
draft = false
|
draft = false
|
||||||
title = 'Local copies'
|
title = 'Local copies'
|
||||||
weight = 2
|
weight = 3
|
||||||
+++
|
+++
|
||||||
|
|
||||||
The contents of all form fields (except signature) can be saved
|
The contents of all form fields (except signature) can be saved
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue