This docker compose environment demonstrates how you can use our official Node.js library to fetch call events with sipgate.io and store the information in a relational database. To visualize the collected data we make use of the interactive visualization web application Grafana which is open source.
In order to use sipgate.io, you need to book the corresponding package in your sipgate account. The most basic package is the free sipgate.io S package.
The project relies on Docker Compose. Therefore, a Docker installation is required. Please follow the instructions on the Get Docker instructions for your dedicated system and the Install Docker Compose respectively. After that your system is ready to host multiple virtual containers as multi-container application.
-
To make your local environment accessible, use a service like localhost.run or ngrok.
-
To set up the project follow the instructions at 2.a.
If you prefer a manual setup process, please follow the instructions at 2.b.a. Create a Personal Access Token at app.sipgate.com with the following scopes. This token will only be used by the
setup.sh
script and can be deleted afterwards.authorization:oauth2:clients:read authorization:oauth2:clients:write settings:sipgateio:write
Then run
./setup.sh
in the project's directory.
If you run into any problems, follow the manual setup at 2.b.b. To manually set up the project, create an OAuth2 client at console.sipgate.com.
If you want to authenticate on your local system, add
http://localhost:{WEBHOOK_PORT}/auth
as a Redirect-URI and a Web Origin to that client.
If you also want to be able to authenticate from another system, use{WEBHOOK_URL}/auth
instead.Then create a
.env
file by copying.env.example
and follow the instructions above each variable. -
Start the docker containers with
make up
. -
To authenticate on your local system, visit
http://localhost:{WEBHOOK_PORT}/auth
(replace{WEBHOOK_PORT}
with your port). To authenticate from another system, use{WEBHOOK_URL}/auth
instead. -
After successfully authenticating via OAuth you will be redirected to the Grafana dashboard. There you can login with the Grafana standard credentials (
user: admin
,password: admin
) and are prompted to change them.
Everything is now set up and new calls will be displayed in Grafana.
The Grafana dashboard is accessible at http://localhost:3009/
For easy developing there is a Makefile with short commands to start/end the containers and populate them with fake data:
make up # uses docker-compose up to start the server
make fakedata # calls npm run fakeDataGenerator with the required environment variables
make down # uses docker-compose down to shut down the server (does not delete volumes)
make purge # removes all docker volumes
make build # recreates the docker images and starts them