Here at Scaleway, we love orchestration and automation.
In this post we will share with you how to deal with juju, the open source orchestration tool from Canonical, on Scaleway.

What is Juju?

Juju is an orchestration tool that lets you deploy services (a.k.a charms) on any cloud, from the command line or via a GUI.

Juju provides over 300 charms (such as Jenkins, HAProxy, Hadoop, WordPress) to ease all your deployments. You can find the entire list of charms on the jujucharms store.

Juju and Scaleway

We recently released juju-scaleway, our provider for juju. You can find it on GitHub, contributions are welcome, we love pull request! :)

One thing we love with juju is the cloud-portability aspect. Migrating a workload from any cloud provider to Scaleway is extremely simple and takes no time. Let's prove it!

Test it

We will deploy a Node.js application that requires a MongoDB database. In front of the Node.js servers, we will deploy a HAProxy load balancer.

1. Bootstrap the environment

First, install Juju and the scaleway provider following the instructions on GitHub. Once the installation is completed, you can create a configuration file app.yaml containing your Node.js application git repository url.


You can then bootstrap a fresh environment.

# Tells Juju to use the scaleway environment
$juju switch scaleway

# bootstrap the Scaleway Juju environment
$juju bootstrap

# Provision a pool of 3 servers that will be used to host services
$juju scaleway add-machine -n 3

# Deploy the node application on an unused server
$juju deploy --config myapp.yaml node-app myapp

# Deploy mongodb on an unused server
$juju deploy mongodb

# Deploy haproxyon an unused server
$juju deploy haproxy

You can check the status of your servers and services running the juju status command.

2. Add relationships between services

We have a fresh bootstraped environment and have deployed the services required by our usecase.

The next thing to do is to add relationships between the different services.


The image above displays the architecture we will get once we add our relationships.

# Create a relation between the node application and mongodb
$juju add-relation mongodb myapp
# Create a relation between haproxy and the node application
$juju add-relation myapp haproxy

The services are now linked as shown on the image above. We are ready to expose our amazing application to the world!

To do it, one command is required juju expose haproxy.
The command exposes the port 80 and you can reach your application. To find your haproxy public IP, run the following command juju status.

Then, you can access your application from http://your-server-ip.

In a nutshell, we have our infrastructure deployed and configured. It is composed of:

  • 1x node application server
  • 1x mongodb database server
  • 1x HAProxy load balancer server
3. Scale

If you are facing a temporary spike in traffic, you can scale up your application and add 20 more servers hosting your application in 2 commands!

$juju scaleway add-machine -n 20
$juju add-unit -n 20 myapp

Your traffic spike is over? Just remove the unused resources!

juju remove-unit "myapp/"{2..20}
juju remove-unit "myapp/"{1..20}


Thanks to Juju you can manage your workload in a simple and efficient way. Combined with Scaleway it allows you to reduce the cost of your infrastructure as resources are billed per hour.

For instance, if our traffic spike lasted 12 hours, we would have payed €4.8 for our 20 additional servers (12 x 20 x 0.02).

Learn more about the Scaleway pricing.

Try it now on scaleway and run up to 10 servers for free!