DEV Community

loading...
Cover image for Deploying Project Fonos with Cloud-Init

Deploying Project Fonos with Cloud-Init

Pedro Sanders
Enthusiast Telematics Engineer. Building the next generation of communication software. Co-founder at @fonoster.
Updated on ・2 min read

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

You can deploy PF 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 Project Fonos on Ubuntu in a local environment in a single command. This deployment method is by far the fastest way to get started with PF.

Requirements

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

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

Deploying to Multipass

This method will not automatically enable TLS for you

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

curl https://raw.githubusercontent.com/fonoster/fonos/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 fonos --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 fonos
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 PF deployment. To authenticate for the first time to your deployment, first get your admin credentials with:

cat /opt/fonos/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 fonos
Enter fullscreen mode Exit fullscreen mode

Look for the entry starting with IPv4.

Name:           fonos
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 is next?

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

Discussion (0)