The Ledger performance benchmarks run Ledger on 8 vCPU, 16GB RAM, 50GB SSD GCE instances, but any relatively modern machine with low latency storage and a few gigabytes of memory should suffice for most use cases.
The easiest way to get Ledger is to use one of the pre-built release binaries which are available for OSX, Linux, and Windows. Instructions for using these binaries are on the GitHub releases page.
For those wanting to try the very latest version, build Ledger from the master
branch. Go version 1.13+
and Makefile are required to build the latest version of Ledger.
To ensure Ledger is built against well-tested libraries, Ledger vendors its dependencies for official release binaries.
To build Ledger
from the master
branch using the official build
script:
$ git clone https://github.com/danielnegri/tokenapi-go.git
$ cd tokenapi-go
$ make build
To build Ledger
from the master
branch using the official Docker build
script:
$ make docker-image
Check the Ledger binary is built correctly by starting Ledger and setting all environment variables.
Ledger requires configuration from environment variables or command line parameters.
The [Makefile] script reads and injects the environment variables from a .env
file before running any command.
# Inject env file
include .env
export $(shell sed 's/=.*//' .env)
Make sure to have a .env
file in the root folder before starting the Ledger. You can copy and edit the sample included.
$ cp .env.sample .env
# Make sure to edit the database address, username, password, and token URL.
$ open .env
If Ledger is built without using make build
, run the following:
$ ./bin/ledger serve
If Ledger is built with Docker using make docker-release
, run the following:
$ docker-compose run
Run the following:
$ curl -s -XPOST http://localhost:8080/api/v1/tokens?size=10
ERR: Hv58x-yQTRF1R71oMlGjKQ
OK : ijkr2lXOkM1EElPSDQFkeg
OK : 7fUa0EQMI6ZwjNco2YUOGA
ERR: MBvV7OncnJUCt-JK03z7mw
OK : eW8l673PRTjmUotzOgMDSQ
OK : QOWoKH7vXS9YLo704n72Hg
OK : LQ3SjTITNWVBsGD7J1htHw
OK : vn4QXi6xEI4BUB8phZKm7g
OK : pNXBNMG6Zsdjw2Gfueh6Nw
OK : _angmchPgYOeFU54dw1C9Q
If tokens are printed, then Ledger is working!
$ curl -s http://localhost:8080/health/heartbeat
AdhereTech Ledger Service @ 2020-07-14T18:12:43Z