DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Deploying Fonoster with Cloud-Init
Pedro Sanders
Pedro Sanders

Posted on • Updated on

Deploying Fonoster with Cloud-Init

At Fonoster Inc, we want to help companies and individuals that wish to adopt Fonoster as their Programmable Telecommunications solution. To help archive this goal, our team uses Cloud-Init for cloud instance initialization.

GitHub logo fonoster / fonoster

πŸš€ The open-source alternative to Twilio

You can deploy Fonoster to all major public cloud providers, private cloud infrastructure, and bare-metal installations with Cloud-Init.

In this tutorial, we will also use Multipass.

Multipass is a Canonical project that offers a lightweight VM manager for Linux, Windows, and macOS. With Multipass, you can deploy Fonoster on Ubuntu in a local environment in a single command. This deployment method is by far the fastest way to get started with Fonoster.

Requirements

Before you start this tutorial, you will need the following:

  • Multipass
  • NodeJS 14+ (Use nvm if possible)
  • Fonoster command-line tool (install with npm install -g @fonoster/ctl)

Deploying to Multipass

This method will not automatically enable TLS for you

Deploy Fonoster to Multipass with the following steps. First, download the cloud-config.txt file into a local directory with:

curl https://raw.githubusercontent.com/fonoster/fonoster/main/operator/cloud-config.txt -o cloud-config.txt
Enter fullscreen mode Exit fullscreen mode

Since we are running locally, we have to modify the cloud-config to discover the private ipv4 instead of the public ipv4.

First, update cloud-config with:

sed -i.bak -e "s#publicv4#privatev4#g" "cloud-config.txt"
Enter fullscreen mode Exit fullscreen mode

Then, from the same directory, fire up Multipass.

multipass launch --name fonoster --disk 8G --cpus 2 --mem 4G --cloud-init cloud-config.txt
Enter fullscreen mode Exit fullscreen mode

You might see a timed out waiting for initialization to complete, especially in a slow Internet connection. Don't worry. The process will continue in the background.

You can access your VM and continue following the installation process with:

multipass shell fonoster
tail -f /var/log/cloud-init-output.log
Enter fullscreen mode Exit fullscreen mode

Once you see "Cloud init is done!" the process is complete. If everything goes well, you will be able to log in to your Fonoster deployment. To authenticate for the first time to your deployment, first get your admin credentials with:

cat /opt/fonoster/config/admin_credentials
Enter fullscreen mode Exit fullscreen mode

Your output will look like the one below.

{
   "accessKeyId": "admin",
   "accessKeySecret": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Enter fullscreen mode Exit fullscreen mode

Next, from the host machine, obtain your VM's IP with:

multipass info fonoster
Enter fullscreen mode Exit fullscreen mode

Look for the entry starting with IPv4.

Name:           fonoster
State:          Running
IPv4:           192.168.64.39
                172.17.0.1
                172.24.0.1
...
Enter fullscreen mode Exit fullscreen mode

With the accessKeyId, accessKeySecret, and your VM's IP address, you can now login using the command-line tool or access your server with the SDK.

What's next?

For more deployment options, be sure to check the operator's section of Fonoster's documentation. Star the project on Github and contact us via:

GitHub logo fonoster / fonoster

πŸš€ The open-source alternative to Twilio

Top comments (0)

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.