Coder Social home page Coder Social logo

lightning-api's Introduction

Lightning Network Daemon API Documentation Site

API Documentation for the Lightning Network Daemon, powered by Slate

Overview

This repository contains functionality for programmatically pulling API information from lncli -h and rpc.proto on the lnd Github, using a Python script and Jinja2 template to output Slate markdown, which itself generates the fully rendered static site.

Pay special attention to the files inside the templates directory. They contain the Jinja2 templates fed into the Python script, holding the basic format and introductory information for the site.

Running the site locally

Important: You need to run all commands from the root directory!

Prerequisites

You're going to need:

  • Docker CE installed

Building the docker image

This step is only necessary if a file inside the docker/ folder was changed. To just run everything, you can skip this step as the scripts will just use the image guggero/lightning-api from Docker Hub.

./docker/9-rebuild-image.sh

Regenerating the markdown from the proto files

This step will check out the latest sources, copy the *.proto files and then regenerate the documentation markdown.

./docker/1-render-markdown.sh

You should now see updated *.html.md files in the sources folder.

Running locally

To verify everything was updated/generated correctly, a local server can be spun up with the following command:

./docker/2-serve-locally.sh

You can now see the docs at http://localhost:4567.

Deployment

The Lightning API is deployed with Google Cloud Platform. Visit this blog post for more information.

Steps

  1. Install Google Cloud SDK and authenticate into it (this must only be done once per machine):

macOS:

brew cask install google-cloud-sdk
gcloud auth login

Debian/Ubuntu:

# Add the Cloud SDK distribution URI as a package source
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

# Import the Google Cloud Platform public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

# Update the package list and install the Cloud SDK
sudo apt-get update && sudo apt-get install google-cloud-sdk
  1. Run the build and deploy script:
./docker/3-build-html.sh
./docker/4-deploy-gcloud.sh

Running the server locally

The server uses Flask in order to receive POST requests from GitHub whenever a new commit has been pushed to the respository. These POST requests will include the HMAC of a secret token set up within the Webhook settings of a repository. This token will need to be exported so that the server can verify the request from GitHub has been authenticated.

The server can be run with:

export WEBHOOK_SECRET_TOKEN=YOUR_TOKEN_HERE
./docker/5-run-webhook-server.sh

Once a POST request from GitHub has been received, the server will check if there were any commits which included a change to the protobuf definitions. If there was, then the documentation will be automatically regenerated and deployed.

lightning-api's People

Contributors

blackxored avatar bootstraponline avatar chrissrogers avatar cvkef avatar dependabot[bot] avatar djpowers avatar dlackty avatar floorlamp avatar guggero avatar kevin-buttercoin avatar lord avatar maks3w avatar marcguyer avatar maxfangx avatar moizjv avatar niksamokhvalov avatar paulocoghi avatar pbechu avatar prayagverma avatar readmecritic avatar realityking avatar rezanachmad avatar rickyrauch avatar rlord avatar roasbeef avatar sobstel avatar styloa avatar victorquinn avatar wodka avatar wpaulino avatar

Watchers

 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.