Home

Awesome

Krist

This is the new official Krist node. It is written in Node.js.

Repo Guidelines

API Documentation

The documentation is generated with apiDoc. You can find a live copy of the API documentation here.

Docker Installation

The preferred method of installation is Docker. The Docker images are published on the GitHub Container Registry under ghcr.io/quantumlytangled/krist or quantumlytangled/krist.

MySQL/MariaDB and Redis are required too. There are two options to connect to the databases. The easier way is to run MySQL and Redis on the host machine, and specify the DB_HOST=${DOCKER_GATEWAY} and REDIS_HOST=${DOCKER_GATEWAY} environment variables to Krist. Alternatively, you can run MariaDB and Redis in Docker too (left as an exercise to the reader).

Example usage with Docker Compose:

version: "3.9"
services:
  krist:
    image: "quantumlytangled/krist"
    environment:
      - DB_PASS=${DB_PASS}
      - PUBLIC_URL=krist.ceriat.net
      - DB_HOST=172.17.0.1
      - REDIS_HOST=172.17.0.1
      - MINING_ENABLED=true
      - GEN_GENESIS=true
    ports:
      - "127.0.0.1:8080:8080"
    restart: unless-stopped

Manual Installation

Requirements

Installation

Installation is fairly straight-forward. Simply clone the project, run npm i to install the required dependencies and then run node ..

Webserver Configuration

This Krist node is supposed to be ran behind a serverside proxy. The file casket_example.casket includes a basic configuration for how to set up the proxy in Casket. The Node.js webserver is not designed to and should not be exposed to the public web. HTTPS is required.

Configuration

Basic configuration is now done via environment variables. You must supply the following environment variables:

VariableDefaultDescription
DB_PASSrequiredThe password of the database user.
PUBLIC_URLrequiredThe FQDN of the Krist server (e.g. krist.ceriat.net).

The following optional environment variables may also be specified:

VariableDefaultDescription
DB_HOST127.0.0.1The hostname of the database.
DB_PORT3306The port of the database.
DB_NAMEkristThe name of the database.
DB_USERkristThe username of the database user.
TEST_DB_NAMEtest_kristRequired for testing. If NODE_ENV is test, the name of the database.
TEST_DB_USERtest_kristRequired for testing. If NODE_ENV is test, the username of the database user.
TEST_DB_PASSRequired for testing. If NODE_ENV is test, the password of the database user.
WEB_LISTEN8080The port that the webserver listens on.
REDIS_HOST127.0.0.1The hostname of the redis server.
REDIS_PORT6379The port of the redis server.
REDIS_PREFIXkrist:The prefix of the redis keys.
TEST_REDIS_PREFIXtest_krist:Required for testing. If NODE_ENV is test (e.g. running Jest), the prefix of the redis keys.
MINING_ENABLEDfalseIf mining should be enabled.
GEN_GENESISfalseIf Krist should force generate a genesis block.
NODE_ENVdevelopmentEither development or production. If development, the Krist server runs in debug mode.
FORCE_INSECUREfalseIf true, force the websocket gateway to return ws:// URLs instead of wss://. Used for development only.
GITHUB_TOKENAny valid GitHub token (e.g. a PAT with no scopes) to obtain avatars for the homepage. Completely optional.
USE_PROMETHEUSfalseIf true, enables Prometheus metrics on the /metrics endpoint.
PROMETHEUS_PASSWORDIf set, require HTTP basic authentication to access Prometheus metrics, with the username prometheus.

For convenience, you may specify environment variables in a .env file.

License

This project is released under GPL-3.0. More information can be found in the LICENSE file.