Page MenuHomeSoftware Heritage
Paste P964

Deposit-keycloak tryouts from docker
ActivePublic

Authored by ardumont on Feb 25 2021, 11:37 AM.
Start docker container with docker-compose override on the deposit repository:
In the following:
#+begin_src sh
alias swh-doco-keycloak="docker-compose -f docker-compose.yml -f docker-compose.keycloak.yml -f docker-compose.override.yml"
#+end_src
```
#+begin_src sh
swh-doco-keycloak up -d
#+end_src
Then, the user hal is created appropriately by the docker up routine.
It's not created automatically deposit side yet so, we need to create it for now:
#+begin_src sh
$ swh-doco-keycloak exec swh-deposit /bin/bash
+ cd /home/tony/work/inria/repo/swh/swh-environment/docker
+ docker-compose -f docker-compose.yml -f docker-compose.keycloak.yml -f docker-compose.override.yml exec swh-deposit /bin/bash
swh@45d1749587e8:/$ swh deposit admin user create --username hal --provider-url https://hal.archives-ouvertes.fr/ --domain archives-ouvertes.fr
Collection 'hal' exists, skipping.
Update user 'hal'.
User 'hal' updated.
#+end_src
Then, checks:
#+begin_src sh
$ curl -u hal:test http://localhost:5080/deposit/1/servicedocument/
<?xml version="1.0" ?>
<service xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:sword="http://purl.org/net/sword/terms/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns="http://www.w3.org/2007/app">
<sword:version>2.0</sword:version>
<sword:maxUploadSize>209715200</sword:maxUploadSize>
<workspace>
<atom:title>The Software Heritage (SWH) Archive</atom:title>
<collection href="http://localhost:5080/deposit/1/hal/">
<atom:title>hal Software Collection</atom:title>
<accept>application/zip</accept>
<accept>application/x-tar</accept>
<sword:collectionPolicy>Collection Policy</sword:collectionPolicy>
<dcterms:abstract>Software Heritage Archive</dcterms:abstract>
<sword:treatment>Collect, Preserve, Share</sword:treatment>
<sword:mediation>false</sword:mediation>
<sword:metadataRelevantHeader>false</sword:metadataRelevantHeader>
<sword:acceptPackaging>http://purl.org/net/sword/package/SimpleZip</sword:acceptPackaging>
<sword:service>http://localhost:5080/deposit/1/hal/</sword:service>
<sword:name>hal</sword:name>
</collection>
</workspace>
</service>
$ swh deposit upload --url http://localhost:5080/deposit \
--username hal \
--password test \
--metadata ../deposit-swh.update-metadata.xml --format json
WARNING:swh.deposit.cli.client:The metadata file provided should contain "<swh:create_origin>" or "<swh:add_to_origin>" tag
{"deposit_id": "1", "deposit_status": "done", "deposit_status_detail": null, "deposit_date": "Feb. 25, 2021, 9:13 a.m."}
$ swh deposit status --url http://localhost:5080/deposit \
--username hal \
--password test \
--deposit-id 1
INFO:swh.deposit.cli.client:{'deposit_id': '1', 'deposit_status': 'done', 'deposit_status_detail': 'The deposit has been successfully loaded into the Software Heritage archive', 'deposit_swh_id': 'swh:1:dir:2ddb1f0122c57c8479c28ba2fc973d18508e6420', 'deposit_swh_id_context': 'swh:1:dir:2ddb1f0122c57c8479c28ba2fc973d18508e6420', 'deposit_external_id': None}
#+end_src