15572: More information about setting up Azure credentials
[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 h2(#create-image). Create compute node VM image
27
28 Create a VM image following the steps "to set up a compute node":crunch2-slurm/install-compute-node.html
29
30 h2(#update-config). Update config.yml
31
32 h3. Create a private key
33
34 Generate an SSH private key with no passphrase. Save it in the cluster configuration file (see @PrivateKey@ in the example below).
35
36 <notextile>
37 <pre><code>~$ <span class="userinput">ssh-keygen -N '' -f ~/.ssh/id_dispatcher</span>
38 Generating public/private rsa key pair.
39 Your identification has been saved in /home/user/.ssh/id_dispatcher.
40 Your public key has been saved in /home/user/.ssh/id_dispatcher.pub.
41 The key fingerprint is:
42 [...]
43 ~$ <span class="userinput">cat ~/.ssh/id_dispatcher</span>
44 -----BEGIN RSA PRIVATE KEY-----
45 MIIEpQIBAAKCAQEAqXoCzcOBkFQ7w4dvXf9B++1ctgZRqEbgRYL3SstuMV4oawks
46 ttUuxJycDdsPmeYcHsKo8vsEZpN6iYsX6ZZzhkO5nEayUTU8sBjmg1ZCTo4QqKXr
47 ...
48 oFyAjVoexx0RBcH6BveTfQtJKbktP1qBO4mXo2dP0cacuZEtlAqW9Eb06Pvaw/D9
49 foktmqOY8MyctzFgXBpGTxPliGjqo8OkrOyQP2g+FL7v+Km31Xs61P8=
50 -----END RSA PRIVATE KEY-----
51 </code></pre>
52 </notextile>
53
54 You can delete the key files after you have copied the private key to your configuration file.
55
56 <notextile>
57 <pre><code>~$ <span class="userinput">rm ~/.ssh/id_dispatcher ~/.ssh/id_dispatcher.pub</span>
58 </code></pre>
59 </notextile>
60
61 h3. Configure CloudVMs
62
63 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.
64
65 <notextile>
66 <pre><code>    Services:
67       DispatchCloud:
68         InternalURLs:
69           "http://localhost:9006": {}
70     Containers:
71       CloudVMs:
72         # BootProbeCommand is a shell command that succeeds when an instance is ready for service
73         BootProbeCommand: "sudo systemctl status docker"
74
75         <b># --- driver-specific configuration goes here --- see Amazon and Azure examples below ---</b>
76
77       DispatchPrivateKey: |
78         -----BEGIN RSA PRIVATE KEY-----
79         MIIEpQIBAAKCAQEAqXoCzcOBkFQ7w4dvXf9B++1ctgZRqEbgRYL3SstuMV4oawks
80         ttUuxJycDdsPmeYcHsKo8vsEZpN6iYsX6ZZzhkO5nEayUTU8sBjmg1ZCTo4QqKXr
81         FJ+amZ7oYMDof6QEdwl6KNDfIddL+NfBCLQTVInOAaNss7GRrxLTuTV7HcRaIUUI
82         jYg0Ibg8ZZTzQxCvFXXnjseTgmOcTv7CuuGdt91OVdoq8czG/w8TwOhymEb7mQlt
83         lXuucwQvYgfoUgcnTgpJr7j+hafp75g2wlPozp8gJ6WQ2yBWcfqL2aw7m7Ll88Nd
84         [...]
85         oFyAjVoexx0RBcH6BveTfQtJKbktP1qBO4mXo2dP0cacuZEtlAqW9Eb06Pvaw/D9
86         foktmqOY8MyctzFgXBpGTxPliGjqo8OkrOyQP2g+FL7v+Km31Xs61P8=
87         -----END RSA PRIVATE KEY-----
88     InstanceTypes:
89       x1md:
90         ProviderType: x1.medium
91         VCPUs: 8
92         RAM: 64GiB
93         IncludedScratch: 64GB
94         Price: 0.62
95       x1lg:
96         ProviderType: x1.large
97         VCPUs: 16
98         RAM: 128GiB
99         IncludedScratch: 128GB
100         Price: 1.23
101 </code></pre>
102 </notextile>
103
104 h4. Minimal configuration example for Amazon EC2
105
106 <notextile>
107 <pre><code>    Containers:
108       CloudVMs:
109         ImageID: ami-01234567890abcdef
110         Driver: ec2
111         DriverParameters:
112           AccessKeyID: XXXXXXXXXXXXXXXXXXXX
113           SecretAccessKey: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
114           SecurityGroupIDs:
115           - sg-0123abcd
116           SubnetID: subnet-0123abcd
117           Region: us-east-1
118           EBSVolumeType: gp2
119           AdminUsername: arvados
120 </code></pre>
121 </notextile>
122
123 h4. Minimal configuration example for Azure
124
125 <notextile>
126 <pre><code>    Containers:
127       CloudVMs:
128         ImageID: "https://zzzzzzzz.blob.core.windows.net/system/Microsoft.Compute/Images/images/zzzzz-compute-osDisk.55555555-5555-5555-5555-555555555555.vhd"
129         Driver: azure
130         DriverParameters:
131           SubscriptionID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
132           ClientID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
133           ClientSecret: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
134           TenantID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
135           CloudEnvironment: AzurePublicCloud
136           ResourceGroup: zzzzz
137           Location: centralus
138           Network: zzzzz
139           Subnet: zzzzz-subnet-private
140           StorageAccount: example
141           BlobContainer: vhds
142           DeleteDanglingResourcesAfter: 20s
143           AdminUsername: arvados
144 </code></pre>
145 </notextile>
146
147 Get the @SubscriptionID@ and @TenantID@:
148
149 <pre>
150 $ az account list
151 [
152   {
153     "cloudName": "AzureCloud",
154     "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX",
155     "isDefault": true,
156     "name": "Your Subscription",
157     "state": "Enabled",
158     "tenantId": "YYYYYYYY-YYYY-YYYY-YYYYYYYY",
159     "user": {
160       "name": "you@example.com",
161       "type": "user"
162     }
163   }
164 ]
165 </pre>
166
167 You will need to create a "service principal" to use as a delegated authority for API access.
168
169 <pre>
170 $ az ad app create --display-name "Arvados Dispatch Cloud (ClusterID)" --homepage "https://arvados.org" --identifier-uris "https://ClusterID.example.com" --end-date 2299-12-31 --password <Your_Password>
171 $ az ad sp create "<appId>"
172 (appId is part of the response of the previous command)
173 $ az role assignment create --assignee "<objectId>" --role Owner --scope /subscriptions/{subscriptionId}/
174 (objectId is part of the response of the previous command)
175 </pre>
176
177 @ClientID@ is the 'appId' value.
178
179 @ClientSecret@ is what was provided as <Your_Password>.
180
181 h3. Test your configuration
182
183 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.
184
185 <notextile>
186 <pre><code>~$ <span class="userinput">arvados-server cloudtest && echo "OK!"</span>
187 </code></pre>
188 </notextile>
189
190 Refer to the "cloudtest tool documentation":../admin/cloudtest.html for more information.
191
192 {% assign arvados_component = 'arvados-dispatch-cloud' %}
193
194 {% include 'install_packages' %}
195
196 {% include 'start_service' %}
197
198 {% include 'restart_api' %}
199
200 h2(#confirm-working). Confirm working installation
201
202 On the dispatch node, start monitoring the arvados-dispatch-cloud logs:
203
204 <notextile>
205 <pre><code>~$ <span class="userinput">sudo journalctl -o cat -fu arvados-dispatch-cloud.service</span>
206 </code></pre>
207 </notextile>
208
209 "Make sure to install the arvados/jobs image.":install-jobs-image.html
210
211 Submit a simple container request:
212
213 <notextile>
214 <pre><code>shell:~$ <span class="userinput">arv container_request create --container-request '{
215   "name":            "test",
216   "state":           "Committed",
217   "priority":        1,
218   "container_image": "arvados/jobs:latest",
219   "command":         ["echo", "Hello, Crunch!"],
220   "output_path":     "/out",
221   "mounts": {
222     "/out": {
223       "kind":        "tmp",
224       "capacity":    1000
225     }
226   },
227   "runtime_constraints": {
228     "vcpus": 1,
229     "ram": 1048576
230   }
231 }'</span>
232 </code></pre>
233 </notextile>
234
235 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.
236
237 The @arvados-dispatch-cloud@ API a list of queued and running jobs.  For example:
238
239 <notextile>
240 <pre><code>~$ <span class="userinput">curl ...</span>
241 </code></pre>
242 </notextile>
243
244 When the container finishes, the dispatcher will log it.
245
246 After the container finishes, you can get the container record by UUID *from a shell server* to see its results:
247
248 <notextile>
249 <pre><code>shell:~$ <span class="userinput">arv get <b>zzzzz-dz642-hdp2vpu9nq14tx0</b></span>
250 {
251  ...
252  "exit_code":0,
253  "log":"a01df2f7e5bc1c2ad59c60a837e90dc6+166",
254  "output":"d41d8cd98f00b204e9800998ecf8427e+0",
255  "state":"Complete",
256  ...
257 }
258 </code></pre>
259 </notextile>
260
261 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:
262
263 <notextile>
264 <pre><code>~$ <span class="userinput">arv keep ls <b>a01df2f7e5bc1c2ad59c60a837e90dc6+166</b></span>
265 ./crunch-run.txt
266 ./stderr.txt
267 ./stdout.txt
268 ~$ <span class="userinput">arv-get <b>a01df2f7e5bc1c2ad59c60a837e90dc6+166</b>/stdout.txt</span>
269 2016-08-05T13:53:06.201011Z Hello, Crunch!
270 </code></pre>
271 </notextile>
272
273 If the container does not dispatch successfully, refer to the @arvados-dispatch-cloud@ logs for information about why it failed.