- Create a PostgreSQL database;
- Either download a database dump from the current website to fill the initial values or use the files under
postgres/
to generate the initial schema.
- Serve the data directly from the database using PostgREST and the following configuration:
db-uri = "postgres://yourpostgresdatabaseuri"
db-schema = "public"
db-anon-role = "web_anon"
db-pool = 7
server-host = "127.0.0.1"
server-port = 11936
max-rows = 10000
- Run
npm install && make
to build the client-side JavaScript. All files will be in thestatic/
directory. - Now you need an HTTP server proxy to serve the PostgREST API and the static site under the same domain. This at the naked path and that under the
/api/
path. Nginx will do it, but I use Caddy with the followingCaddyfile
:
ln.bigsun.xyz {
handle /api/* {
uri strip_prefix /api
reverse_proxy localhost:11936 {
header_up Accept application/json
header_up Content-Type application/json
}
}
handle {
root * /home/fiatjaf/lnchannels/static
try_files {path} /index.html
file_server
}
}
- Run sparko and generate a key for it with at least the permissions to call
listchannels
andlistnodes
. - Run bitcoind with
txindex=1
. - Somehow set the following environment variables:
POSTGRES_URL=postgres://yourpostgresdatabaseuri
SPARK_URL=http://yoursparkoaddress:port/rpc
SPARK_TOKEN=accesskeygeneratedonstep1
BITCOIN_RPC_ADDRESS=http://localhost:8332
BITCOIN_RPC_USER=bitcoinrpcuser
BITCOIN_RPC_PASSWORD=bitcoinrpcpass
- You can place all of the above in a file called
.env
and later user a program like godotenv to run things while setting them. - Install Python (must be python3.8 or greater I believe) dependencies from
requirements.txt
using any method you like (I dovirtualenv venv && venv/bin/pip install -r requirements.txt
). - Run
python -m getdata
(orgodotenv python -m getdata
if you're using an.env
file orgodotenv venv/bin/python -m getdata
if you're using a virtualenv) once every day or hour or week, depending on how often you want to fetch new data -- the greater the interval between runs the more you'll miss shortlived channels, the smaller the interval more you'll clog your database with useless fee changes, also the process takes a long time to finish so I only run it once a day.
Public domain, except you can't use for shitcoins.