Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Checkout develop
View latest version tag
Create version branch according to semvar conventions
Bump version to match branch version name. This will automatically bump all of the packages and create the version tag.
Push version branch and open GitHub PR merging version branch -> develop
Push version tag
Review, merge and ensure successful deploy to dev environment in CircleCI
Checkout develop
Create release branch
Push release branch and open GitHub PR merging release branch -> main
Review, merge, and ensure successful deploy to public environment in CircleCI
The release deployment require manual approval once the pulumi previews are checked for accuracy
Checkout main
Checkout develop
Merge main -> develop
You need to build the blockbook image first before running locally or adding a new coin
All make commands should be run in coinstacks/{coin}/indexer
Generate coin config
Update the coin config rpc_url
, rpc_user
and rpc_password
to point to the appropriate backend daemon. If there is a dedicated daemon deployed for the coinstack, the internal kubernetes "url" can be used to avoid needing to go through dns (Ex: `http://{podName}.default.svc.cluster.local:{port})
Run blockbook
This will start blockbook in sync mode and begin indexing the blockchain. All of the data will be saved to ./db
and logfiles will be stored at ./logs
packages
- shared internal packages across coinstacks
coinstacks/common
- common coinstack logic to reduce duplication
coinstacks/{coin}
- coin specific logic
**/pulumi
- pulumi infrastructure logic for deployment
Yarn - package management
Install Node.js LTS
(Optional) use nvm to automatically install the node version specified in .nvmrc
Install Yarn
Install dependencies:
Build project:
build step must be run locally before attempting to docker-compose up
Copy sample env file:
Fill out any missing variables
Create an Etherscan Account for a free API key
pkg
- shared common packages across coinstacks
internal
- internal utility packages
coinstacks/{coin}
- coin specific logic
It is suggested configuring your editor of choice to utilize the following tooling:
gopls language server
golangci-lint to match the linter used in CI
goimports to match the formatting run on git pre-commit hook (default behavior when using gopls)
Visual Studio Code expects any golang projects to be opened up with a go.mod
file at the root directory for the tooling to work properly, so be sure to open up the project at unchained/go
Install Golang
make sure GOPATH
is set in your shell environment, since it's needed for docker-compose
setup to work properly
Make coinstacks
Copy sample env file:
Go to unchained/
and install dependencies by running yarn
(which will also prepare the git pre-commit hook with goimports
)
Unchained is a multi-blockchain backend interface with three main goals:
Provide a common interface to multiple blockchains
Provide additional information not always accessible from the node directly
Provide realtime updates about blockchain transactions (pending and confirmed)
Node - coin specific node daemon providing historical blockchain data (ex. bitcoind, geth, etc)
Indexer - optional service that indexes transaction and balance history by address, or any other applicable information, if not provided by the node directly
API - provides a base set of functionality via REST and WebSocket that can be extended with coin specific logic
The ethereum coinstack is used in all examples. If you wish to run a different coinstack, just replace ethereum
with the coinstack name you wish to run
All paths are relative to the root unchained project directory (ex. unchained/[go|node]/{path}
)
All pulumi
commands should be run in a pulumi/
directory (ex. pulumi/
, coinstacks/ethereum/pulumi/
)
We use traefik as a reverse-proxy to expose all of our docker containers. Traefik is exposed at port 80
. Traefik Dashboard is exposed at port 8080
Traefik routes requests based on host name. which includes the coinstack name. For Example:
api.ethereum.localhost
Both go
and node
module have linter installed in git pre-commit hook. To set up the hook:
Prerequisites
Install docker-compose
Running
Install node dependencies
Start the reverse proxy and any common service (ex. hot reloading):
Note: -d
runs the containers in daemon (background) mode. If you want to see logs, -d
can be omitted.
Start a coinstack:
Visit http://api.ethereum.localhost/docs to view the OpenAPI documentation for the API
Tear down a coinstack (including docker volumes):
If you are running Docker Desktop and see any SIGKILL
errors, increase your resource limits in the Resources Tab.
Mac OS: when running one of the go coinstacks via docker-compose
on, you might encounter an issue with the service failing to start indefinitely. This is due to Mac OS network security blocking the service from starting. To work around that issue, run the coinstack directly from CLI:
This will trigger the security popup, allow the go process to make the network calls. Once you approve it, you can kill the process and restart docker-compose
. The app should start immediately.
Mac OS: once you start a coinstack you should be able to access unchained in the browser without further config, but for CLI access to work you need to modify /etc/hosts
and add a valid DNS entry:
fork unchained repo
setup AWS account
setup circle.
sign up for npm
sign up for dockerhub
sign up for etherscan
buy a domain
get api token https://docs.docker.com/docker-hub/access-tokens/
get pulumi token https://www.pulumi.com/docs/reference/cli/pulumi_login/
signup for account get aws credentials
setup rout53 hosted zone point dns on owned domain to zone
go to forked project
setup configs:
get your pulumi access token
start building
pulumi init dependencies stack
verify environment
run circle
teardown stack locally
in top level pulumi dir
repeat for each coinstack
re-run circle from top.
This section discusses the tools we use to gain insight in our cluster.
We leverage Loki as our cluster-level logging solution. Combined with the Promtail logging agent, and the Grafana dashboard, Loki completes our logging stack.
In an effort to reduce cost, the default Loki configuration will leverage local pod storage instead of creating an EBS volume. In this configuration logs can be lost at any time if the Loki pod is rescheduled.
By setting logging.persistentVolume: true
a persistent volume will be created and mounted to the Loki pod.
A log retention policy can be configured by changing logging.retentionPeriod
. Unit is hour and the minimum retention time is 24 hours (24h
). If combining this feature with a persistent volume, ensure you have enough storage space setting logging.pvSize
to a resonable value.
Grafana is the data visualization tool that we use to get insight from our observability tools.
Grafana's default authentication method leverages a secret that is deployed to Kubernetes, this is how to retrieve that secret and access the Grafana dashboard.
Run these commands in the Kubernetes namespace where Grafana is deployed
Get the admin password
Forward grafana port to local machine
On your local machine, navigate to localhost:8080
With Indexer | No Indexer |
---|---|
run your own
an owned domain name* to host unchained dns registrar (ex )