Giter Site home page Giter Site logo

vhpoet / five-bells-ledger Goto Github PK

View Code? Open in Web Editor NEW

This project forked from interledger-deprecated/five-bells-ledger

0.0 3.0 0.0 1.46 MB

An implementation of the Five Bells ledger interface.

License: Other

JavaScript 96.25% Shell 0.83% PLpgSQL 2.92%

five-bells-ledger's Introduction

Five Bells Ledger npm circle codecov

A reference implementation of the Five Bells Ledger API

Usage

You can see the ledger in action as part of the five-bells-demo!

To run the ledger as a standalone server:

Step 1: Clone repo

git clone https://github.com/interledgerjs/five-bells-ledger.git
cd five-bells-ledger

Step 2: Install dependencies

npm install

Step 3: Run it!

To run it using an in-memory database (the simplest option), run:

LEDGER_ADMIN_PASS=mypassword LEDGER_DB_URI=sqlite://:memory: npm start

Or run:

npm start

See "Environment Variables" in the generated documentation for config options.

Building Docs

After installation:

npm run docs

Open apidocs-out/index.html in a web browser to see the generated API documentation.

Running with Docker (Alternative Method)

This project can be run in a Docker container.

You need a local database instance listening on port 8080. Here is how to set that up:

docker run --name mysql -e MYSQL_ROOT_PASSWORD=password -p 3306:3306 -d mysql
export LEDGER_DB_URI=mysql://root:password@localhost/fivebells
npm run migrate

Then run the following (with the same environment variables) as described above:

docker run -it --rm --net=host -e LEDGER_PORT=1337 -e LEDGER_DB_URI=$LEDGER_DB_URI interledger/five-bells-ledger

Breaking down that command:

  • -it Run Five Bells Ledger in an interactive terminal.
  • --rm Delete container when it's done running.
  • --net=host Don't isolate container into its own virtual network. This allows Five Bells Ledger to see the database that we set up above.
  • -e LEDGER_PORT=1337 Set the ledger's port to 1337. This is just an example for how to set a config option.

Running tests

To run tests using an in-memory database, run:

npm test

If you wish to specify the database against which the tests are run, use the LEDGER_UNIT_DB_URI environment variable.

LEDGER_UNIT_DB_URI=postgres://root:password@localhost:5432/ledger_test_db npm test

For example, to run against a Postgres instance in Docker, first start the database server:

docker run -it --rm --name fbl-pg-test postgres

Then, in another terminal, run the tests:

LEDGER_UNIT_DB_URI=postgres://postgres@`docker inspect --format '{{ .NetworkSettings.IPAddress }}' fbl-pg-test`/postgres npm test

five-bells-ledger's People

Contributors

adrianhopebailie avatar alandotcom avatar bobway avatar clark800 avatar emschwartz avatar gip avatar justmoon avatar justmoon-admin avatar matthewphinney avatar mduo13 avatar mwshortt avatar naoitoi avatar sentientwaffle avatar vhpoet avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.