@@ -14,54 +14,8 @@ network access. As of writing, the only supported OS is Linux.
1414
1515## Getting Started
1616
17- This short guide assumes Ruby 1.9 and Bundler are already available. Ensure that
18- Ruby 1.9 has GNU readline library support through the package: 'libreadline-dev'
19- and zlib support through the 'zlib1g-dev' package.
20-
21- #### Install the right kernel
22-
23- If you are running Ubuntu 10.04 (Lucid), make sure the backported Natty
24- kernel is installed. After installing, reboot the system before
25- continuing.
26-
27- ```
28- sudo apt-get install -y linux-image-generic-lts-backport-natty
29- ```
30-
31- #### Install dependencies
32-
33- ```
34- sudo apt-get install -y build-essential debootstrap quota
35- ```
36-
37- #### Setup Warden
38-
39- Run the setup routine, which compiles the C code bundled with Warden and
40- sets up the base file system for Linux containers.
41-
42- ```
43- sudo bundle exec rake setup[config/linux.yml]
44- ```
45-
46- ** NOTE** :
47- If ` sudo ` complains that ` bundle ` cannot be found, try `sudo
48- env PATH=$PATH` to pass your current ` PATH` to the ` sudo` environment.
49-
50- The setup routine sets up the file system for the containers at the directory
51- path specified under the key: server -> container_rootfs_path in the
52- config file: config/linux.yml.
53-
54- #### Run Warden
55-
56- ```
57- sudo bundle exec rake warden:start[config/linux.yml]
58- ```
59-
60- #### Interact with Warden
61-
62- ```
63- bundle exec bin/warden
64- ```
17+ * [ On Ubuntu Lucid (10.04)] ( doc/getting\_ started.ubuntu.md )
18+ * [ On CentOS 6] ( doc/getting\_ started.centos.md )
6519
6620## Implementation for Linux
6721
@@ -191,42 +145,51 @@ default. Every command invocation is formatted as a JSON array, where
191145the first element is the command name and subsequent elements can be any
192146JSON object. The commands it responds to are as follows:
193147
194- ` create [BIND_MOUNTS] [--grace_time TIME] [--handle NAME] [--rootfs ROOTFS] [--network IP ] `
148+ ### ` create [CONFIG ] `
195149
196150Creates a new container.
197151
198152Returns the handle of the container which is used to identify it.
199153
200- ` --bind_mounts[] `
154+ The optional ` CONFIG ` parameter is a hash that specifies configuration
155+ options used during container creation. The supported options are:
201156
202- If supplied, this is an array of hashes specifying a set of paths to be
203- bind mounted inside the container. The notation is as follows:
157+ #### ` bind_mounts `
204158
205- ` --bind_mounts[0].field1=val1 --bind_mounts[0].field2=val2 ... `
159+ If supplied, this specifies a set of paths to be bind mounted inside the
160+ container. The value must be an array. The elements in this array
161+ specify the bind mounts to execute, and are executed in order. Every
162+ element must be of the form:
206163
207- The three fields must be specified for each element of the array:
208-
209- * ` src_path ` : Path in the host filesystem
210- * ` dst_path ` : Path in the container
211- * ` mode ` : Mount in read-only (` RO ` ) or read-write (` RW ` ).
164+ ```
165+ [
166+ # Path in the host filesystem
167+ "/host/path",
168+
169+ # Path in the container
170+ "/path/in/container",
171+
172+ # Optional hash with options. The `mode` key specifies whether the bind
173+ # mount should be remounted as `ro` (read-only) or `rw` (read-write).
174+ {
175+ "mode" => "ro|rw"
176+ }
177+ ]
178+ ```
212179
213- ` -- grace_time`
180+ #### ` grace_time `
214181
215182If specified, this setting overrides the default time of a container not
216183being referenced by any client until it is destroyed. The value can
217184either be the number of seconds as floating point number or integer, or
218185the ` null ` value to completely disable the grace time.
219186
220- ` --handle NAME `
221-
222- If specified, this setting overrides the name of the container, instead
223- of randomly generating one.
187+ #### ` disk_size_mb `
224188
225- ` --network IP `
189+ If specified, this setting overrides the default size of the container's
190+ scratch filesystem. The value is expected to be an integer number.
226191
227- If specified, this setting specifies the external IP address of the container.
228-
229- ` spawn --handle HANDLE --script SCRIPT [OPTS] `
192+ ### ` spawn HANDLE SCRIPT [OPTS] `
230193
231194Run the script ` SCRIPT ` in the container identified by ` HANDLE ` .
232195
@@ -237,11 +200,11 @@ may go away and reconnect later while still being able to reap the job.
237200The optional ` OPTS ` parameter is a hash that specifies options modifying the
238201command being run. The supported options are:
239202
240- ` privileged `
203+ #### ` privileged `
241204
242205If true, this specifies that the script should be run as root.
243206
244- ` link --handle HANDLE --job_id JOB_ID `
207+ ### ` link HANDLE JOB_ID `
245208
246209Reap the script identified by ` JOB_ID ` , running in the container
247210identified by ` HANDLE ` .
@@ -251,7 +214,7 @@ containing its `STDOUT` and a string containing its `STDERR`. These
251214elements may be ` null ` when they cannot be determined (e.g. the
252215script couldn't be executed, was killed, etc.).
253216
254- ` stream --handle HANDLE --job_id JOB_ID `
217+ ### ` stream HANDLE JOB_ID `
255218
256219Stream ` STDOUT ` and ` STDERR ` of scripts identified by ` JOB_ID ` , running
257220in the container identified by ` HANDLE ` .
@@ -261,32 +224,27 @@ or `STDERR` as the first element, and a chunk of the stream as the
261224second element. Returns an empty tuple when no more data is available
262225in the stream.
263226
264- ` limit_memory --handle HANDLE [--limit_in_bytes BYTES] `
265-
266- Set or get memory limits for the container identified by ` HANDLE ` .
227+ ### ` limit HANDLE (mem) [VALUE] `
267228
268- The memory limit is specified in number of bytes. It is enforced using
269- the control group associated with the container. When a container
270- exceeds this limit, one or more of its processes will be killed by the
271- kernel. Additionally, the Warden will be notified that an OOM happened
272- and it subsequently tears down the container.
229+ Set or get resource limits for the container identified by ` HANDLE ` .
273230
274- ` limit_disk --handle HANDLE `
231+ The following resources can be limited:
275232
276- Set or get disk limits for the container identified by ` HANDLE ` .
233+ * The memory limit is specified in number of bytes. It is enforced using
234+ the control group associated with the container. When a container
235+ exceeds this limit, one or more of its processes will be killed by the
236+ kernel. Additionally, the Warden will be notified that an OOM happened
237+ and it subsequently tears down the container.
277238
278- There are several ways to specify disk limits. See ` limit_disk --help `
279- for options.
280-
281- ` net_in --handle HANDLE [--host_port PORT] [--container_port PORT] `
239+ ### ` net HANDLE in `
282240
283241Forward a port on the external interface of the host to the container
284242identified by ` HANDLE ` .
285243
286244Returns the port number that is mapped to the container. This port
287245number is the same on the inside of the container.
288246
289- ` net_out --handle HANDLE [--network ADDRESS[/MASK]] [--port PORT]`
247+ ### ` net HANDLE out ADDRESS[/MASK][: PORT]`
290248
291249Allow traffic from the container identified by ` HANDLE ` to the network
292250address specified by ` ADDRESS ` . Additionally, the address may be masked
@@ -295,7 +253,7 @@ specific port.
295253
296254Returns ` ok ` .
297255
298- ` copy_in --handle HANDLE --src_path SRC_PATH --dst_path DST_PATH`
256+ ### ` copy HANDLE in SRC_PATH DST_PATH`
299257
300258Copy the contents at ` SRC_PATH ` on the host to ` DST_PATH ` in the
301259container identified by ` HANDLE ` .
@@ -308,7 +266,7 @@ contents of the directory will be copied. Otherwise, the outermost
308266directory, along with its contents, will be copied. The unprivileged
309267user will be the owner of the files in the container.
310268
311- ` copy_out --handle HANDLE --src_path SRC_PATH --dst_path DST_PATH [--owner OWNER]`
269+ ### ` copy HANDLE out SRC_PATH DST_PATH [OWNER]`
312270
313271Copy the contents at ` SRC_PATH ` in the container identified by ` HANDLE `
314272to ` DST_PATH ` on the host.
@@ -321,7 +279,7 @@ root. If the `OWNER` argument is supplied (in the form of `USER:GROUP`),
321279files on the host will be chowned to this user/group after the copy has
322280completed.
323281
324- ` stop --handle HANDLE [--background] [--kill] `
282+ ### ` stop HANDLE `
325283
326284Stop processes running inside the container identified by ` HANDLE ` .
327285
@@ -330,7 +288,7 @@ Returns `ok`.
330288Because all processes are taken down, unfinished scripts will likely
331289terminate without an exit status being available.
332290
333- ` destroy --handle HANDLE `
291+ ### ` destroy HANDLE `
334292
335293Stop processes and destroy all resources associated with the container
336294identified ` HANDLE ` .
@@ -363,17 +321,6 @@ Other dependencies are:
363321
364322Further bootstrapping of Warden can be done by running ` rake setup ` .
365323
366- ## Logs
367-
368- Warden uses [ steno] ( https://github.com/cloudfoundry/steno ) for its logging. Here are some examples for each log level:
369-
370- * ` error ` - a command has timed out or printed too much output
371- * ` warn ` - a shell command sent to a container has failed
372- * ` info ` - a container is being destroyed due to a timeout, warden displays how long a command
373- took
374- * ` debug2 ` - a shell command sent to a container has succeeded, a timer has been set or stopped
375- * ` debug ` - a snapshot has been taken, a container was created or destroyed normally
376-
377324## Hacking
378325
379326The included tests create and destroy real containers, so require system
0 commit comments