forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 2
Developing backend
MajoBerger edited this page Aug 2, 2022
·
26 revisions
Also checkout
In order to connect to database, follow these steps:
- If run in docker, first exec into it like so:
sudo docker exec -it dspacedb /bin/bash
- Then login to postgres with user dspace like so:
psql -U dspace
(You might need to locate psql. It can be placed in postgres installation folder or in its subfolder/bin
)- As shell suggests, type help for help.
- Misc useful commands:
-
\dt
to see all tables -
\d tablename
to describe table, e.g.\d eperson
-
select * from eperson;
to see all entries in eperson. Note the ; here, which is missing in\d
commands.
-
In dspace/config/submission-forms.xml set input type to <input-type>autocomplete</input-type>
and the values will be loaded from the appropriate metadata field.
How to harvest in the Docker
Related issue: https://github.com/dataquest-dev/dspace-angular/issues/48
- go to [dspace-angular] - in our case /opt/actions-runner-dq-1/_work/dspace-angular/dspace-angular Dataquest-access
- remove entrypoint in the docker/cli.yml
- connect to the docker-cli:
docker-compose --env-file /opt/actions-runner-dq-1/_work/dspace-angular/dspace-angular/build-scripts/import/../run/envs/.default -p dq-d7 -f docker/cli.yml run -v $(pwd)/build-scripts/import/assets:/assets --rm dspace-cli /bin/bash
- create collection:
./dspace structure-builder -f /assets/test_community_collection.xml -o /assets/test_import_output.xml -e [email protected]
- prepare collection for harvesting:
./dspace harvest -s -c 123456789/2 -a http://lindat.mff.cuni.cz/repository/oai/request -i hdl_11234_3430 -m dc -t 1 -e [email protected]
- harvest to the collection:
./dspace harvest -r -c 123456789/2 -a http://lindat.mff.cuni.cz/repository/oai/request -i hdl_11234_3430 -m dc -t 1 -e [email protected]
Unresolved problems:
- The script harvest.sh harvest the items to the collection 123456789/2 but it works only in the first run because database remember all historical collection ids.
- Add the custom metadata to the local-types.xml
- Run
mvn package
in the [dspace-source]/dspace - Run
ant fresh_install
in the [dspace-source]/dspace/targer/dspace-installer - Run
dspace database migrate force
in the [dspace-source]/bin
- Login as an Administrator
- In the side menu that appears, open the "Registries" menu. Click on "Metadata". This is where all your Metadata fields are defined
- Now, you'll see a list of all the metadata schema that DSpace is initialized with. click on the "local" schema to see its fields
- The "local" schema is empty by default, so no fields should appear. But, you can add a new field by minimally adding an Element & clicking Save. For example, to create "local.myfield", place the text "myfield" in the Element and click Save. To add a field named "local.myfield.other", add the text "myfield" in the Element and "other" in Qualifier and click Save.
- Here's the endpoint which is used: https://github.com/DSpace/RestContract/blob/main/metadatafields.md#creating-a-metadata-field
Some changes are not pushed to the testEnvironment.zip after command mvn package
because:
- '/target/' folder needs to be updated - run
mvn clean package
not justmvn package
- After running the test, the 'testEnvironment.zip' is loaded from the .m2 and not created - remove it from the .m2.