comparison scripts/api/setup-all.sh @ 10:a50cf11e5178

Rewrite LGDataverse completely upgrading to dataverse4.0
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 08 Sep 2015 17:00:21 +0200
parents
children
comparison
equal deleted inserted replaced
9:5926d6419569 10:a50cf11e5178
1 #!/bin/bash
2 command -v jq >/dev/null 2>&1 || { echo >&2 '`jq` ("sed for JSON") is required, but not installed. Download the binary for your platform from http://stedolan.github.io/jq/ and make sure it is in your $PATH (/usr/bin/jq is fine) and executable with `sudo chmod +x /usr/bin/jq`. On Mac, you can install it with `brew install jq` if you use homebrew: http://brew.sh . Aborting.'; exit 1; }
3
4 echo "deleting all data from Solr"
5 curl http://localhost:8983/solr/update/json?commit=true -H "Content-type: application/json" -X POST -d "{\"delete\": { \"query\":\"*:*\"}}"
6
7 SERVER=http://localhost:8080/api
8
9 # Everything + the kitchen sink, in a single script
10 # - Setup the metadata blocks and controlled vocabulary
11 # - Setup the builtin roles
12 # - Setup the authentication providers
13 # - setup the settings (local sign-in)
14 # - Create admin user and root dataverse
15 # - (optional) Setup optional users and dataverses
16
17
18 echo "Setup the metadata blocks"
19 ./setup-datasetfields.sh
20
21 echo "Setup the builtin roles"
22 ./setup-builtin-roles.sh
23
24 echo "Setup the authentication providers"
25 ./setup-identity-providers.sh
26
27 echo "Setting up the settings"
28 echo "- Allow internal signup"
29 curl -X PUT -d yes "$SERVER/admin/settings/:AllowSignUp"
30 curl -X PUT -d /dataverseuser.xhtml?editMode=CREATE "$SERVER/admin/settings/:SignUpUrl"
31
32 curl -X PUT -d doi "$SERVER/admin/settings/:Protocol"
33 curl -X PUT -d 10.5072/FK2 "$SERVER/admin/settings/:Authority"
34 curl -X PUT -d EZID "$SERVER/admin/settings/:DoiProvider"
35 curl -X PUT -d / "$SERVER/admin/settings/:DoiSeparator"
36 curl -X PUT -d burrito $SERVER/admin/settings/BuiltinUsers.KEY
37 curl -X PUT -d empanada $SERVER/admin/settings/:BlockedApiKey
38 curl -X PUT -d localhost-only $SERVER/admin/settings/:BlockedApiPolicy
39 echo
40
41 echo "Setting up the admin user (and as superuser)"
42 adminResp=$(curl -s -H "Content-type:application/json" -X POST -d @data/user-admin.json "$SERVER/builtin-users?password=admin&key=burrito")
43 echo $adminResp
44 curl -X POST "$SERVER/admin/superuser/dataverseAdmin"
45 echo
46
47 echo "Setting up the root dataverse"
48 adminKey=$(echo $adminResp | jq .data.apiToken | tr -d \")
49 curl -s -H "Content-type:application/json" -X POST -d @data/dv-root.json "$SERVER/dataverses/?key=$adminKey"
50 echo
51 echo "Set the metadata block for Root"
52 curl -s -X POST -H "Content-type:application/json" -d "[\"citation\"]" $SERVER/dataverses/:root/metadatablocks/?key=$adminKey
53 echo
54 echo "Set the default facets for Root"
55 curl -s -X POST -H "Content-type:application/json" -d "[\"authorName\",\"subject\",\"keywordValue\",\"dateOfDeposit\"]" $SERVER/dataverses/:root/facets/?key=$adminKey
56 echo
57
58 # OPTIONAL USERS AND DATAVERSES
59 #./setup-optional.sh
60
61 echo "Setup done. Consider running post-install-api-block.sh for blocking the sensitive API."