Compiling the LoRa App Server source-code

Yeah it worked once that path was resolved. Thanks!

1 Like

I have successfully compiled source code and build is generated but when running this command to launch lora app server it is not working

sudo ./lora_app_server --postgres-dns “postgres://loraserver_as:dbpassword@localhost/loraserver_as?sslmode=disable” --jwt-secret XXXXXXXXX --http-tls-cert /etc/lora-app-server/certs/http.pem --http-tls-key /etc/lora-app-server/certs/http-key.pem --db-automigrate --http-bind 0.0.0.0:8080

Output
sudo: ./lora_app_server: command not found

Can any one please help me what i am doing wrong

In another compilation with Docker i am facing postgres connectivity issue , it will be helpfull if can get help either of them

appserver_1 | time=“2018-09-08T07:37:26Z” level=error msg="ping database error, will retry in 2s: pq: Could not detect default username. Please provide one explicitly"

Finally I was able to compile the source and this is the output

make requirements ui-requirements

echo “Installing development tools”
Installing development tools
go get -u github.com/golang/lint/golint
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go
go get -u github.com/elazarl/go-bindata-assetfs/
go get -u github.com/jteeuwen/go-bindata/
go get -u github.com/kisielk/errcheck
go get -u github.com/smartystreets/goconvey
go get -u golang.org/x/tools/cmd/stringer
go get -u github.com/golang/dep/cmd/dep
go get -u github.com/goreleaser/goreleaser
dep ensure -v
Installing UI requirements
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})

up to date in 11.687s


make clean
Cleaning up workspace


make api
Generating API code from .proto files


make test

Generating combined Swagger JSON
Generating static files
Generating static files
Running tests
? github.com/brocaar/lora-app-server/cmd/lora-app-server [no test files]
? github.com/brocaar/lora-app-server/cmd/lora-app-server/cmd [no test files]
=== RUN TestAPI
time=“2018-09-13T12:28:33Z” level=error msg=“ping database error, will retry in 2s: pq: password authentication failed for user “root””
time=“2018-09-13T12:28:35Z” level=error msg=“ping database error, will retry in 2s: pq: password authentication failed for user “root””
^CFAIL github.com/brocaar/lora-app-server/internal/api 2.985s
Makefile:18: recipe for target ‘test’ failed
make: *** [test] Error 1


make build
Generating combined Swagger JSON
Generating static files
Generating static files
mkdir -p build
go build -ldflags “-s -w -X main.version=2.1.0-7-g0981ad9” -o build/lora-app-server cmd/lora-app-server/main.go

And when Opening in browser i see only this

Can any one let me know what can be the issue I am not able to understand
all other service is in running state !

Thank you @Brocaar I read the link you sent. I have tried to follow all the tips you have proposed in this topic, but the error still exists. Can the problem occur during the installation “gccgo” or “buffers compilations” (installation linked to the compiler Go) according to you ???



Result =>

With the migration from dep to go modules (for managing dependencies) and https://github.com/brocaar/lora-app-server/commit/361e2b2412fe5483a73051b4dae5449b5e4d0730 (in master), make api should now result in the same output for everybody as the tools are now properly versioned in the go.mod file :slight_smile:

Thank you very much Brocaar !!

I redo the installations with the following links: “https://www.loraserver.io/lora-app-server/community/source/” .
I get the following results But I can not know where exactly the problem exists.
You can help me if he wants to please ! !


Hello,

First of all thank you @brocaar for your effort to deliver a really good loraserver project.

I am trying to compile manually lora app server.
First of all, I followed the documentation on loraserver.io and I did the following :

  • Install Go
  • Install protocolbuf
  • install npm and nodejs. Here is the output of the version command for each module :
    node --version
    v8.10.0
    npm --version
    6.5.0

Then I cloned lora-app-server github project and did make dev-requirements ui-requirements.
For dev-requirements, everything is fine.
for ui-requirements, I have the following issue :

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Xmailto:fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
added 1954 packages from 1679 contributors and audited 36656 packages in 30.82s
found 87 vulnerabilities (63 low, 9 moderate, 15 high)
run npm audit fix to fix them, or npm audit for details

After that, if i do make build, the executable will be generated. If I try to launch it, it work but if I try to access the web interface, I can see only vendor and swagger on the web page. The same result of this issue : Compiling the LoRa App Server source-code

I think that this is related to the error that I got when I did make ui-requirements.

Any ideas what could be the problem?
I have to use docker in order to compile lora app server?

Thanks in advance.

Regards,

Please use the provided Docker Compose environment to build binaries as a starting point. It will setup all requirements in a Docker container for you. It is the same environment used for the provided binaries :slight_smile:

1 Like

Hi Sir,

I am also working on LoRa Server I followed your process of cloning files from github.when I execute command SUDO MAKE it gives an error attached below.! pic a Screenshot%20from%202019-08-21%2011-36-48|690x68
@shuangcai_huang and @brocaar
please help me in debugging this

As i am beginner as well as a fresher i need some help in debugging this. I also did make requirements ui-requirements it didn’t worked for me as in pic b

Anyone’s help can make me up confident.
Thankyou.

You ask about LoRa Server, show a screenshot about LoRa Gateway Bridge and post this in the LoRa App Server topic :rofl: Please use correct topic the next time!

Anyway, please use the provided Docker environment for compiling. It provides you with a pre-setup development environment. See for LoRa App Server https://www.loraserver.io/lora-app-server/community/source/. For the other components you will find the same document, the commands might be slightly different.

1 Like


Hi @shuangcai_huang
I did your procedure completely. And it is quite successfull.
I want to know two things -
1] I am getting above images which can be accessed by port localhost:5000 when I do this, first image is seen as shared.
Next, when I do localhost:5000/#/login it shows the second image and so on for /network-server etc…
I know I have to merge all the webpages one by one, but i am new guy to handle go language & Postgres
How to merge all the files required ?
2] When I do ./lora-app-server after cd build I am facing some issues in connecting Database (postgres)
WARN[0000] storage: ping PostgreSQL database error, will retry in 2s error="pq: password authentication failed for user “root”"
and I also tried with your above procedure
sudo ./lora_app_server --postgres-dns “postgres://loraserver_as:dbpassword@localhost/loraserver_as?sslmode=disable” --jwt-secret XXXXXXXXX --http-tls-cert /etc/lora-app-server/certs/http.pem --http-tls-key /etc/lora-app-server/certs/http-key.pem --db-automigrate --http-bind 0.0.0.0:8080
It didn’t worked for me.

@brocaar Hi sir,
Thank you for the support till now, I have learnt a lot about LoRa with help of your documents.
Now, I am trying to compile and run the LoRa Server Manually. If you have understood what @shuangcai_huang has done then please do help me in completing this too.
sudo ./lora_app_server --postgres-dns “postgres://loraserver_as:dbpassword@localhost/loraserver_as?sslmode=disable” --jwt-secret XXXXXXXXX --http-tls-cert /etc/lora-app-server/certs/http.pem --http-tls-key /etc/lora-app-server/certs/http-key.pem --db-automigrate --http-bind 0.0.0.0:8080

I am trying to understand this above code :point_up_2:

i have understood some of the parts,
jwt-secret is nothing but doing openssl rand -base64 32 and pasting in place of XXXXXXXX

Please help me completing this project.

Thank you,
Sadashiv

Any help for me please…

for this above post which i posted yesterday

Hello, I compiled the Lora server version of Linux arm in win10 64 bits. The commands I executed are as follows: go-bindata has been installed, migrations. go has been compiled, migrations. go has not been prompted for any errors, but the main. go compiled failed, look forward to your reply.

I have encountered a similar problem, could you please give me some advice

You need to build statics and migrations first. Use the Makefile to build the project, it already takes care of these issues.

Thank you. The problem is that migrations failed to generate

In addition, can the compiled migrations_gen.go be published together with the code?

Your screenshot doesn’t suggest that. Instead, it suggests you’re trying to generate things in the wrong way. So again, use the Makefile to do the generation (check what internal/statics internal/migrations does).

I can’t answer that one.

1 Like