Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

multi: support multiple RPC files #16

Merged
merged 10 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM golang:1.13-buster
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤩


# Install all required packages. We need Ruby >= 2.3.1 and Python >= 2.7.0.
RUN apt-get update \
&& apt-get -y install \
ruby-full \
zlib1g-dev \
python3 \
python3-pip \
git \
build-essential \
rsync \
nodejs \
&& rm -rf /var/lib/apt/lists/*

RUN gem install bundler \
&& pip3 install Jinja2 flask

RUN mkdir /tmp/work && cd /tmp/work
WORKDIR /tmp/work

COPY config.rb Gemfile Gemfile.lock Vagrantfile /tmp/work/
RUN bundle config set path 'vendor/bundle' \
&& bundle install

COPY ./docker/install_proto.sh /tmp/install_proto.sh
RUN /tmp/install_proto.sh
RUN go get -v -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc

# Do some of the heavier lifting now so we already have some things cached.
RUN git clone https://github.com/lightningnetwork/lnd /tmp/apidoc/lnd \
&& cd /tmp/apidoc/lnd \
&& make
RUN git clone https://github.com/lightninglabs/loop /tmp/apidoc/loop \
&& cd /tmp/apidoc/loop \
&& go build ./...

# Copy the files last so changes won't trigger a full rebuild of the image.
COPY . /tmp/work
11 changes: 7 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
ruby '>=2.3.1'
source 'https://rubygems.org'

# Middleman
gem 'middleman', '~>4.2.1'
gem 'middleman-syntax', '~> 3.0.0'
gem 'middleman-autoprefixer', '~> 2.7.0'
gem "middleman-sprockets", "~> 4.1.0"
gem 'middleman', '~>4.3'
gem 'middleman-syntax', '~> 3.0'
gem 'middleman-autoprefixer', '~> 2.7'
gem 'middleman-sprockets', '~> 4.1'
gem 'rouge', '~> 2.0.5'
gem 'redcarpet', '~> 3.4.0'
gem 'nokogiri', '~> 1.10.4'
gem 'sass'
124 changes: 69 additions & 55 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,60 +1,57 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (5.0.1)
activesupport (5.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
autoprefixer-rails (6.6.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
autoprefixer-rails (9.5.1.1)
execjs
backports (3.6.8)
backports (3.15.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
concurrent-ruby (1.0.4)
concurrent-ruby (1.1.5)
contracts (0.13.0)
dotenv (2.2.0)
dotenv (2.7.2)
erubis (2.7.0)
execjs (2.7.0)
fast_blank (1.0.0)
fastimage (2.0.1)
addressable (~> 2)
ffi (1.9.17)
haml (4.0.7)
fastimage (2.1.5)
ffi (1.11.1)
haml (5.1.1)
temple (>= 0.8.0)
tilt
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.5.1)
i18n (0.7.0)
kramdown (1.13.2)
hashie (3.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
kramdown (1.17.0)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
memoist (0.15.0)
middleman (4.2.1)
memoist (0.16.0)
middleman (4.3.4)
coffee-script (~> 2.2)
compass-import-once (= 1.0.5)
haml (>= 4.0.5)
kramdown (~> 1.2)
middleman-cli (= 4.2.1)
middleman-core (= 4.2.1)
sass (>= 3.4.0, < 4.0)
middleman-autoprefixer (2.7.1)
autoprefixer-rails (>= 6.5.2, < 7.0.0)
middleman-cli (= 4.3.4)
middleman-core (= 4.3.4)
middleman-autoprefixer (2.10.1)
autoprefixer-rails (~> 9.1)
middleman-core (>= 3.3.3)
middleman-cli (4.2.1)
middleman-cli (4.3.4)
thor (>= 0.17.0, < 2.0)
middleman-core (4.2.1)
middleman-core (4.3.4)
activesupport (>= 4.2, < 5.1)
addressable (~> 2.3)
backports (~> 3.6)
bundler (~> 1.1)
bundler
contracts (~> 0.13.0)
dotenv
erubis
Expand All @@ -63,60 +60,77 @@ GEM
fastimage (~> 2.0)
hamster (~> 3.0)
hashie (~> 3.4)
i18n (~> 0.7.0)
i18n (~> 0.9.0)
listen (~> 3.0.0)
memoist (~> 0.14)
padrino-helpers (~> 0.13.0)
parallel
rack (>= 1.4.5, < 3)
sass (>= 3.4)
sassc (~> 2.0)
servolux
tilt (~> 2.0)
tilt (~> 2.0.9)
uglifier (~> 3.0)
middleman-sprockets (4.1.0)
middleman-sprockets (4.1.1)
middleman-core (~> 4.0)
sprockets (>= 3.0)
middleman-syntax (3.0.0)
middleman-core (>= 3.2)
rouge (~> 2.0)
minitest (5.10.1)
padrino-helpers (0.13.3.3)
mini_portile2 (2.4.0)
minitest (5.11.3)
nokogiri (1.10.4)
mini_portile2 (~> 2.4.0)
padrino-helpers (0.13.3.4)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.3)
padrino-support (= 0.13.3.4)
tilt (>= 1.4.1, < 3)
padrino-support (0.13.3.3)
padrino-support (0.13.3.4)
activesupport (>= 3.1)
parallel (1.10.0)
public_suffix (2.0.5)
rack (2.0.1)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
parallel (1.17.0)
public_suffix (3.1.0)
rack (2.0.7)
rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
redcarpet (3.4.0)
rouge (2.0.7)
sass (3.4.23)
servolux (0.12.0)
sprockets (3.7.1)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sassc (2.0.1)
ffi (~> 1.9)
rake
servolux (0.13.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
thor (0.19.4)
thread_safe (0.3.5)
tilt (2.0.6)
tzinfo (1.2.2)
temple (0.8.1)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (3.0.4)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)

PLATFORMS
ruby

DEPENDENCIES
middleman (~> 4.2.1)
middleman-autoprefixer (~> 2.7.0)
middleman-sprockets (~> 4.1.0)
middleman-syntax (~> 3.0.0)
middleman (~> 4.3)
middleman-autoprefixer (~> 2.7)
middleman-sprockets (~> 4.1)
middleman-syntax (~> 3.0)
nokogiri (~> 1.10.4)
redcarpet (~> 3.4.0)
rouge (~> 2.0.5)
sass

RUBY VERSION
ruby 2.3.3p222

BUNDLED WITH
1.14.3
2.0.2
91 changes: 64 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,70 @@ Pay special attention to these files:
- `deploy.sh`: Build static site from Slate markdown and deploy to Google Cloud
Platform

## Running the site locally
## Running the site locally with docker

### Prerequisites

You're going to need:
- **Docker CE** installed

### Running locally

```shell
./docker-update-render.sh
bundle exec middleman server
```

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

### Deployment

The Lightning API is deployed with Google Cloud Platform. Visit [this blog
post](https://little418.com/2015/07/jekyll-google-cloud-storage.html) for more
information.

#### Steps

1. Install Google Cloud SDK and authenticate into it:
```bash
brew cask install google-cloud-sdk
gcloud auth login
```

2. Run the build and deploy script:
```bash
./docker-build-deploy.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:

```shell
$ export WEBHOOK_SECRET_TOKEN=YOUR_TOKEN_HERE
$ ./docker-run-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.

## Running the site locally (the old way)

### Prerequisites

You're going to need:

- **Linux or OS X** — Windows may work, but is unsupported.
- **Ruby, version 2.2.5 or newer**
- **Python, version 3 or newer**
- **Ruby, version 2.3.1 or newer**
- **Python, version 3.7 or newer**
- **Bundler** — If Ruby is already installed, but the `bundle` command doesn't work, just run `gem install bundler` in a terminal.

### Running locally
Expand All @@ -41,45 +96,27 @@ bundle exec middleman server

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

## Regenerating documentation
### Regenerating documentation

```shell
# Install Jinja for python templating.
pip3 install Jinja2

# Set your $GOPATH to a directory that has access to lncli.
export GOPATH="/path/to/lnd"
export PATH=$PATH:$GOPATH/bin

# Install annotations and protoc-gen-doc.
# Install the protoc-gen-doc plugin for generating documentation from proto files.
go get -u github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
guggero marked this conversation as resolved.
Show resolved Hide resolved
go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc

# Get the latest rpc.proto.
curl -o rpc.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/rpc.proto
curl -o rpc.swagger.json -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/rpc.swagger.json

# Generate the rpc.json file from rpc.proto, so that render.py can parse it.
protoc -I. -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --doc_out=json,rpc.json:. rpc.proto
```

Now, ensure that you have [`lnd` installed](http://http://dev.lightning.community/installation/)
and your `$GOPATH` set, so that `lncli` is available from the command line.
Let's run the script to render our local Slate docs:
```shell
python3 render.py
# Run the script that updates the documentation.
./update_and_render.sh
```

Now that you're all set up, you can just run `./update_and_render.sh` to
automatically pull the latest rpc.proto and render the local Slate docs.

## Deployment
### Deployment

The Lightning API is deployed with Google Cloud Platform. Visit [this blog
post](https://little418.com/2015/07/jekyll-google-cloud-storage.html) for more
information.

### Steps
#### Steps

1. Install Google Cloud SDK and authenticate into it:
```bash
Expand Down
Loading