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

Dockerized invoicer #10

Merged
merged 36 commits into from
Jan 19, 2019
Merged

Dockerized invoicer #10

merged 36 commits into from
Jan 19, 2019

Conversation

nolim1t
Copy link
Member

@nolim1t nolim1t commented Dec 31, 2018

Add dockerfile to the repo for invoicer

@AnotherDroog
Copy link
Member

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

@nolim1t
Copy link
Member Author

nolim1t commented Jan 9, 2019

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)

  • Solve TLS issue
  • Put in docker-compose (maybe the above can be combined as TLS is already in). Use the lightningbox host alias in lnd.conf for LNDHOST variable

@nolim1t nolim1t self-assigned this Jan 9, 2019
@nolim1t nolim1t added the enhancement New feature or request label Jan 9, 2019
@nolim1t
Copy link
Member Author

nolim1t commented Jan 9, 2019

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
Copy link
Member Author

nolim1t commented Jan 9, 2019

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
Copy link
Member Author

nolim1t commented Jan 9, 2019

this is ready to be merged whenever

@nolim1t nolim1t requested a review from meeDamian January 9, 2019 08:39
Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
entrypoint-invoicer.sh Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@nolim1t
Copy link
Member Author

nolim1t commented Jan 13, 2019

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
Copy link
Member

Looks like your RBP lost internet during Go dependency fetching.

@nolim1t
Copy link
Member Author

nolim1t commented Jan 13, 2019

0.0.12 running on dockerhub

Invocation

docker pull lncm/invoicer:0.0.12

Or just include it in docker-compose.yml

@nolim1t
Copy link
Member Author

nolim1t commented Jan 13, 2019

Pending items as of now:

@nolim1t
Copy link
Member Author

nolim1t commented Jan 14, 2019

found an issue with this right now. Rebuilding

@nolim1t
Copy link
Member Author

nolim1t commented Jan 14, 2019

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
Copy link
Member Author

nolim1t commented Jan 15, 2019

Looks like HDD space issues..

Anyway currently preparing a build with healthcheck support

@nolim1t
Copy link
Member Author

nolim1t commented Jan 15, 2019

Looks like that issue is not a disk issue

@nolim1t
Copy link
Member Author

nolim1t commented Jan 15, 2019

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
Copy link
Member Author

nolim1t commented Jan 15, 2019

Solution to above problem #10 (comment)

--- 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
Copy link
Member Author

nolim1t commented Jan 15, 2019

dockerfile is working right now @meeDamian

@meeDamian meeDamian merged commit 8cbc08f into lncm:master Jan 19, 2019
@nolim1t nolim1t deleted the docker-feature branch January 19, 2019 06:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants