24
24
> without having to explicitly remember and re-set the juju default
25
25
> values. Note that there is no way to change the juju default
27
> - A value of \`any\` explicitly unsets a constraint, and will cause
27
> - A value of `any` explicitly unsets a constraint, and will cause
28
28
> it to be chosen completely arbitrarily.
30
We also extend the syntax for \`juju deploy\`, and \`juju bootstrap\`,
31
such that \`--constraints\` expects a single string of space-separated
30
We also extend the syntax for `juju deploy`, and `juju bootstrap`,
31
such that `--constraints` expects a single string of space-separated
32
32
constraints, understood as above; deployment constraints will be set on
33
33
the service before the first unit is deployed, and bootstrap constraints
34
34
will be set on the environment and used to provision the initial master
37
Please note that there are no changes to the \`juju add-unit\` command;
37
Please note that there are no changes to the `juju add-unit` command;
38
38
juju is explicitly focused on *service* orchestration, and it is
39
39
counterproductive to encourage users to consider individual units. This
40
40
can be worked around by setting new service constraints before adding
41
41
new units, but is not encouraged.
43
The new \`juju get-constraints\` command is used to see the currently
43
The new `juju get-constraints` command is used to see the currently
44
44
applicable constraints. When called without arguments, it outputs the
45
45
environment constraints as a single yaml-formatted dict; alternatively,
46
46
it can be called with any number of arguments referencing any mix of
53
53
Launch a new deployment running on an m1.medium (running an i386 image),
54
54
and defaulting to that for future services:
56
$ juju bootstrap --constraints "instance-type=m1.medium arch=i386"
56
juju bootstrap --constraints "instance-type=m1.medium arch=i386"
58
58
Deploy MySQL on a machine with at least 32GiB of RAM, and at least 8 ECU
59
59
of CPU power (architecture will be inherited from the environment, or
62
$ juju deploy --constraints "cpu=8 mem=32G" mysql
62
juju deploy --constraints "cpu=8 mem=32G" mysql
64
64
Launch all future machines on t1.micros (unless overridden by service
67
$ juju set-constraints instance-type=t1.micro
67
juju set-constraints instance-type=t1.micro
69
69
Launch all future "mysql" machines with at least 8GiB of RAM and 4 ECU:
71
$ juju set-constraints --service mysql mem=8G cpu=4
71
juju set-constraints --service mysql mem=8G cpu=4
73
73
Output current environment constraints:
75
$ juju get-constraints
77
77
Output constraints for machine 3, service "mysql", and service unit
80
$ juju get-constraints 3 mysql wordpress/7
80
juju get-constraints 3 mysql wordpress/7
82
82
Provider Constraints
83
83
--------------------
85
85
The constraints available vary by provider. Internally, every provider
86
will register \`ubuntu-series\` and \`provider-type\` constraints, to
86
will register `ubuntu-series` and `provider-type` constraints, to
87
87
assist with image selection and sanity-checking respectively, but these
88
88
are purely internal constraints and are not settable directly; however,
89
they are visible in the output of \`juju get-constraints\` for clarity's
89
they are visible in the output of `juju get-constraints` for clarity's
92
92
The currently available EC2 constraints are:
94
> - \`cpu\`: The minimum processing power of the machine, measured in
95
> [ECU](http://en.wikipedia.org/wiki/Amazon_Elastic_Compute_Cloud#Elastic_compute_units),
96
> defaulting to 1; any real number \>= 0 is valid.
97
> - \`mem\`: The minimum memory for the machine, defaulting to 512MB;
98
> any real number \>= 0, and optionally suffixed with M, G or T is
100
> - \`arch\`: The machine's processor architecture, defaulting to
101
> "amd64". Valid values are "i386", "amd64", and "arm".
102
> - \`instance-type\`: The name of the EC2 instance type for the
103
> machine. This conflicts with \`cpu\` and \`mem\` (but not with
104
> \`arch\`); that is, setting an \`instance-type\` constraint will
105
> clear out any inherited \`cpu\` or \`mem\` values, and vice versa,
106
> and it is an error to attempt to specify the conflicting
107
> constraints in the same command.
108
> - \`ec2-zone\`: availability zone within the EC2 region. Unset by
109
> default (so we get what we're given); valid values are the single
110
> ascii characters that correspond to the final characters of the
111
> zones available to you in the current EC2 region (which is set in
112
> environments.yaml, as usual). That is, if you can see
113
> "us-east-1a", "us-east-1c", and "us-east-1d", the \`ec2-zone\`
114
> constraints should be \`a\`, \`c\`, or \`d\`.
94
- `cpu`: The minimum processing power of the machine, measured in
95
[ECU](http://en.wikipedia.org/wiki/Amazon_Elastic_Compute_Cloud#Elastic_compute_units),
96
defaulting to 1; any real number >= 0 is valid.
97
- `mem`: The minimum memory for the machine, defaulting to 512MB;
98
any real number >= 0, and optionally suffixed with M, G or T is
100
- `arch`: The machine's processor architecture, defaulting to
101
"amd64". Valid values are "i386", "amd64", and "arm".
102
- `instance-type`: The name of the EC2 instance type for the
103
machine. This conflicts with `cpu` and `mem` (but not with
104
`arch`); that is, setting an `instance-type` constraint will
105
clear out any inherited `cpu` or `mem` values, and vice versa,
106
and it is an error to attempt to specify the conflicting
107
constraints in the same command.
108
- `ec2-zone`: availability zone within the EC2 region. Unset by
109
default (so we get what we're given); valid values are the single
110
ascii characters that correspond to the final characters of the
111
zones available to you in the current EC2 region (which is set in
112
environments.yaml, as usual). That is, if you can see
113
"us-east-1a", "us-east-1c", and "us-east-1d", the `ec2-zone`
114
constraints should be `a`, `c`, or `d`.
116
Of these constraints, only \`ec2-zone\` is specific enough to EC2 to
117
deserve the "ec2-" prefix; we expect to expose \`arch\`, \`cpu\`,
118
\`mem\` and \`instance-type\` constraints on other providers in the
116
Of these constraints, only `ec2-zone` is specific enough to EC2 to
117
deserve the "ec2-" prefix; we expect to expose `arch`, `cpu`,
118
`mem` and `instance-type` constraints on other providers in the
119
119
future, and have therefore not made them explicitly related to EC2.
121
121
None of these constraints are currently valid on private clouds that
122
happen to expose an EC2 API; the \`default-instance-type\` and
123
\`default-image-id\` provider settings remain as a workaround for this
122
happen to expose an EC2 API; the `default-instance-type` and
123
`default-image-id` provider settings remain as a workaround for this
124
124
situation, until we develop a means of exposing arbitrary clouds'
125
125
instance-type and image-id resources to juju. They are not valid when
126
126
working with Amazon's EC2; this situation is detected by checking for
127
existence of an \`ec2-uri\` provider setting, which implies use of a
127
existence of an `ec2-uri` provider setting, which implies use of a
130
130
The currently available MAAS constraint is:
132
> - \`maas-name\`: The MAAS name to which each unit must be deployed.
133
> This is philosophically problematic, on the basis that teaching
134
> users that it's OK to specify single machines will lead them to
135
> pain when they attempt to scale out large deployments; but it's
136
> justified on the basis that MAAS itself needs to act as a stepping
137
> stone between the "metal" and "cloud" mindsets. \`maas-name\` is
138
> unset by default, and should correspond to a name known by the
132
- `maas-name`: The MAAS name to which each unit must be deployed.
133
This is philosophically problematic, on the basis that teaching
134
users that it's OK to specify single machines will lead them to
135
pain when they attempt to scale out large deployments; but it's
136
justified on the basis that MAAS itself needs to act as a stepping
137
stone between the "metal" and "cloud" mindsets. `maas-name` is
138
unset by default, and should correspond to a name known by the
141
141
The currently available Orchestra constraint is:
143
> - \`orchestra-classes\`: A comma-separated list of Cobbler
144
> management classes to which the instance must belong.
145
> \`orchestra-classes\` is empty by default, and each class should
146
> correspond to an existing Cobbler management class, excluding the
147
> current values of \`available-mgmt-class\` and
148
> \`acquired-mgmt-class\` in environments.yaml.
143
- `orchestra-classes`: A comma-separated list of Cobbler
144
management classes to which the instance must belong.
145
`orchestra-classes` is empty by default, and each class should
146
correspond to an existing Cobbler management class, excluding the
147
current values of `available-mgmt-class` and
148
`acquired-mgmt-class` in environments.yaml.
150
150
The local provider exposes no user-settable constraints.
161
161
When bootstrapping an environment, you can set the constraints directly:
163
$ juju bootstrap --constraints arch=i386
163
juju bootstrap --constraints arch=i386
165
165
The above command did two things:
167
> - Set the environment constraints to require machines with an i386
168
> architecture, leaving the other defaults untouched; this is
169
> precisely equivalent to:
171
> $ juju bootstrap --constraints "arch=i386 cpu=1 mem=512 instance-type=any ec2-zone=any"
173
> ...or, alternatively, using the automatic default selection:
175
> $ juju bootstrap --constraints "arch=i386 cpu= mem= instance-type= ec2-zone="
177
> ...but rather more convenient to type.
179
> - Started the bootstrap/master machine with the above constraints.
167
- Set the environment constraints to require machines with an i386
168
architecture, leaving the other defaults untouched; this is
169
precisely equivalent to:
171
juju bootstrap --constraints "arch=i386 cpu=1 mem=512 instance-type=any ec2-zone=any"
173
...or, alternatively, using the automatic default selection:
175
juju bootstrap --constraints "arch=i386 cpu= mem= instance-type= ec2-zone="
177
...but rather more convenient to type.
179
- Started the bootstrap/master machine with the above constraints.
181
181
Because the environment constraints were set, subsequent deployments
182
182
will use the same values:
186
186
...but other services can be started with their own constraints:
188
$ juju deploy wordpress --constraints instance-type=m1.medium
188
juju deploy wordpress --constraints instance-type=m1.medium
190
Note that the \`arch=i386\` constraint is still inherited from the
190
Note that the `arch=i386` constraint is still inherited from the
191
191
environment, and that this presents a potential problem:
193
$ juju deploy minecraft --constraints instance-type=cc2.8xlarge
193
juju deploy minecraft --constraints instance-type=cc2.8xlarge
195
195
The above command will *still* inherit the environment constraints, and
196
196
will lead to an undeployable service (because cc2.8xlarge cannot run on
197
197
i386). Running juju debug-log will expose the problem; you can fix it as
200
$ juju remove-unit minecraft/0
201
$ juju terminate-machine 1
202
$ juju set-constraints --service minecraft arch=amd64 instance-type=cc2.8xlarge
203
$ juju add-unit minecraft
200
juju remove-unit minecraft/0
201
juju terminate-machine 1
202
juju set-constraints --service minecraft arch=amd64 instance-type=cc2.8xlarge
203
juju add-unit minecraft
205
205
(You need to remove machine 1's assigned unit before you can terminate
206
206
it; you need to explicitly terminate the machine to stop the