lncm / invoicer

Invoice generating service that lives on top of lnd.
https://hub.docker.com/r/lncm/invoicer
MIT License
8 stars 3 forks source link

Dockerized invoicer #10

Closed nolim1t closed 5 years ago

nolim1t commented 5 years ago

Add dockerfile to the repo for invoicer

AnotherDroog commented 5 years ago

I would change the name of invoicer-linux-arm to something shorter 👍

nolim1t commented 5 years ago

Dockerfile works

Building Instructions

docker build -t lncm/invoicer:v0.0.11-arm .

Pull from Dockerhub

docker pull lncm/invoicer:v0.0.11-arm

Running Instructions

docker run -it --rm -e LNDHOST=hostname-for-lnd  -v /home/lncm/lnd:/lnd lncm/invoicer:v0.0.11-arm

Remaining Issues (before we can merge this)

nolim1t commented 5 years ago

Success!

:$ sudo docker-compose logs
Attaching to compose_invoicerbox_1, compose_lightningbox_1, compose_btcbox_1
invoicerbox_1   | version: v0.0.11 (git: 691c2e440d02372ad99fc9a67b7a72610bcf61e3)
invoicerbox_1   | network: mainnet
invoicerbox_1   |  client: lnd
invoicerbox_1   | 
invoicerbox_1   | [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
invoicerbox_1   | 
invoicerbox_1   | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
invoicerbox_1   |  - using env: export GIN_MODE=release
invoicerbox_1   |  - using code:        gin.SetMode(gin.ReleaseMode)
invoicerbox_1   | 
invoicerbox_1   | [GIN-debug] GET    /                         --> github.com/gin-gonic/gin.(*RouterGroup).StaticFile.func1 (4 handlers)
invoicerbox_1   | [GIN-debug] HEAD   /                         --> github.com/gin-gonic/gin.(*RouterGroup).StaticFile.func1 (4 handlers)
invoicerbox_1   | [GIN-debug] GET    /invoice                  --> main.invoice (4 handlers)
invoicerbox_1   | [GIN-debug] GET    /status/:hash             --> main.status (4 handlers)
invoicerbox_1   | [GIN-debug] GET    /connstrings              --> main.info (4 handlers)
invoicerbox_1   | [GIN-debug] Listening and serving HTTP on :1666
nolim1t commented 5 years ago

Docker-Compose file

    invoicerbox:
        image: lncm/invoicer:v0.0.11-arm
        volumes:
            - /home/lncm/lnd:/lnd
        ports:
            - "1666:1666"
        environment:
            - LNDHOST=lightningbox
        depends_on:
            - lightningbox
        restart: on-failure
        networks:
            localnet:
                ipv4_address: 172.16.88.166

LND.conf changes

Will add this into the lncm/pi-factory repo now

tlsextradomain=lightningbox
nolim1t commented 5 years ago

this is ready to be merged whenever

nolim1t commented 5 years ago

Errors building on PI

Step 6/15 : RUN make bin/invoicer
 ---> Running in 6d84b2363ac5
go build -o bin/invoicer -ldflags "-X "main.version=v0.0.12" -X "main.gitHash=$(git rev-parse HEAD)""
go: finding github.com/juju/retry v0.0.0-20180821225755-9058e192b216
go: finding github.com/btcsuite/btcwallet v0.0.0-20181130030754-284e2e0e696e
go: finding github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af
go: finding github.com/coreos/bbolt v1.3.0
go: finding github.com/gin-contrib/gzip v0.0.0-20190101123152-0eb78e93402e
go: finding github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073
go: finding github.com/juju/loggo v0.0.0-20180524022052-584905176618
go: finding github.com/grpc-ecosystem/grpc-gateway v1.5.1
go: finding github.com/gin-contrib/cors v0.0.0-20181008113111-488de3ec974f
go: gopkg.in/errgo.v1@v1.0.0: unrecognized import path "gopkg.in/errgo.v1" (https fetch: Get https://gopkg.in/errgo.v1?go-get=1: net/http: TLS handshake timeout)
go: finding github.com/gin-gonic/gin v1.3.0
go: finding github.com/juju/clock v0.0.0-20180808021310-bab88fc67299
go: finding github.com/lightningnetwork/lnd v0.5.1-beta
go: gopkg.in/mgo.v2@v2.0.0-20180705113604-9856a29383ce: unrecognized import path "gopkg.in/mgo.v2" (https fetch: Get https://gopkg.in/mgo.v2?go-get=1: net/http: TLS handshake timeout)
go: google.golang.org/grpc@v1.16.0: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: net/http: TLS handshake timeout)
go: gopkg.in/macaroon.v2@v2.0.0: unrecognized import path "gopkg.in/macaroon.v2" (https fetch: Get https://gopkg.in/macaroon.v2?go-get=1: net/http: TLS handshake timeout)
go: finding github.com/juju/version v0.0.0-20180108022336-b64dbd566305
go: finding github.com/ugorji/go/codec v0.0.0-20181127175209-856da096dbdf
go: finding github.com/pkg/errors v0.8.0
go: finding github.com/juju/utils v0.0.0-20180820210520-bf9cc5bdd62d
go: gopkg.in/macaroon-bakery.v2@v2.1.0: unrecognized import path "gopkg.in/macaroon-bakery.v2" (https fetch: Get https://gopkg.in/macaroon-bakery.v2?go-get=1: net/http: TLS handshake timeout)
go: finding github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5
go: google.golang.org/genproto@v0.0.0-20181127195345-31ac5d88444a: unrecognized import path "google.golang.org/genproto" (https fetch: Get https://google.golang.org/genproto?go-get=1: net/http: TLS handshake timeout)
go: error loading module requirements
make: *** [Makefile:10: bin/invoicer] Error 1
meeDamian commented 5 years ago

Looks like your RBP lost internet during Go dependency fetching.

nolim1t commented 5 years ago

0.0.12 running on dockerhub

Invocation

docker pull lncm/invoicer:0.0.12

Or just include it in docker-compose.yml

nolim1t commented 5 years ago

Pending items as of now:

nolim1t commented 5 years ago

found an issue with this right now. Rebuilding

nolim1t commented 5 years ago

Now it seems to be erroring out

invoicerbox_1   | panic: open : no such file or directory
invoicerbox_1   | 
invoicerbox_1   | goroutine 1 [running]:
invoicerbox_1   | github.com/lncm/invoicer/lnd.New(0x7ee1cdcb, 0x3, 0x7ee1cdcb, 0x3)
invoicerbox_1   |       /src/lnd/client.go:164 +0x100
invoicerbox_1   | main.init.0()
invoicerbox_1   |       /src/main.go:70 +0x74c
invoicerbox_1   | panic: open : no such file or directory
invoicerbox_1   | 
invoicerbox_1   | goroutine 1 [running]:
invoicerbox_1   | github.com/lncm/invoicer/lnd.New(0x7ea12dcb, 0x3, 0x7ea12dcb, 0x3)
invoicerbox_1   |       /src/lnd/client.go:164 +0x100
invoicerbox_1   | main.init.0()
invoicerbox_1   |       /src/main.go:70 +0x74c
invoicerbox_1   | panic: open : no such file or directory
invoicerbox_1   | 
invoicerbox_1   | goroutine 1 [running]:
invoicerbox_1   | github.com/lncm/invoicer/lnd.New(0x7ed59dcb, 0x3, 0x7ed59dcb, 0x3)
invoicerbox_1   |       /src/lnd/client.go:164 +0x100
invoicerbox_1   | main.init.0()
invoicerbox_1   |       /src/main.go:70 +0x74c
invoicerbox_1   | panic: open : no such file or directory
invoicerbox_1   | 
invoicerbox_1   | goroutine 1 [running]:
invoicerbox_1   | github.com/lncm/invoicer/lnd.New(0x7eebbdcb, 0x3, 0x7eebbdcb, 0x3)
invoicerbox_1   |       /src/lnd/client.go:164 +0x100
invoicerbox_1   | main.init.0()
invoicerbox_1   |       /src/main.go:70 +0x74c
invoicerbox_1   | panic: open : no such file or directory
invoicerbox_1   | 
invoicerbox_1   | goroutine 1 [running]:
invoicerbox_1   | github.com/lncm/invoicer/lnd.New(0x7ea92dcb, 0x3, 0x7ea92dcb, 0x3)
invoicerbox_1   |       /src/lnd/client.go:164 +0x100
invoicerbox_1   | main.init.0()
invoicerbox_1   |       /src/main.go:70 +0x74c
invoicerbox_1   | panic: open : no such file or directory
invoicerbox_1   | 
invoicerbox_1   | goroutine 1 [running]:
invoicerbox_1   | github.com/lncm/invoicer/lnd.New(0x7eb43dcb, 0x3, 0x7eb43dcb, 0x3)
invoicerbox_1   |       /src/lnd/client.go:164 +0x100
invoicerbox_1   | main.init.0()
invoicerbox_1   |       /src/main.go:70 +0x74c
invoicerbox_1   | panic: open : no such file or directory
invoicerbox_1   | 
invoicerbox_1   | goroutine 1 [running]:
invoicerbox_1   | github.com/lncm/invoicer/lnd.New(0x7e94fdcb, 0x3, 0x7e94fdcb, 0x3)
invoicerbox_1   |       /src/lnd/client.go:164 +0x100
invoicerbox_1   | main.init.0()
invoicerbox_1   |       /src/main.go:70 +0x74c
invoicerbox_1   | panic: open : no such file or directory
invoicerbox_1   | 
invoicerbox_1   | goroutine 1 [running]:
invoicerbox_1   | github.com/lncm/invoicer/lnd.New(0x7ea58dcb, 0x3, 0x7ea58dcb, 0x3)
invoicerbox_1   |       /src/lnd/client.go:164 +0x100
invoicerbox_1   | main.init.0()
invoicerbox_1   |       /src/main.go:70 +0x74c
invoicerbox_1   | panic: open : no such file or directory
invoicerbox_1   | 
invoicerbox_1   | goroutine 1 [running]:
invoicerbox_1   | github.com/lncm/invoicer/lnd.New(0x7eaa1dcb, 0x3, 0x7eaa1dcb, 0x3)
invoicerbox_1   |       /src/lnd/client.go:164 +0x100
invoicerbox_1   | main.init.0()
invoicerbox_1   |       /src/main.go:70 +0x74c
compose_invoicerbox_1 exited with code 2
nolim1t commented 5 years ago

Looks like HDD space issues..

Anyway currently preparing a build with healthcheck support

nolim1t commented 5 years ago

Looks like that issue is not a disk issue

nolim1t commented 5 years ago

Container debugging notes

sudo docker pull lncm/invoicer:0.0.12
sudo docker run --rm -v /home/lncm/lnd:/lnd -v /home/lncm/src/invoicer:/src -e BTCRPCUSER=7wDfKJj8f7sL -e BTCRPCPASS=9fUeM4IRjhqCSCi9 -e LNDHOST=localhost -e BTCHOST=localhost -p 1666
:8080 --name invoicer --entrypoint="/src/entrypoint-invoicer-test.sh" lncm/invoicer:0.0.12
nolim1t commented 5 years ago

Solution to above problem https://github.com/lncm/invoicer/pull/10#issuecomment-454083652

--- entrypoint-invoicer.sh
+++ entrypoint-invoicer-test.sh
@@ -39,13 +39,14 @@
     STATICDIR='/static/'
 fi

+
 /bin/invoicer -ln-client=$LNCLIENT \
     -lnd-host=$LNDHOST \
     -lnd-port=$LNDPORT \
     -port=$PORT \
     -lnd-invoice=$INVOICEMACAROON \
     -lnd-readonly=$READONLYMACAROON \
-    -lnd-tls=$TLSFILE \
+    -lnd-tls=$LNDTLSFILE \
     -bitcoind-host=$BTCHOST \
     -bitcoind-user=$BTCRPCUSER \
     -bitcoind-pass=$BTCRPCPASS \
nolim1t commented 5 years ago

dockerfile is working right now @meeDamian