Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Installing Zotero Components On a Mac

cam156 edited this page Oct 16, 2015 · 18 revisions
  1. Install Node
  brew install node
  1. 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
  1. Configure arkivo-sufia
  mkdir config
  vi config/default.json

Paste in default json

 {
    "arkivo": {
      "plugins": [ "arkivo-sufia" ]
    }
 }
  1. 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.
  1. 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

  1. 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

  1. Test the zotero Connection

  2. Edit a user profile and you should see "Zotero Profile" as an option

  3. Click on "Link with Zotero"

  4. Authorize with zotero and allow access

  5. You should be redirected to your ScholarSphere profile and see "Successfully connected to Zotero!"

  6. 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

  1. Restart both your rails server and your resque jobs

  2. 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.

    1. Download mypubs from https://zotero-temp.s3.amazonaws.com/mypubs/mypubs-tester-1.0.0.zip

    2. 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
      
    3. configure the testing script

    4. create an api key by https://www.zotero.org/settings/keys Make sure to check all the boxes for authorization

    5. update the testing script with the api key

    ```  
       cd mypubs
       vi config/default.json
          _put in userid and apikey_
     ```
    
    1. run the test script (you should have arkivo-sufia running from step 5 and ScholarSphere running from step 6)
     ```
       npm start
     ```
    
    1. check your my/files you should see a file appear

    2. To delete the file run the test script

        node --harmony deleteItems.js
      
    3. Trouble Shooting the connection

      1. I see "Unhandled rejection Error: Forbidden" from the testing script
        1. you need to edit the user key on zotero and check Allow write access
      2. 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
        1. I do not see my user in the list, the subscription was not made
        2. check your resque for a failed "ARKIVO_SUBSCRIPTION" job
          1. make sure arkivo-sufia is running
          2. load the user in the rails console and clear the zotero conection for the user
          3. edit to the user's profile and authorize zotero
          4. reload the user in the rails console and validate that it has an arkivo_subscription
      3. I see "plugin sufia failed: connect ECONNREFUSED" in the arkivo-sufia window
        1. you may need to set the url correctly look above the error for the url being used
        2. you may need to run your server with an IPV 4 ip rails s -b 127.0.0.1
  3. Miscellaneous commands needed for testing

  4. 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
    
  5. Deleting documents sent by the testing script so you can run it again

      cd mypubs
      node --harmony deleteItems.js
    
  6. listing subscriptions in arkivo-sufia

```
  cd arkivo-sufia
  $(npm bin)/arkivo-subscriptions list
```
  1. 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>
```
Clone this wiki locally