Scaleway Documentationtutorials
deploying web applications juju

Jump toUpdate content

Deploying web applications using Juju on Scaleway

Reviewed on 10 May 2021 • Published on 07 May 2015
  • Web
  • applications
  • Juju
  • Scaleway
  • apps
  • compute
  • orchestration
  • juju

Deploying web applications using Juju on Scaleway


This provider is in “beta” and makes use of manual provisioning. Manual provisioning allows Juju users to implement any cloud provider’s API calls and act similar to a provider implemented in the Juju Core code base. You can access the provider source-code on github. This package provides a CLI plugin for Juju that allows automated provisioning of C1 Bare Metal SSD servers on Scaleway. This plugin is highly inspired from kAPIlt Juju plugin.



The plugin installation is done via pypi, the Python package manager, available by default on Ubuntu. A virtualenv is also recommended to sandbox this install from your system packages:

pip install -U juju-scaleway


Ensure you have generated your API key. Then, export the key credentials required by the plugin using environment variables:

export SCALEWAY_ACCESS_KEY=your_organization_id
export SCALEWAY_SECRET_KEY=your_secret_key

As environment variables are not shared between shells, you will need to repeat this operation for every shell. You can avoid this repetition by adding this environment variables in your shell’s rc files, for instance append them to your ~/.bashrc or ~/.zshrc

Juju configuration

The next step is to add an environment for Scaleway in your '~/.juju/environments.yaml'. This environment looks like the following:

type: manual
bootstrap-host: null
bootstrap-user: root

Then, you have to tell Juju which environment to use. To do this, in a terminal use the following command:

export JUJU_ENV=scaleway

To set Scaleway as your default provider, run the following command in your terminal:

juju switch scaleway


Now you can bootstrap your Scaleway environment. You need to route the command through the scaleway plugin that we installed via pip.

juju scaleway bootstrap

All machines created by this plugin will have the Juju environment name as a prefix for their servers name, for instance scaleway-XXXYYYZZZ

After your environment is bootstrapped you can add additional machines to it via the add-machine command, for instance the following will add 2 additional machines:

juju scaleway add-machine -n 2
juju status

You can now use standard Juju commands to deploy service workloads (also known as charms):

juju deploy wordpress

If you don’t specify a machine to place the workload on, the machine will automatically go to an unused machine within the environment.

You can use manual placement to deploy target particular machines:

juju deploy mysql --to=2

This command deploys a MySQL unit to the server number #2.

Assemble these workloads together via relations like lego blocks:

juju add-relation wordpress mysql

You can list all machines in Scaleway that are part of the Juju environment with the list-machines command. This directly queries the Scaleway API and does not interact with the Juju API.

juju scaleway list-machines

Id Name Status Created Address
6222349 scaleway-0 active 2014-11-25
6342360 scaleway-ef19ad5cc... active 2014-11-25
2224321 scaleway-145bf7a80... active 2014-11-25

You can terminate allocated machines via their machine id. By default, the Scaleway plugin forces the terminatiom of machines, which also terminates any service unit running on on those machines:

juju scaleway terminate-machine 1 2

And you can destroy the entire environment via:

juju scaleway destroy-environment

destroy-environment also takes a —force option which only uses the Scaleway API. It’s helpful if the state server or other machines are killed independently of Juju.