Application server from Source

Hi All,

I have been looking around through this forum in the hope that i would find a solution to my problem.

I have been trying to do small changes in the source code and then compile the application server again. I have tried multiple methods, including docker.

It seems that when i try to docker-compose the application server, even without any modification to the source code, it is going good. But once I try to start (using docker-compose up), postgresql, mosquitto, etc are all starting fine but the application server itself it stopping without any error.

Please find below journal:

-- Logs begin at Mon 2021-12-20 00:03:54 CET. --
Dec 26 17:06:33 chirpstack-application-server[111591]: time="2021-12-26T17:06:33.537991367+01:00" level=info msg="gateway ping created" ctx_id=2d8e3270-d744-480b-b809-f71524cb0941 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604597
Dec 26 17:06:33 chirpstack-application-server[111591]: time="2021-12-26T17:06:33.590443614+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:34 chirpstack-application-server[111591]: time="2021-12-26T17:06:34.594730316+01:00" level=info msg="gateway ping created" ctx_id=273babea-e656-42d5-96fd-de6c19695ad8 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604598
Dec 26 17:06:34 chirpstack-application-server[111591]: time="2021-12-26T17:06:34.696076845+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:35 chirpstack-application-server[111591]: time="2021-12-26T17:06:35.700491448+01:00" level=info msg="gateway ping created" ctx_id=f4808e1b-5e90-4b02-876a-5211ceb8200d dr=60 frequency=60 gateway_mac=a840411dae204150 id=604599
Dec 26 17:06:35 chirpstack-application-server[111591]: time="2021-12-26T17:06:35.792143972+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:36 chirpstack-application-server[111591]: time="2021-12-26T17:06:36.796841792+01:00" level=info msg="gateway ping created" ctx_id=6448fb0e-8d8f-484d-abfe-9c92255033ee dr=60 frequency=60 gateway_mac=a840411dae204150 id=604600
Dec 26 17:06:36 chirpstack-application-server[111591]: time="2021-12-26T17:06:36.871255233+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:37 chirpstack-application-server[111591]: time="2021-12-26T17:06:37.875207978+01:00" level=info msg="gateway ping created" ctx_id=ea355479-6e1c-49d6-a901-924ec0ffc410 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604601
Dec 26 17:06:37 chirpstack-application-server[111591]: time="2021-12-26T17:06:37.94372946+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:38 chirpstack-application-server[111591]: time="2021-12-26T17:06:38.947473877+01:00" level=info msg="gateway ping created" ctx_id=b2883bdf-045b-4178-8c17-6f5f99906798 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604602
Dec 26 17:06:39 chirpstack-application-server[111591]: time="2021-12-26T17:06:39.009486985+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:40 chirpstack-application-server[111591]: time="2021-12-26T17:06:40.013568806+01:00" level=info msg="gateway ping created" ctx_id=6e03aac8-e78c-4e44-8777-96e7b2be6a39 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604603
Dec 26 17:06:40 chirpstack-application-server[111591]: time="2021-12-26T17:06:40.128822202+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:41 chirpstack-application-server[111591]: time="2021-12-26T17:06:41.13685097+01:00" level=info msg="gateway ping created" ctx_id=01b8c2e1-bf83-4463-96e0-5fa23fc462a9 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604604
Dec 26 17:06:41 chirpstack-application-server[111591]: time="2021-12-26T17:06:41.202311519+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:42 chirpstack-application-server[111591]: time="2021-12-26T17:06:42.208250044+01:00" level=info msg="gateway ping created" ctx_id=8096cdea-f575-4a22-9785-67cb82dad8cf dr=60 frequency=60 gateway_mac=a840411dae204150 id=604605
Dec 26 17:06:42 chirpstack-application-server[111591]: time="2021-12-26T17:06:42.311669754+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:43 chirpstack-application-server[111591]: time="2021-12-26T17:06:43.314994016+01:00" level=info msg="gateway ping created" ctx_id=331d5573-cd67-471e-8d04-31584aeaae1a dr=60 frequency=60 gateway_mac=a840411dae204150 id=604606
Dec 26 17:06:43 chirpstack-application-server[111591]: time="2021-12-26T17:06:43.401306218+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:44 chirpstack-application-server[111591]: time="2021-12-26T17:06:44.404957515+01:00" level=info msg="gateway ping created" ctx_id=503e0dd3-3216-471a-a01f-532fcab1c1ea dr=60 frequency=60 gateway_mac=a840411dae204150 id=604607
Dec 26 17:06:44 chirpstack-application-server[111591]: time="2021-12-26T17:06:44.512356439+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:45 chirpstack-application-server[111591]: time="2021-12-26T17:06:45.515588893+01:00" level=info msg="gateway ping created" ctx_id=8fb94b31-209c-4080-9562-b0e64992cde8 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604608
Dec 26 17:06:45 chirpstack-application-server[111591]: time="2021-12-26T17:06:45.60919041+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:46 chirpstack-application-server[111591]: time="2021-12-26T17:06:46.613808144+01:00" level=info msg="gateway ping created" ctx_id=9e5894e4-6133-45b3-a494-109cb504c81d dr=60 frequency=60 gateway_mac=a840411dae204150 id=604609
Dec 26 17:06:46 chirpstack-application-server[111591]: time="2021-12-26T17:06:46.734475773+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:47 chirpstack-application-server[111591]: time="2021-12-26T17:06:47.739609874+01:00" level=info msg="gateway ping created" ctx_id=b090a36b-8586-422c-8595-a8a5d3a09a6f dr=60 frequency=60 gateway_mac=a840411dae204150 id=604610
Dec 26 17:06:47 chirpstack-application-server[111591]: time="2021-12-26T17:06:47.83636693+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:48 chirpstack-application-server[111591]: time="2021-12-26T17:06:48.839999433+01:00" level=info msg="gateway ping created" ctx_id=1aa4eab5-ff0d-4030-8433-7d3be4d39d32 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604611
Dec 26 17:06:48 chirpstack-application-server[111591]: time="2021-12-26T17:06:48.926385603+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:49 chirpstack-application-server[111591]: time="2021-12-26T17:06:49.930674496+01:00" level=info msg="gateway ping created" ctx_id=c931e289-c18b-44a9-a465-8e9badf23131 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604612
Dec 26 17:06:50 chirpstack-application-server[111591]: time="2021-12-26T17:06:50.007490795+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:51 chirpstack-application-server[111591]: time="2021-12-26T17:06:51.010556282+01:00" level=info msg="gateway ping created" ctx_id=aca1b1c8-e2a7-450b-9e2f-d512676bc843 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604613
Dec 26 17:06:51 chirpstack-application-server[111591]: time="2021-12-26T17:06:51.093839639+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:52 chirpstack-application-server[111591]: time="2021-12-26T17:06:52.097536998+01:00" level=info msg="gateway ping created" ctx_id=830aae88-2def-41af-9c95-035bbb1c2df7 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604614
Dec 26 17:06:52 chirpstack-application-server[111591]: time="2021-12-26T17:06:52.195295302+01:00" level=warning msg="[core] grpc: addrConn.createTransport failed to connect to {localhost:8000 localhost:8000 <nil> 0 <nil>}. Err: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:8000: connect: connection refused\". Reconnecting..."
Dec 26 17:06:52 chirpstack-application-server[111591]: time="2021-12-26T17:06:52.209508782+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:53 chirpstack-application-server[111591]: time="2021-12-26T17:06:53.213781263+01:00" level=info msg="gateway ping created" ctx_id=e71a25e5-f0cb-4437-bd93-3170921daaa9 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604615
Dec 26 17:06:53 chirpstack-application-server[111591]: time="2021-12-26T17:06:53.294773226+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:54 chirpstack-application-server[111591]: time="2021-12-26T17:06:54.299981234+01:00" level=info msg="gateway ping created" ctx_id=9c881855-bd13-4236-9335-fa59321e3dc2 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604616
Dec 26 17:06:54 chirpstack-application-server[111591]: time="2021-12-26T17:06:54.408929745+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:55 chirpstack-application-server[111591]: time="2021-12-26T17:06:55.412968052+01:00" level=info msg="gateway ping created" ctx_id=071160af-414a-46c8-9f5b-ee030045a1c4 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604617
Dec 26 17:06:55 chirpstack-application-server[111591]: time="2021-12-26T17:06:55.478289046+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:56 chirpstack-application-server[111591]: time="2021-12-26T17:06:56.482455027+01:00" level=info msg="gateway ping created" ctx_id=cf5491ec-c467-4c0f-8cc0-3f8c8df5f279 dr=60 frequency=60 gateway_mac=a840411dae204150 id=604618
Dec 26 17:06:56 chirpstack-application-server[111591]: time="2021-12-26T17:06:56.595889385+01:00" level=error msg="send gateway ping error: store mic lookup error: set mic lookup error: dial tcp 127.0.0.1:6379: connect: connection refused"
Dec 26 17:06:57 chirpstack-application-server[111591]: time="2021-12-26T17:06:57.531210198+01:00" level=info msg="signal received" signal=terminated
Dec 26 17:06:57 systemd[1]: Stopping ChirpStack Application Server...
Dec 26 17:06:57 chirpstack-application-server[111591]: time="2021-12-26T17:06:57.543756591+01:00" level=warning msg="stopping chirpstack-application-server"
Dec 26 17:06:57 systemd[1]: chirpstack-application-server.service: Succeeded.
Dec 26 17:06:57 systemd[1]: Stopped ChirpStack Application Server.
---------------------------------------------

I see that the application server cannot make any connection to the redis server, but that the connection is getting refused. The redis server is running fine.

When ever I look at what is running (docker-compose ps), I can see that the application server is the only one that is not running (please see picture below).

I am trying to run it on ubuntu 20.

What am i doing wrong? Can anybody please help to understand what i need to do differently?

Thanks in advance

Khadar

I also tried to use docker desktop (on windows 10) and I see here the same behavior of the application server.

check your configuration. You are trying to access something on localhost(127.0.0.1)
If the service is not exposed/mapped on that IP:PORT, the AS wont be able to reach it.

I dont know how Docker for Windows works, if it runs with a virtual machine or with Linux-Subsystem thing.

Hi chopmann,

I have checked everything and I get the same results on ubuntu as well as the windows docker version.

Besides that, I have been trying to use “make build” in the source directory and even that doesn’t work due to a nth-check vulnerability that i am unable to resolve. The nth-check vulnerability has been resolved in the past, but i am some one unable to get that one resolved as well.

So current status.

  1. Docker-compose approach: I am unable to get it running because it is unable to connect to redis-server
  2. Make build approach: Unable to compile it from the source due to nth-check vulnerability error.

take a look at that. that’s how the test are running. Dont know if the make commands are supposed to be run as is.

Thanks.

I will give i a try now, and report back here in a couple of minutes :wink:

After running the docker-compose run --rm chirpstack-application-server make ui-requirements I got:

image

Please use a service like https://paste.debian.net/, https://pastebin.com/ or the formatting tools in the forum. Dont screenshot stuff, I cant “search” a picture. Seems to be building just fine.

Thank chopman. Will do it.

I am no trying to resolve those vulnerabilities i get stuck on 1 that i am not able yet to resolve (nth-check).

paste.debian.net/plain/1225029

after running docker-compose run --rm chirpstack-application-server make test
It seems that it failed to compile:

Starting chirpstack-application-server_postgres_1  ... done
Starting chirpstack-application-server_mosquitto_1 ... done
Starting chirpstack-application-server_redis_1     ... done
Starting chirpstack-application-server_rabbitmq_1  ... done
Starting chirpstack-application-server_kafka_1     ... done
Building ui

> chirpstack-application-server-ui@3.0.0 build
> react-scripts build

Creating an optimized production build...
Failed to compile.

Module not found: Error: You attempted to import ../../../node_modules/@material-ui/core which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
You can either move it inside src/, or add a symlink to it from project's node_modules/.


make: *** [Makefile:47: ui/build] Error 1

This is the complete log of my attempt to compile it

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/root/.nvm/versions/node/v14.4.0/bin/node',
1 verbose cli   '/root/.nvm/versions/node/v14.4.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v14.4.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle chirpstack-application-server-ui@3.0.0~prebuild: chirpstack-application-server-ui@3.0.0
6 info lifecycle chirpstack-application-server-ui@3.0.0~build: chirpstack-application-server-ui@3.0.0
7 verbose lifecycle chirpstack-application-server-ui@3.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle chirpstack-application-server-ui@3.0.0~build: PATH: /root/.nvm/versions/node/v14.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/root/Chirpstack-app/chirpstack-application-server-3.17.1/ui/node_modules/.bin:/root/.nvm/versions/node/v14.4.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/usr/local/go/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/usr/local/go/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/opt/mssql-tools/bin:/usr/local/go/bin
9 verbose lifecycle chirpstack-application-server-ui@3.0.0~build: CWD: /root/Chirpstack-app/chirpstack-application-server-3.17.1/ui
10 silly lifecycle chirpstack-application-server-ui@3.0.0~build: Args: [ '-c', 'react-scripts build' ]
11 silly lifecycle chirpstack-application-server-ui@3.0.0~build: Returned: code: 1  signal: null
12 info lifecycle chirpstack-application-server-ui@3.0.0~build: Failed to exec build script
13 verbose stack Error: chirpstack-application-server-ui@3.0.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/root/.nvm/versions/node/v14.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v14.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid chirpstack-application-server-ui@3.0.0
15 verbose cwd /root/Chirpstack-app/chirpstack-application-server-3.17.1/ui
16 verbose Linux 5.4.0-91-generic
17 verbose argv "/root/.nvm/versions/node/v14.4.0/bin/node" "/root/.nvm/versions/node/v14.4.0/bin/npm" "run" "build"
18 verbose node v14.4.0
19 verbose npm  v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error chirpstack-application-server-ui@3.0.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the chirpstack-application-server-ui@3.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
#!/bin/bash

# sudo is required if you used docker-compose, as the permission are not the same in the container/on-your-machine
sudo make clean
sudo rm ./ui/node_modules -rf

# If just "updating UI packages"

cd ./ui
npm update PACKAGE_I_WANT_TO_UPDATE # or modifiy the package.json

# This is sort of what the Continuous Intregration Pipeline does. See ./.github/workflows/main.yml
docker-compose build chirpstack-application-server
docker-compose run --rm chirpstack-application-server make ui-requirements
docker-compose run --rm chirpstack-application-server make test

# have a look at https://www.chirpstack.io/application-server/install/config/#environment-variables
# this will get you an application-server running locally with your changes.
# Not a proper edit-compile-run-debug loop of development, for that you need to install 
# nodejs, golang, have a proper toml-configuration, and probably a bunch of other stuff im not aware of.

docker-compose run --rm \
-e "POSTGRESQL__DSN=postgres://chirpstack_as:chirpstack_as@postgres/chirpstack_as?sslmode=disable" \
-e "REDIS__SERVERS=redis:6379" \
-e "APPLICATION_SERVER__INTEGRATION__MQTT__SERVER=tcp://mosquitto:1883" \
-e "APPLICATION_SERVER__EXTERNAL_API__JWT_SECRET=mysecret" \
chirpstack-application-server make serve


Thanks Chopmann. This helped significantly.

Now I am able to build it :smiley: