How to deploy to a network space
Using spaces, administrators are able to create a more restricted network topology for applications at deployment time. This is achieved at deploy time with the use of the
The following will deploy the ‘mysql’ application to the ‘db-space’ space:
juju deploy mysql --bind db-space
For finer control, individual application endpoints can be connected to specific spaces:
juju deploy --bind "db=db-space db-admin=admin-space" mysql
If a space is mentioned that is not associated with an interface, it will act as the default space (i.e. will be used for any unspecified interface):
juju deploy --bind "default-space db=db-space db-admin=admin-space" mysql
For information on applying bindings to bundles, see Binding endpoints within a bundle.
deploy command also allows for the specification of a space constraint.
juju deploy mysql -n 2 --constraints spaces=database
This example will have MAAS as the backing cloud and use the following criteria:
- DMZ space (with 2 subnets, one in each zone), hosting 2 units of the haproxy application, which is exposed and provides access to the CMS application behind it.
- CMS space (also with 2 subnets, one per zone), hosting 2 units of mediawiki, accessible only via haproxy (not exposed).
- Database (again, 2 subnets, one per zone), hosting 2 units of mysql, providing the database backend for mediawiki.
First, ensure MAAS has the necessary subnets and spaces. Each subnet has the “automatic public IP address” attribute enabled on each:
- 172.31.50.0/24, for space “database”
- 172.31.51.0/24, for space “database”
- 172.31.100.0/24, for space “cms”
- 172.31.110.0/24, for space “cms”
- 172.31.0.0/20, for the “dmz” space
- 172.31.16.0/20, for the “dmz” space
Recall that MAAS has native knowledge of spaces. They are created within MAAS and Juju will become aware of them when the Juju controller is built (
Second, add the MAAS cloud to Juju. See Using a MAAS cloud for guidance.
Third, create the Juju controller, assuming a cloud name of ‘maas-cloud’:
juju bootstrap maas-cloud
Finally, deploy the applications into their respective spaces (here we use the constraints method), relate them, and expose haproxy:
juju deploy haproxy -n 2 --constraints spaces=dmz juju deploy mediawiki -n 2 --constraints spaces=cms juju deploy mysql -n 2 --constraints spaces=database juju add-relation haproxy mediawiki juju add-relation mediawiki mysql juju expose haproxy
Once all the units are up, you will be able to get the public IP address of one of the haproxy units (from
juju status), and open it in a browser, seeing the mediawiki page.
Last updated 8 days ago.