DEPRECATED - Migrated to https://github.com/mozilla/fxa
Перейти к файлу
Vijay Budhram 6a4fb6771d
fix(token): Fix mem verifyTokenCode (#303), r=@rfk, @philbooth
2018-02-08 14:41:48 +00:00
bin feat(logs): add Sentry for errors (#292) r=@vbudhram 2018-01-04 21:32:28 -05:00
config feat(logs): add Sentry for errors (#292) r=@vbudhram 2018-01-04 21:32:28 -05:00
db-server fix(token): Fix mem verifyTokenCode (#303), r=@rfk, @philbooth 2018-02-08 14:41:48 +00:00
docs feat(devices): return session token id from deleteDevice 2018-01-23 10:23:57 +00:00
grunttasks refactor(dbserver): clean up the db server package (#289) r=@rfk 2017-11-27 20:26:24 -05:00
lib fix(token): Fix mem verifyTokenCode (#303), r=@rfk, @philbooth 2018-02-08 14:41:48 +00:00
scripts fix(scripts): add SET NAMES to reverse migration boilerplate (#296), r=@vbudhram 2018-01-19 10:33:34 -05:00
test fix(pruning): Avoid accidental full-table scans when pruning session tokens. (#295); r=philbooth 2018-01-22 11:36:38 +11: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 refactor(dbserver): clean up the db server package (#289) r=@rfk 2017-11-27 20:26:24 -05:00
.travis.yml fix(travis): run tests with 6 and current stable (failure not allowed anymore) 2017-10-31 15:38:40 -07: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.105.0 2018-02-07 09:48:59 +11:00
CONTRIBUTING.md refactor(dbserver): clean up the db server package (#289) r=@rfk 2017-11-27 20:26:24 -05:00
Dockerfile-build fix(node): use node 6.12.3 (#291) r=@vladikoff 2018-01-03 21:00:50 -05: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 refactor(dbserver): clean up the db server package (#289) r=@rfk 2017-11-27 20:26:24 -05:00
circle.yml feat(docker): add custom feature branch (#237) r=jrgm 2017-05-16 14:37:31 -07:00
index.js refactor(dbserver): clean up the db server package (#289) r=@rfk 2017-11-27 20:26:24 -05:00
npm-shrinkwrap.json Release v1.105.0 2018-02-07 09:48:59 +11:00
package.json Release v1.105.0 2018-02-07 09:48:59 +11:00

README.md

Firefox Accounts database service

Build Status CircleCI

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

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