Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
OpenStax centralized authentication and accounts service
Ruby HTML CSS Other

Merge pull request #172 from openstax/make-user-admin

Add "make them admin" link next to each user in the admin console
latest commit 583a276754
@jpslav jpslav authored
Failed to load latest commit information.
app Merge pull request #172 from openstax/make-user-admin
config Merge pull request #172 from openstax/make-user-admin
db Missed a few lines during rebase
deploy using mysql db, also copying in the before_migrate file we need in al…
doc initial commit
lib Default state to "activated"
public initial commit
script
spec Don't require password confirmation on the create unclaimed user API;…
vendor/assets/stylesheets Miscellaneous code cleanup
.gitignore Edit profile specs
.rspec started testing
.ruby-gemset Change gemset to "accounts" after repo rename
.ruby-version rbenv compatibility
.travis.yml Update .travis.yml
Berksfile health check controller method and route, made Gemfile ruby 1.8 happy…
COPYRIGHT Miscellaneous code cleanup
GNU-AGPL-3.0 pointed to real gems, added license information which was intended to…
Gemfile Update gemfile to FinePrint v3; Import users spec no longer leaves ou…
Gemfile.lock Update gemfile to FinePrint v3; Import users spec no longer leaves ou…
LICENSING renamed application, some minor names, from services to accounts
README.md Also mention rbenv and RVM
Rakefile
Vagrantfile override adapter default to use mysql2, helps at least with precompil…
config.ru renamed application, some minor names, from services to accounts
todo.txt fixes after lev changes

README.md

OpenStax Accounts

Build Status Code Climate Coverage Status

OpenStax Accounts is a centralized provider of account-related services for OpenStax products, including:

  • User authentication
  • User profile data
  • User messaging and notifications
  • User groups

It uses OAuth mechanisms and API keys to provide these services to OpenStax products and their users.

Accounts requires the repeatable read isolation level to work properly. If using PostgreSQL, add the following to your postgresql.conf:

default_transaction_isolation = 'repeatable read'

Development Setup

In development, Accounts can be run as a normal Rails app on your machine, or you can run it in a Vagrant virtual machine that mimics our production setup.

Running as a normal Rails app on your machine

First, ensure you have ruby 1.9.3-p547 installed. You should use either rbenv or RVM to manage your ruby versions.

To start running Accounts in a development environment, clone the repository, then run:

$ bundle install --without production

Just like with any Rails app, you need to migrate the database and then seed it with some default records:

$ rake db:migrate
$ rake db:seed

Then you can run:

$ rails server

which will start Accounts up on port 2999, i.e. http://localhost:2999.

Running in a Vagrant virtual machine

OpenStax Accounts uses chef to configure its production environment, and this environment can also be replicated using Vagrant.

  1. Install Vagrant
    • Get an installer from http://downloads.vagrantup.com/, don't use the old gem install vagrant approach. If you had previously installed the gem version uninstall it first.
  2. $ vagrant plugin install vagrant-berkshelf
  3. $ vagrant up

As you'll see in our Berksfile file, our Vagrant instance uses cookbooks from a number of places. Cookbooks that are specific to OpenStax and OpenStax Accounts live on github. If you find yourself needing to modify these cookbooks, clone the cookbook repository and then set the OPENSTAX_COOKBOOKS_PATH environment variable to the absolute path of the checked out cookbooks before running vagrant commands. This will cause Vagrant and Berkshelf to use your local copy of the OpenStax cookbooks instead of the ones on Github.

Vagrant here has been extended with plugins to include commands that mirror server life cycle events triggered through Amazon's OpsWorks service. The following commands are available:

  • vagrant up and vagrant provision run the OpsWorks setup and configure behavior.
  • vagrant deploy runs OpsWorks' deploy behavior.
  • vagrant undeploy runs OpsWorks' undeploy behavior.
  • vagrant shutdown runs OpsWorks' shutdown behavior.

To get going, run vagrant up followed by vagrant deploy. This will put your Vagrant VM in a running state with OpenStax Accounts being served at https://localhost:8081. Note that http://localhost:8080 serves the non-SSL interface, but if you go there you'll see an error due to the fact that we're explicitly setting the URL port. Accounts forces SSL connections, and in so doing it tries to redirect http requests to https://localhost:8080, not 8081.

Something went wrong with that request. Please try again.