Adapter used to connect the Value-Added Services and expose them to the VICINITY neighborhood.
Before running this adapter, ensure that you have installed the following:
-
Go 1.12+
$ sudo snap install go --classic
-
PostgreSQL 10.10+
$ sudo apt-get install postgresql
-
npm 6.9.0+
$ sudo apt-get install npm
-
Configured and working VICINITY Client Node
-
Clone this repository using
git clone
-
cd
into the vas-co2-backend folder
$ go build main.go
$ GOOS=linux GOARCH=amd64 go build main.go
- Follow the general
npm build
procedure described in the README ofvas-co2-frontend
- Install and enable Nginx
- Create a site config inside the
/etc/nginx/sites-available
- Configure the redirect settings to serve static files from your frontend
build
folder. - Configure the proxy settings to communicate with the backend API.
Here is an example Nginx server config file.
Make sure to implement the following project structure:
- Create an empty folder called
logs
in the same directory - Create an empty file with executable permissions called
start.sh
- (Optionally) create an environment file called
.env
The final project structure should resemble:
vicinity-tinymesh-door-ui/
├── logs/
├── .env
├── start.sh
└── vas // built go executable
Credentials and endpoints can be configured using the following environment variables (optionally through a .env file).
VICINITY_AGENT_URL=http://localhost:9997
VICINITY_VAS_OID=<UUID4>
VICINITY_ADAPTER_ID=<UUID4>
VICINITY_KPI_KEY=
SERVER_PORT=9090
DB_HOST=localhost
DB_PORT=5432
DB_USER=
DB_NAME=
DB_PASS=
KEYSMS_USER=
KEYSMS_API_KEY=
start.sh
serves as a wrapper for the go executable. This is necessary for systemd. Inside of start.sh
have the following code:
#!/bin/sh -
./vas
Example service file.