3
| |::\ / /::\ / /:/ / /::\
4
| |:|:\ / /:/\:\ /__/::\ / /:/\:\
5
__|__|:|\:\ / /:/ \:\ \__\/\:\ / /:/ \:\
6
/__/::::| \:\ /__/:/ \__\:\ \ \:\ /__/:/ \__\:\
7
\ \:\~~\__\/ \ \:\ / /:/ \__\:\ \ \:\ / /:/
8
\ \:\ \ \:\ /:/ / /:/ \ \:\ /:/
9
\ \:\ \ \:\/:/ /__/:/ \ \:\/:/
10
\ \:\ \ \::/ \__\/ \ \::/
13
Mojo is a deployment workflow system for Juju.
4
Mojo is a deployment workflow system for Juju.
15
6
Mojo is a continuous integration and continuous delivery system for Juju-based
16
7
services managed by Canonical IS. It is intended to replace the current system
49
39
The root MOJO_DIR is typically /srv/mojo so projects are located:
51
/srv/mojo/$MOJO_PROJECT
41
/srv/mojo/$MOJO_PROJECT
53
43
The LOCAL directory is where secrets and certificates or anything that cannot be
54
44
stored in the spec repository should be staged for use by the deployment.
55
45
The mojo secrets phase copies data from the LOCAL directory to the workspace
59
50
The ROOTFS directory is the lxc container rootfs.
60
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/ROOTFS
52
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/ROOTFS
61
54
with $MOJO_SERIES as either precise, trusty, etc.
66
58
A mojo workspace is staging ground for the specific version of the specification
67
59
being tested. Typically the workspace is named for the revision number of the
68
60
spec and the stage. i.e 23-production
70
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/$MOJO_WORKSPACE
62
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/$MOJO_WORKSPACE
74
66
The specification is pulled from a bzr repository to the spec directory.
76
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/$MOJO_WORKSPACE/spec
68
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/$MOJO_WORKSPACE/spec
78
70
The build directory is where collect phase stores the charms and payload data
79
71
by default. The build phase script should point to the contents in this
81
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/$MOJO_WORKSPACE/build
74
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/$MOJO_WORKSPACE/build
83
76
The charms directory is where the repo phase setups up the charm repository.
84
77
The deploy phase deploys charms from this location.
85
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/$MOJO_WORKSPACE/charms
79
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/$MOJO_WORKSPACE/charms
87
81
The local directory is where secrets and certificates or anything that cannot be
88
82
stored in the spec repository should be moved to for use by the deployment.
89
83
The mojo secrets phase copies data from the LOCAL directory to the workspace
91
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/$MOJO_WORKSPACE/local
86
/srv/mojo/$MOJO_PROJECT/$MOJO_SERIES/$MOJO_WORKSPACE/local
97
92
Create a new project:
98
sudo mojo project-new $MOJO_PROJECT -s $MOJO_SERIES
100
sudo mojo project-new my-stack-name -s precise
94
sudo mojo project-new $MOJO_PROJECT -s $MOJO_SERIES
96
sudo mojo project-new my-stack-name -s precise
107
sudo mojo project-destroy $MOJO_PROJECT
105
sudo mojo project-destroy $MOJO_PROJECT
109
107
Create a new workspace:
110
mojo workspace-new --project $MOJO_PROJECT -s $MOJO_SERIES $SPEC_URL $MOJO_WORKSPACE
112
mojo workspace-new --project my-stack-name -s precise lp:~user/mojo-specs/my-stack-name stack-test-wip
109
mojo workspace-new --project $MOJO_PROJECT -s $MOJO_SERIES $SPEC_URL $MOJO_WORKSPACE
111
mojo workspace-new --project my-stack-name -s precise lp:~user/mojo-specs/my-stack-name stack-test-wip
114
113
List all workspaces
115
mojo workspace-list --project $MOJO_PROJECT -s $MOJO_SERIES
117
mojo workspace-list --project my-stack-name -s precise
115
mojo workspace-list --project $MOJO_PROJECT -s $MOJO_SERIES
117
mojo workspace-list --project my-stack-name -s precise
119
119
Delete a workspace
120
mojo workspace-destroy --project $MOJO_PROJECT -s $MOJO_SERIES $MOJO_WORKSPACE
122
mojo workspace-destroy --project my-stack-name -s precise stack-test-wip
121
mojo workspace-destroy --project $MOJO_PROJECT -s $MOJO_SERIES $MOJO_WORKSPACE
123
mojo workspace-destroy --project my-stack-name -s precise stack-test-wip
127
128
Mojo arranges deployments into several phases in order to ensure their
128
129
repeatability. By breaking a deployment into small parts, Mojo allows you to
129
130
easily build separate staging and production (or any other) environments whose
149
149
The one command to rule them all. The mojo run command pulls down the spec url,
150
150
reads the manifest and begins executing each phase in order per the manifest.
152
mojo run --project $MOJO_PROJECT --series $MOJO_SERIES --stage $MOJO_STAGE $SPEC_URL $MOJO_WORKSPACE
154
mojo run --project my-stack-name --series precise --stage devel lp:~user/mojo-specs/my-stack-name stack-test-wip
152
mojo run --project $MOJO_PROJECT --series $MOJO_SERIES --stage $MOJO_STAGE $SPEC_URL $MOJO_WORKSPACE
154
mojo run --project my-stack-name --series precise --stage devel lp:~user/mojo-specs/my-stack-name stack-test-wip
159
159
The secrets phase copies secrets files from a staging directory (Default:
160
160
/srv/mojo/LOCAL/$MOJO_PROJECT/$MOJO_STAGE) to the workspace local directory
161
161
(/srv/mojo/LOCAL/$MOJO_PROJECT/$MOJO_STAGE) where they can be accessed by the
162
162
remaining phases.
165
config=STAGED_SECRETS_DIRECTORY
166
Directory where secrets are staged
167
Default: /srv/mojo/LOCAL/$MOJO_PROJECT/$MOJO_STAGE
165
> config=STAGED_SECRETS_DIRECTORY
166
> Directory where secrets are staged
167
> Default: /srv/mojo/LOCAL/$MOJO_PROJECT/$MOJO_STAGE
172
172
The collect phase gathers all code and other resources required to build your
173
173
service via codetree. Some services may be composed only of charms, while others
174
174
may collect static content, local configuration, or code that must be compiled.
177
177
format is the following where destination is relative to
178
178
$MOJO_WORKSPACE_DIR/build and source is a remote resource or a local directory.
181
../spec/destination source2
184
config=COLLECT_CONFIG_FILENAME
185
The name of the codetree collect configuration file
181
> destination source1
182
> ../spec/destination source2
185
> config=COLLECT_CONFIG_FILENAME
186
> The name of the codetree collect configuration file
189
### mojo builddeps ###
190
191
The builddeps phase prepares the lxc container by installing any required
191
192
packages, apt repositories or apt repository gpg keys. It is passed the package,
192
193
repos or repo_keys options using a comma delimited list.
195
repo_keys=APT_GPG_KEY[,APT_GPG_KEY]
196
Comma delimited list of apt repository GPG key file names
198
Comma delimited list of apt repositories (See man apt-add-repository)
199
packages=PACKAGE_NAME[,PACKAGE_NAME]
200
Comma delimited list of packages.
196
> repo_keys=APT_GPG_KEY[,APT_GPG_KEY]
197
> Comma delimited list of apt repository GPG key file names
199
> Comma delimited list of apt repositories (See man apt-add-repository)
200
> packages=PACKAGE_NAME[,PACKAGE_NAME]
201
> Comma delimited list of packages.
205
206
A script phase simply executes a user-defined script. Use scripts to manipulate
206
207
your Juju units directly or to set up external resources.
224
226
MOJO_LOCAL_DIR = Workspace local dir
225
227
MOJO_STAGE = Stage
229
The name of the script to be executed
231
Whether to execute the script inside the lxc container
232
Defaults to False, except for the build phase which forces
235
All KEY=VALUE paramaters will be set as environment variables for use
231
> The name of the script to be executed
233
> Whether to execute the script inside the lxc container
234
> Defaults to False, except for the build phase which forces
237
> All KEY=VALUE paramaters will be set as environment variables for use
241
242
A build phase is nearly identical to a script phase, except that network access
242
243
in the lxc container is prohibited during execution. This ensures that all
243
244
required resources are documented and available during collect.