DEPRECATED - Migrated to https://github.com/mozilla/fxa
Перейти к файлу
John Morrison 5439ce1c7d Merge pull request #52 from jrgm/issue-49
fix(notifications): always return a promise from db.processUnpublishedEvents, fixes #49
2015-06-11 22:29:32 -07:00
bin refactor(lib): move most things into lib/ 2015-05-13 12:20:41 +12:00
config refactor(lib): move most things into lib/ 2015-05-13 12:20:41 +12:00
grunttasks fix(release): add tasks "grunt version" and "grunt version:patch" to create release tags 2015-03-31 16:53:48 -07:00
lib fix(notifications): always return a promise from db.processUnpublishedEvents, fixes #49 2015-06-07 20:26:30 -07:00
scripts and so our story begins 2014-07-01 17:20:06 -07:00
test fix(notifications): always return a promise from db.processUnpublishedEvents, fixes #49 2015-06-07 20:26:30 -07:00
.gitignore Run all remote tests from dbServer 2014-10-30 16:39:18 +13:00
.jshintrc Grunt when testing 2014-10-31 16:50:54 +13:00
.travis.yml build(travis): Test on both io.js v1 and v2 2015-05-05 15:53:03 +12:00
CHANGELOG Release v0.39.0 2015-06-10 15:07:07 -07:00
Dockerfile feat(docker): Dockerfile and README update for basic docker development workflow 2015-02-18 09:32:35 -05:00
Gruntfile.js fix(release): add tasks "grunt version" and "grunt version:patch" to create release tags 2015-03-31 16:53:48 -07:00
LICENSE Add the full text of the MPL 2.0 2014-09-23 03:37:09 +12:00
README.md Update README.md 2015-02-18 17:09:53 -05:00
index.js refactor(lib): move most things into lib/ 2015-05-13 12:20:41 +12:00
npm-shrinkwrap.json Release v0.39.0 2015-06-10 15:07:07 -07:00
package.json Release v0.39.0 2015-06-10 15:07:07 -07:00

README.md

Firefox Accounts DB Server, MySql Backend

MySql backend (used in production) for the fxa-auth-db-server.

Prerequisites

  • node 0.10.x or higher
  • npm
  • mysql

Configuration

If you then set your NODE_ENV, then the file config/$NODE_ENV.json will be read in as part of loading configuration:

export NODE_ENV=dev

In config/config.js you can see a set of defaults for various config options. Go take a look and then create a new local file called config/dev.js. This will contain a set of values to override the defaults. For example, if you have a password set for your MySql root user, you might try something like this:

{
  "master": {
    "user": "root",
    "password": "mysecret1"
  },
  "slave": {
    "user": "root",
    "password": "mysecret1"
  }
}

The same config is used by both the database patcher and the main server as shown below.

Creating the Database

Once you have your config in place, you can create and patch the database using the db_patcher.js command. Try this:

node bin/db_patcher.js

This should create the database (if it doesn't yet exist), and apply each patch located in db/schema/*.sql in the correct order. If this command fails and can't connect to the database, please check your mysql configuration and connectivity on the command line.

Starting the Server

Once the database has been created and patched, you can start the server (keep the same NODE_ENV as you had earlier):

npm start

Once this has started up, it will be listening on locahost:8000 (or whatever port you have configured in your local config file).

Cleanup

You may want to clear the data from the database periodically. You can just drop the database but make sure there is nothing in it that you want to keep:

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

The server will automatically re-create it on next use.

Docker Based Development

To run the auth db MySQL backend via Docker, three steps are required:

$ docker build --rm -t mozilla/fxa_auth_db_mysql .
$ docker run --rm -v $PWD:/opt/fxa mozilla/fxa_auth_db_mysql npm install
$ docker run -it --rm -v $PWD:/opt/fxa --net=host mozilla/fxa_auth_db_mysql

This method shares the codebase into the running container so that you can install npm and various modules required by package.json. It then runs FxA auth db MySQL backend in a container, while allowing you to use your IDE of choice from your normal desktop environment to develop code.

License

MPL 2.0