DEPRECATED - Migrated to https://github.com/mozilla/fxa
Перейти к файлу
Phil Booth 2dd33a1494
Release v1.124.0
2018-10-30 14:16:29 +00:00
.circleci feat(ci): update to circle 2 (#375) r=@vbudhram 2018-07-18 11:11:07 -04:00
bin fix(db): remove database configuration option, hardcode 'fxa'  (#314) r=@vladikoff 2018-03-09 12:20:04 -05:00
config refactor(recovery): Use base32 for recovery code generation (#372), r=@vbudhram 2018-07-10 14:59:11 -04:00
db-server fix(account): rollback `profileChangedAt` migration 2018-10-26 11:16:13 -04:00
docs feat(account): add `profileChangedAt` property to account table 2018-09-24 09:52:23 -04:00
grunttasks refactor(dbserver): clean up the db server package (#289) r=@rfk 2017-11-27 20:26:24 -05:00
lib fix(migration): Fix typo in SP name in reverse migration for 91. 2018-10-30 13:42:32 +11:00
scripts chore(scripts): disable the explain script in production 2018-09-17 13:15:51 +01:00
test fix(tests): move local utils tests so they get run by npm t (#377) r=@vladikoff 2018-07-20 13:17:26 -04:00
.dockerignore feat(docker): Additional Dockerfile for self-hosting 2016-01-21 12:31:41 +01:00
.eslintrc feat(scripts): add script to automate MySQL EXPLAIN checks 2018-09-17 13:15:50 +01:00
.explain-ignore feat(scripts): add an ignore file for the explain script 2018-09-17 13:15:51 +01:00
.gitignore refactor(dbserver): clean up the db server package (#289) r=@rfk 2017-11-27 20:26:24 -05:00
.nsprc fix(deps): update to restify 7.1 and mysql 2.15 (#351), r=@rfk 2018-05-09 22:26:56 -04:00
.travis.yml chore(deps): Update deps to fix security warnings, remove nsp 2018-10-08 13:01:22 +01: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.124.0 2018-10-30 14:16:29 +00: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(docker): base image node:8-alpine and upgrade to npm6 2018-06-13 13:49:12 -07: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 mysql docs (#391) r=@rfk 2018-08-23 16:26:23 -04: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.124.0 2018-10-30 14:16:29 +00:00
package.json Release v1.124.0 2018-10-30 14:16:29 +00: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.34 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