Blockchain --> Database (augur-node) --> Client (UI)
Switch branches/tags
Clone or download
Latest commit f843e8d Oct 19, 2018
Permalink
Failed to load latest commit information.
.vscode temp commit Feb 20, 2018
certs snake-oil Dec 15, 2017
integration Updated orders/trades field names to match contracts Nov 26, 2017
scripts remove extraneous python packages Oct 17, 2018
src import order Oct 18, 2018
test getUserShareBalances Oct 15, 2018
.eslintrc undo accidental commit Feb 20, 2018
.gitignore Use nyc to report code coverage Aug 25, 2018
.npmignore Fixed coverage report Oct 5, 2017
.prettierrc Use prettier to keep test file consistent May 14, 2018
.slugignore Update .slugignore Sep 10, 2018
.travis.yml Use nyc to report code coverage Aug 25, 2018
Dockerfile That file will not exist now Jun 28, 2018
LICENSE happy 2018! Jan 13, 2018
Procfile Update Procfile Sep 10, 2018
README.md Update README.md Sep 6, 2018
app.json updated nodes Sep 10, 2018
config.json Create databases inside augur-node, use networkId in name, break up c… Jun 21, 2018
docker-compose.yml Add get markets, cleanup compose and add package.json scripts Jun 13, 2018
docker-entrypoint.sh Bring in an event emitter, rename index to runServer and update vario… Jun 25, 2018
knexfile.js Merge remote-tracking branch 'origin/master' into use-source-for-unit… Sep 13, 2018
package-lock.json Merge remote-tracking branch 'origin/master' into epheph/ch17181/perf… Oct 8, 2018
package.json Merge remote-tracking branch 'origin/master' into epheph/ch17181/perf… Oct 8, 2018
tsconfig.json Repair tsconfig.json Jul 25, 2018
tslint.json Updated tslint.json to require multiline trailing commas Oct 22, 2017
wait-for-url.sh Docker-compose works and waits appropriately, and things are linked up Jun 12, 2018
wallaby.conf.js Justinbarry/ch13147/add logging to augur app (#484) Jul 3, 2018
yarn.lock yarn.lock Oct 2, 2018

README.md

Augur Node

Build Status Coverage Status npm version
Deploy

Augur Node is designed to be a standalone application, including a local database setup that supports sqlite as well as postgresql. We use knex to manage the local migrations and schema changes.

Building

This project uses typescript and can be safely built via: npm run build or directly with tsc. Augur Node requires Node 8.

Running

Configuration

By default, Augur Node is configured to connect to a locally-running Ethereum node at http://localhost:8545 and ws://localhost:8546. To connect to a hosted Ethereum node, set the ETHEREUM_HTTP and ETHEREUM_WS environment variables, as follows:

$ export ETHEREUM_HTTP=https://rinkeby.ethereum.nodes.augur.net 
$ export ETHEREUM_WS=wss://websocket-rinkeby.ethereum.nodes.augur.net

Also, by default Augur Node will use a local sqlite database to store its processed data. For some use-cases you may want to use a shared database instance -- for this purpose we currently support PostgreSQL in addition to SQLite. To start Augur Node connected to a sqlite database export the DATABASE_URL environment variable, with a full connection string for your PostgreSQL instance.

For a quick-start with SQLite, a development docker image is provided and can be controlled with:

  • npm run docker:pg:start
  • npm run docker:pg:stop
  • npm run docker:pg:restart

These commands will manipulate a docker container named augur-postgres which defaults to having a main database named augur and a single user augur accessible with the password augur.

The connection string for the instance of PostgreSQL started with the above scripts can be placed in your environment with:

export DATABASE_URL='postgresql://augur:augur@localhost:5432/augur"

Starting

For a quick start, use the clean-start script included with our package.json:

$ npm install # If you haven't yet done so
$ npm run clean-start

This will ensure the code has been built, and database migrations run for a fresh start. This will blow away any data that is currently stored in your node.

If you'd like to simply start a node and begin syncing where you left off, use the start script:

$ npm run start

Docker

Augur Node has a Dockerfile and publish docker image which is capable of running augur-node connected to an ethereum node. This will only work out-of-the-box for networks which have been deployed as part of our development deployment process (right now, only Rinkeby).

$ export ETHEREUM_HTTP=https://rinkeby.ethereum.nodes.augur.net 
$ export ETHEREUM_WS=wss://websocket-rinkeby.ethereum.nodes.augur.net
$ scripts/docker/run.sh augurproject/augur-node

Hosted Ethereum nodes

Currently, augur node has configurations built in for connecting to our hosted rinkeby node. More will be added as we bring up these nodes. For each possible network, pass the network name to the start command for augur-node. E.g. to use clean-start to run with a fresh database:

$ npm run clean-start -- rinkeby

or to run without clearing out previous state:

npm run start -- rinkeby

Schema Migrations

Migrations are managed via knex and behave similarly to ActiveRecord migrations. As you add migrations, knex tracks the currect applied state in the database, and allows you to apply new migrations as they come in.

See: [http://knexjs.org/#Migrations-CLI]

Creating Migrations

New migrations are in typescript and are store in: src/migrations/

To use the knex tool to generate a migration in this directly, use the development enironment:

knex migrate:make -x ts --env development name

Running Migrations

Make sure your typescript is built before running migrations

knex migrate:latest --env build

Data Seeds

Seed files are used to seed the test database. Unlike migrations, seeds are meant only for boostrapping, and so each time seeds are run all the source files are executed (not just newly added ones). Currently the seeds files drop and re-create the tables with each application.

Seeds are stored in src/seeds/<environment>/*.ts.

See: [http://knexjs.org/#Seeds-CLI]

Creating seeds

This is similar to creating new migrations, but only one should exist per table for clarity.

knex seed:make seed_name --env development

Running seeds (For Build Env)

knex seed:run --env build

Tests

Tests run with in-memory SQLite DBs for each test execution so they won't overlap each other. The framework will automatically initialize and seed the tests with the data in seed/test for each test.

Complete Pre-Test Setup

npm install
npm run build

Running Tests

npm test