15572: Documentation tweaks from experience installing dev cluster
[arvados.git] / doc / install / install-dispatch-cloud.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install the cloud dispatcher
5 ...
6 {% comment %}
7 Copyright (C) The Arvados Authors. All rights reserved.
8
9 SPDX-License-Identifier: CC-BY-SA-3.0
10 {% endcomment %}
11
12 # "Introduction":#introduction
13 # "Create compute node VM image":#create-image
14 # "Update config.yml":#update-config
15 # "Install arvados-dispatch-cloud":#install-packages
16 # "Start the service":#start-service
17 # "Restart the API server and controller":#restart-api
18 # "Confirm working installation":#confirm-working
19
20 h2(#introduction). Introduction
21
22 The cloud dispatch service is for running containers on cloud VMs. It works with Microsoft Azure and Amazon EC2; future versions will also support Google Compute Engine.
23
24 The cloud dispatch service can run on any node that can connect to the Arvados API service, the cloud provider's API, and the SSH service on cloud VMs.  It is not resource-intensive, so you can run it on the API server node.
25
26 *Only one dispatch process should be running at a time.* If you are migrating a system that currently runs @crunch-dispatch-slurm@, it is safest to remove the @crunch-dispatch-slurm@ service entirely before installing @arvados-dispatch-cloud@.
27
28 <notextile>
29 <pre><code>~$ <span class="userinput">sudo systemctl --now disable crunch-dispatch-slurm</span>
30 ~$ <span class="userinput">sudo apt-get remove crunch-dispatch-slurm</span>
31 </code></pre>
32 </notextile>
33
34 h2(#create-image). Create compute node VM image
35
36 Create a VM image following the steps "to set up a compute node":crunch2-slurm/install-compute-node.html
37
38 h2(#update-config). Update config.yml
39
40 h3. Create a private key
41
42 Generate an SSH private key with no passphrase. Save it in the cluster configuration file (see @PrivateKey@ in the example below).
43
44 <notextile>
45 <pre><code>~$ <span class="userinput">ssh-keygen -N '' -f ~/.ssh/id_dispatcher</span>
46 Generating public/private rsa key pair.
47 Your identification has been saved in /home/user/.ssh/id_dispatcher.
48 Your public key has been saved in /home/user/.ssh/id_dispatcher.pub.
49 The key fingerprint is:
50 [...]
51 ~$ <span class="userinput">cat ~/.ssh/id_dispatcher</span>
52 -----BEGIN RSA PRIVATE KEY-----
53 MIIEpQIBAAKCAQEAqXoCzcOBkFQ7w4dvXf9B++1ctgZRqEbgRYL3SstuMV4oawks
54 ttUuxJycDdsPmeYcHsKo8vsEZpN6iYsX6ZZzhkO5nEayUTU8sBjmg1ZCTo4QqKXr
55 ...
56 oFyAjVoexx0RBcH6BveTfQtJKbktP1qBO4mXo2dP0cacuZEtlAqW9Eb06Pvaw/D9
57 foktmqOY8MyctzFgXBpGTxPliGjqo8OkrOyQP2g+FL7v+Km31Xs61P8=
58 -----END RSA PRIVATE KEY-----
59 </code></pre>
60 </notextile>
61
62 You can delete the key files after you have copied the private key to your configuration file.
63
64 <notextile>
65 <pre><code>~$ <span class="userinput">rm ~/.ssh/id_dispatcher ~/.ssh/id_dispatcher.pub</span>
66 </code></pre>
67 </notextile>
68
69 h3. Configure CloudVMs
70
71 Add or update the following portions of your cluster configuration file, @/etc/arvados/config.yml@. Refer to "config.defaults.yml":{{site.baseurl}}/admin/config.html for information about additional configuration options.
72
73 <notextile>
74 <pre><code>    Services:
75       DispatchCloud:
76         InternalURLs:
77           "http://localhost:9006": {}
78     Containers:
79       CloudVMs:
80         # BootProbeCommand is a shell command that succeeds when an instance is ready for service
81         BootProbeCommand: "sudo systemctl status docker"
82
83         <b># --- driver-specific configuration goes here --- see Amazon and Azure examples below ---</b>
84
85       DispatchPrivateKey: |
86         -----BEGIN RSA PRIVATE KEY-----
87         MIIEpQIBAAKCAQEAqXoCzcOBkFQ7w4dvXf9B++1ctgZRqEbgRYL3SstuMV4oawks
88         ttUuxJycDdsPmeYcHsKo8vsEZpN6iYsX6ZZzhkO5nEayUTU8sBjmg1ZCTo4QqKXr
89         FJ+amZ7oYMDof6QEdwl6KNDfIddL+NfBCLQTVInOAaNss7GRrxLTuTV7HcRaIUUI
90         jYg0Ibg8ZZTzQxCvFXXnjseTgmOcTv7CuuGdt91OVdoq8czG/w8TwOhymEb7mQlt
91         lXuucwQvYgfoUgcnTgpJr7j+hafp75g2wlPozp8gJ6WQ2yBWcfqL2aw7m7Ll88Nd
92         [...]
93         oFyAjVoexx0RBcH6BveTfQtJKbktP1qBO4mXo2dP0cacuZEtlAqW9Eb06Pvaw/D9
94         foktmqOY8MyctzFgXBpGTxPliGjqo8OkrOyQP2g+FL7v+Km31Xs61P8=
95         -----END RSA PRIVATE KEY-----
96     InstanceTypes:
97       x1md:
98         ProviderType: x1.medium
99         VCPUs: 8
100         RAM: 64GiB
101         IncludedScratch: 64GB
102         Price: 0.62
103       x1lg:
104         ProviderType: x1.large
105         VCPUs: 16
106         RAM: 128GiB
107         IncludedScratch: 128GB
108         Price: 1.23
109 </code></pre>
110 </notextile>
111
112 Minimal configuration example for Amazon EC2:
113
114 <notextile>
115 <pre><code>    Containers:
116       CloudVMs:
117         ImageID: ami-01234567890abcdef
118         Driver: ec2
119         DriverParameters:
120           AccessKeyID: EALMF21BJC7MKNF9FVVR
121           SecretAccessKey: yKJAPmoCQOMtYWzEUQ1tKTyrocTcbH60CRvGP3pM
122           SecurityGroupIDs:
123           - sg-0123abcd
124           SubnetID: subnet-0123abcd
125           Region: us-east-1
126           EBSVolumeType: gp2
127           AdminUsername: debian
128 </code></pre>
129 </notextile>
130
131 Minimal configuration example for Azure:
132
133 <notextile>
134 <pre><code>    Containers:
135       CloudVMs:
136         ImageID: "https://zzzzzzzz.blob.core.windows.net/system/Microsoft.Compute/Images/images/zzzzz-compute-osDisk.55555555-5555-5555-5555-555555555555.vhd"
137         Driver: azure
138         DriverParameters:
139           SubscriptionID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
140           ClientID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
141           ClientSecret: 2WyXt0XFbEtutnf2hp528t6Wk9S5bOHWkRaaWwavKQo=
142           TenantID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
143           CloudEnvironment: AzurePublicCloud
144           ResourceGroup: zzzzz
145           Location: centralus
146           Network: zzzzz
147           Subnet: zzzzz-subnet-private
148           StorageAccount: example
149           BlobContainer: vhds
150           DeleteDanglingResourcesAfter: 20s
151           AdminUsername: arvados
152 </code></pre>
153 </notextile>
154
155 h3. Test your configuration
156
157 Run the @cloudtest@ tool to verify that your configuration works. This creates a new cloud VM, confirms that it boots correctly and accepts your configured SSH private key, and shuts it down.
158
159 <notextile>
160 <pre><code>~$ <span class="userinput">arvados-server cloudtest && echo "OK!"</span>
161 </code></pre>
162 </notextile>
163
164 Refer to the "cloudtest tool documentation":../admin/cloudtest.html for more information.
165
166 {% assign arvados_component = 'arvados-dispatch-cloud' %}
167
168 {% include 'install_packages' %}
169
170 {% include 'start_service' %}
171
172 {% include 'restart_api' %}
173
174 h2(#confirm-working). Confirm working installation
175
176 On the dispatch node, start monitoring the arvados-dispatch-cloud logs:
177
178 <notextile>
179 <pre><code>~$ <span class="userinput">sudo journalctl -o cat -fu arvados-dispatch-cloud.service</span>
180 </code></pre>
181 </notextile>
182
183 Submit a simple container request:
184
185 <notextile>
186 <pre><code>shell:~$ <span class="userinput">arv container_request create --container-request '{
187   "name":            "test",
188   "state":           "Committed",
189   "priority":        1,
190   "container_image": "arvados/jobs:latest",
191   "command":         ["echo", "Hello, Crunch!"],
192   "output_path":     "/out",
193   "mounts": {
194     "/out": {
195       "kind":        "tmp",
196       "capacity":    1000
197     }
198   },
199   "runtime_constraints": {
200     "vcpus": 1,
201     "ram": 8388608
202   }
203 }'</span>
204 </code></pre>
205 </notextile>
206
207 This command should return a record with a @container_uuid@ field.  Once @arvados-dispatch-cloud@ polls the API server for new containers to run, you should see it dispatch that same container.
208
209 The @arvados-dispatch-cloud@ API a list of queued and running jobs.  For example:
210
211 <notextile>
212 <pre><code>~$ <span class="userinput">curl ...</span>
213 </code></pre>
214 </notextile>
215
216 When the container finishes, the dispatcher will log it.
217
218 After the container finishes, you can get the container record by UUID *from a shell server* to see its results:
219
220 <notextile>
221 <pre><code>shell:~$ <span class="userinput">arv get <b>zzzzz-dz642-hdp2vpu9nq14tx0</b></span>
222 {
223  ...
224  "exit_code":0,
225  "log":"a01df2f7e5bc1c2ad59c60a837e90dc6+166",
226  "output":"d41d8cd98f00b204e9800998ecf8427e+0",
227  "state":"Complete",
228  ...
229 }
230 </code></pre>
231 </notextile>
232
233 You can use standard Keep tools to view the container's output and logs from their corresponding fields.  For example, to see the logs from the collection referenced in the @log@ field:
234
235 <notextile>
236 <pre><code>~$ <span class="userinput">arv keep ls <b>a01df2f7e5bc1c2ad59c60a837e90dc6+166</b></span>
237 ./crunch-run.txt
238 ./stderr.txt
239 ./stdout.txt
240 ~$ <span class="userinput">arv-get <b>a01df2f7e5bc1c2ad59c60a837e90dc6+166</b>/stdout.txt</span>
241 2016-08-05T13:53:06.201011Z Hello, Crunch!
242 </code></pre>
243 </notextile>
244
245 If the container does not dispatch successfully, refer to the @arvados-dispatch-cloud@ logs for information about why it failed.