This guide contains the development environment setup for Fonoster. It includes the API Server and supporting infrastructure.
Prerequisites
- Docker and Docker Compose
- NodeJS >= v20
- Git (Optional)
Hacking the Backend
To start hacking the backend, start by cloning the project, and copying the .env.example.dev and ./config/integrations.example.json
Here is an example:
git clone https://github.com/fonoster/fonoster
cd fonoster
cp .env.example.dev .env
cp config/integrations.example.json config/integrations.json
In the .env file you will need to find and update the following variables. All variables will need to be updated to a routable IP within your local environment.
| Variable | Description |
|---|
| ROUTR_EXTERNAL_ADDRS | The IP used by Routr to advertise it’s address to othe SIP endpoints |
| ROUTR_RTPENGINE_HOST | The address of RTPEngine |
| ASTERISK_SIPPROXY_HOST | Address pointing to Routr SIP Server |
| APISERVER_ROUTR_API_ENDPOINT | The entrypoint to Routr’s API |
| DOCKER_HOST_ADDRESS | The address of the host machine |
With ifconfig | grep "en0" -A 5 on Linux or Mac you will see a good candidate to use as the IP.
Next, you need to install and build the project.
npm install
npm run build
npm run test
Then, you need to start the infrastructure and initialize the database using the following commands:
npm run start:services
npm run db:migrate
npm run db:seed
The previous command will start all the services including envoy, mailhog, adminer, influxdb, postgres, and asterisk.
Finally, start the API Server with:
Running the Integration Tests
A good indicator that your environment is correctly setup is having ALL passing in your integration tests. Run the integration test, on a separate terminal, with the following command: