DEPRECATED - Migrated to https://github.com/mozilla/fxa
Перейти к файлу
Vijay Budhram 015d529e4d Release v1.97.0 2017-10-03 21:44:45 -04:00
bin chore(dependencies): update all our production dependencies (#217) r=vladikoff 2017-04-04 12:56:38 -07:00
config feat(db): enable signinCode expiry 2017-06-07 16:20:42 +01:00
docs feat(schema): add a pushEndpointExpired column to devices 2017-08-30 07:28:30 +01:00
fxa-auth-db-server feat(schema): add a pushEndpointExpired column to devices 2017-08-30 07:28:30 +01:00
grunttasks chore(lint): Include ./bin/*.js in eslint coverage 2016-11-07 11:45:19 +11:00
lib feat(db): prune session tokens (again) 2017-09-22 07:34:34 +01:00
scripts fix(mysql): update all device procedures to use utf8mb4 (#276) r=jbuck,rfk 2017-09-12 10:47:15 -04:00
test feat(db): prune session tokens (again) 2017-09-22 07:34:34 +01:00
.dockerignore feat(docker): Additional Dockerfile for self-hosting 2016-01-21 12:31:41 +01:00
.eslintrc chore(eslint): update to latest eslint (#252) r=vbudhram 2017-06-24 17:25:15 -04:00
.gitignore fix(tests): switch coverage tool, add coveralls (#145) r=vbudhram 2016-07-20 12:46:53 -04:00
.travis.yml chore(ci): remove node4 test targets from travis-ci (#270) r=vladikoff 2017-08-16 11:29:22 -04:00
AUTHORS fix(docs): update authors and node.js version in README 2017-05-01 12:31:29 -04:00
CHANGELOG-server.md chore(project): merge db-server project admin/config stuff to top level 2015-08-04 15:50:48 +01:00
CHANGELOG.md Release v1.97.0 2017-10-03 21:44:45 -04:00
CONTRIBUTING.md docs(contributing): Mention git commit guidelines 2016-01-21 12:25:48 +01:00
Dockerfile-build feat(docker): update to node 6 (#266) r=jbuck 2017-08-02 17:50:41 -04:00
Dockerfile-test feat(docker): add docker via Circle CI (#212) r=jbuck,seanmonstar 2017-03-05 12:42:58 -05:00
Gruntfile.js chore(project): merge db-server project admin/config stuff to top level 2015-08-04 15:50:48 +01:00
LICENSE Add the full text of the MPL 2.0 2014-09-23 03:37:09 +12:00
README.md chore(docs): update node version in docs to 6 2017-08-29 19:45:57 -04:00
circle.yml feat(docker): add custom feature branch (#237) r=jrgm 2017-05-16 14:37:31 -07:00
index.js reshuffle package.json 2015-08-06 11:47:40 -07:00
npm-shrinkwrap.json Release v1.97.0 2017-10-03 21:44:45 -04:00
package.json Release v1.97.0 2017-10-03 21:44:45 -04:00

README.md

Firefox Accounts database service

Build Status CircleCI

Node.js-based database service for Firefox Accounts. Includes:

  • The API server. Also published independently via npm as fxa-auth-db-server, to enable use with alternative backend storage.
  • A memory-store backend. Useful as a stub for testing against.
  • A MySQL backend. Used in production.

To run the tests for all components:

npm test

Prerequisites

  • node.js 6
  • npm
  • MySQL (we use version 5.6.21 in production)

API Server

See the API documentation. Backend implementers should also read the database documentation.

For example usage, see the readme.

To run the server tests:

npm run test-server

Memory-store backend

Implements the backend API as a memory store.

This is the backend store that is loaded by the default export from the npm package, so the following call to require will return a server that uses the memory-store backend:

var fxadb = require('fxa-auth-db-mysql')

To run the memory-store tests:

npm run test-mem

MySQL backend

Implements the backend API as a MySQL database.

To run the MySQL tests:

npm run test-mysql

Configuration

Both the server and the database patcher read values from a config file config/$NODE_ENV.json, where NODE_ENV is an environment variable set in the shell.

For local development, set NODE_ENV to dev then create a new JSON file called config/dev.json. In there, you can set any values that you'd like to override the master config file, config/config.js.

For instance:

{
  "master": {
    "user": "root",
    "password": "foo"
  },
  "slave": {
    "user": "root",
    "password": "bar"
  }
}

Starting the server

You can start the server like so:

npm start

This will set up the database for you then start the server on whichever port is configured in config/$NODE_ENV.json (port 8000 by default).

If the server fails to start, check that MySQL is running and that your active config has the correct settings to connect to the database.

Setting-up the database separately

If you want to run the database patcher on its own, use the following command:

node bin/db_patcher.js

This command creates the database if it doesn't exist, then runs migrations from lib/db/schema in the appropriate order. Both forward and reverse migrations are contained in this directory, but note that the reverse migrations are commented out as a precaution against accidental execution.

If the command fails, check that MySQL is running and that your active config has the correct settings to connect to the database.

Clean-up

If you want to clean the database, just drop it in MySQL:

mysql -u root -p -e 'DROP DATABASE fxa'

It will be recreated automatically next time you run npm start.

License

MPL 2.0