-
Notifications
You must be signed in to change notification settings - Fork 24
Installing Zotero Components On a Mac
- Install Node
brew install node
- Install arkivo-sufia
I am using my_apps to represent the directory above where you have scholarsphere currently installed
cd my_apps
mkdir arkivo-sufia
cd archivo-sufia
npm install arkivo-sufia hiredis arkivo
- Configure arkivo-sufia
mkdir config
vi config/default.json
Paste in default json
{
"arkivo": {
"plugins": [ "arkivo-sufia" ]
}
}
- Check to make sure the sufia plugin is installed
$(npm bin)/arkivo-plugins list
You should see the following output
1 plugin(s) available.
sufia: Synchronizes data to a Sufia host.
- Run arkivo-sufia
The following command will run arkivo in the current context and output debug information about what is happening as arkivo runs. Omit the DEBUG= if you do not wish to see the debug
DEBUG=arkivo:*,zotero* $(npm bin)/arkivo up
The rest of the directions assume you leave this running
- Configuring ScholarSphere for zotero
You will need an account on Zotero (see sites for the PSU account) and then go to zotero oauth to generate or retrieve a key.
Once you have the Client Secret and Client Key edit scholarsphere/config/zotero.yml to include them and restart your rails server
-
Test the zotero Connection
-
Edit a user profile and you should see "Zotero Profile" as an option
-
Click on "Link with Zotero"
-
Authorize with zotero and allow access
-
You should be redirected to your ScholarSphere profile and see "Successfully connected to Zotero!"
-
Configure ScholarSphere for arkivo-sufia
cd scholarsphere
cp config/arkivo.yml.sample config/arkivo.yml
Note: In development this is likely enough since the arkivo-sufia server is running on the same machine as scholarsphere. In production you will need to edit the file to point to the running version of arkivo-sufia
-
Restart both your rails server and your resque jobs
-
Testing arkivo-sufia connection
In the future zotero will have a way to publish items from the zotero screens. Once published those items should automatically show up in /dashboard/files for a user that has connected with zotero. Currently we can test the connection using a testing script called mypubs.
-
Download mypubs from https://zotero-temp.s3.amazonaws.com/mypubs/mypubs-tester-1.0.0.zip
-
unzip into a directory at the same level as arkivo-sufia
cd my_apps unzip mypubs-tester-1.0.0.zip ls my_apps my_apps/scholarsphere my_apps/arkivo-sufia my_apps/mypubs
-
configure the testing script
-
create an api key by https://www.zotero.org/settings/keys Make sure to check all the boxes for authorization
-
update the testing script with the api key
``` cd mypubs vi config/default.json _put in userid and apikey_ ```
- run the test script (you should have arkivo-sufia running from step 5 and ScholarSphere running from step 6)
``` npm start ```
-
check your my/files you should see a file appear
-
To delete the file run the test script
node --harmony deleteItems.js
-
Trouble Shooting the connection
- I see "Unhandled rejection Error: Forbidden" from the testing script
- you need to edit the user key on zotero and check
Allow write access
- you need to edit the user key on zotero and check
- I run the test script and nothing happens on the arkivo-sufia window
check the subscriptions for arkivo-sufia
$(npm bin)/arkivo-subscriptions list
you should see the userID you configure in mypubs/config/default.json- I do not see my user in the list, the subscription was not made
- check your resque for a failed "ARKIVO_SUBSCRIPTION" job
- make sure arkivo-sufia is running
- load the user in the rails console and clear the zotero conection for the user
- edit to the user's profile and authorize zotero
- reload the user in the rails console and validate that it has an arkivo_subscription
- I see "plugin sufia failed: connect ECONNREFUSED" in the arkivo-sufia window
- you may need to set the url correctly look above the error for the url being used
- you may need to run your server with an IPV 4 ip
rails s -b 127.0.0.1
- I see "Unhandled rejection Error: Forbidden" from the testing script
-
-
Miscellaneous commands needed for testing
-
Clearing the zotero connection for a user in the rails console
cd scholarsphere rails c > u = User.find_by(login:"cam156") > u.arkivo_subscription = nil; > u.zotero_token = nil; > u.zotero_userid = nil; > u.save
-
Deleting documents sent by the testing script so you can run it again
cd mypubs node --harmony deleteItems.js
-
listing subscriptions in arkivo-sufia
```
cd arkivo-sufia
$(npm bin)/arkivo-subscriptions list
```
- Deleting a subscription in arkivo-sufia
```
cd arkivo-sufia
$(npm bin)/arkivo-subscriptions list #see the subcription hash for the user you wish to delete
$(npm bin)/arkivo-subscriptions rm <hash found in list>
```