Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

concord-consortium/document-store

Repository files navigation

Document Store

Getting Started

Document Store is a basic rails app for storing documents. It handles authentication through OAuth2 with a Concord Consortium portal, and/or it's own internal user table.

It relies on PostgreSQL and its JSON column type.

  1. Install dependencies: bundle install

  2. Create your database.yml

     production:
       adapter:  postgresql
       host:     localhost
       encoding: unicode
       database: documentstore_production
       pool:     5
       username: user
       password: pw
    
  3. Create the db: rake db:create

  4. Run migrations: rake db:migrate

  5. Set up a default user: rake db:seed

  6. Start the server: rails s

Setting up a Portal authentication provider

  1. Set up a new Client in the providing portal:

     Client.create!(name: '<some unique name>', app_id: '<some unique id>', app_secret: '<some unique secret>')
    
  2. In the document store:

     Settings['auth.<some_unqigue_name>'] = {
       display_name: '<some nicely formatted name>',
       url: <url to the portal>,
       client_id: <app_id from above>,
       client_secret: <app_secret from above>
     }
    
  3. Restart the document server

Deployment

This repo auto-deploys master and pull requests to a staging server on Heroku. A deployment pipeline on Heroku allows deploying to production servers.

Tests:

  • Rspec test can be run using bundle exec rake.
  • Spec test are run automatically on Travis.
  • If you have jest installed globally you can run focused JS tests using:
        jest --watch --config jest/jest.config.js

Docker

Copy the sample database: cp config/database.yml.docker config/database.yml

Run the command: docker-compose up

Document server should be available at:

http://localhost:3001

Other useful tips, incouding how to get SSO working can be found at:

https://github.com/concord-consortium/rigse/blob/master/docs/docker.md

Acknowledgements

This application was generated with the rails_apps_composer gem provided by the RailsApps Project.

License

The Document Store app code is licensed under the MIT License.

All other dependencies are under their own respective licenses.