Merge branch 'master' into 6465-optimize-workbench-integration-tests
[arvados.git] / doc / install / install-compute-node.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install a compute node
5 ...
6
7 h2. Install dependencies
8
9 First, "add the appropriate package repository for your distribution":{{ site.baseurl }}/install/install-manual-prerequisites.html#repos.
10
11 On Debian-based systems:
12
13 <notextile>
14 <pre><code>~$ <span class="userinput">sudo apt-get install perl python-virtualenv fuse python-arvados-python-client python-arvados-fuse crunchstat iptables ca-certificates</span>
15 </code></pre>
16 </notextile>
17
18 On Red Hat-based systems:
19
20 <notextile>
21 <pre><code>~$ <span class="userinput">sudo yum install perl python27-python-virtualenv fuse python27-python-arvados-python-client python27-python-arvados-fuse crunchstat iptables ca-certificates</span>
22 </code></pre>
23 </notextile>
24
25 {% include 'note_python27_sc' %}
26
27 h2. Set up Docker
28
29 Compute nodes must have Docker installed to run jobs inside containers.  This requires a relatively recent version of Linux (at least upstream version 3.10, or a distribution version with the appropriate patches backported).  Follow the "Docker Engine installation documentation":https://docs.docker.com/ for your distribution.
30
31 For Debian-based systems, the Arvados package repository includes a backported @docker.io@ package with a known-good version you can install.
32
33 h2. Set up SLURM
34
35 Install SLURM following "the same process you used to install the Crunch dispatcher":{{ site.baseurl }}/install/install-crunch-dispatch.html#slurm.
36
37 h2. Copy configuration files from the dispatcher (API server)
38
39 The @/etc/slurm-llnl/slurm.conf@ and @/etc/munge/munge.key@ files need to be identicaly across the dispatcher and all compute nodes. Copy the files you created in the "Install the Crunch dispatcher":{{site.baseurl}} step to this compute node.
40
41 h2. Configure FUSE
42
43 Install this file as @/etc/fuse.conf@:
44
45 <notextile>
46 <pre>
47 # Set the maximum number of FUSE mounts allowed to non-root users.
48 # The default is 1000.
49 #
50 #mount_max = 1000
51
52 # Allow non-root users to specify the 'allow_other' or 'allow_root'
53 # mount options.
54 #
55 user_allow_other
56 </pre>
57 </notextile>
58
59 h2. Crunch user account
60
61 Create a Crunch user account, and add it to the @fuse@ and @docker@ groups so it can use those tools:
62
63 <notextile>
64 <pre><code>~$ <span class="userinput">sudo useradd --groups fuse,docker crunch</span>
65 </code></pre>
66 </notextile>
67
68 The crunch user should have the same UID, GID, and home directory across all compute nodes and the dispatcher (API server).
69
70 h2. Tell the API server about this compute node
71
72 Load your API superuser token on the compute node:
73
74 <notextile>
75 <pre><code>
76 ~$ <span class="userinput">HISTIGNORE=$HISTIGNORE:'export ARVADOS_API_TOKEN=*'</span>
77 ~$ <span class="userinput">export ARVADOS_API_TOKEN=@your-superuser-token@</span>
78 ~$ <span class="userinput">export ARVADOS_API_HOST=@uuid_prefix.your.domain@</span>
79 ~$ <span class="userinput">unset ARVADOS_API_HOST_INSECURE</span>
80 </code>
81 </pre>
82 </notextile>
83
84 Then execute this script to create a compute node object, and set up a cron job to have the compute node ping the API server every five minutes:
85
86 <notextile>
87 <pre><code>
88 #!/bin/bash
89 set -e
90 if ! test -f /root/node.json ; then
91     python - &lt;&lt;EOF
92 import arvados, json, socket
93 node = arvados.api('v1').nodes().create(body={'hostname': socket.gethostname()}).execute()
94 with open('/root/node.json', 'w') as node_file:
95     json.dump(node, node_file, indent=2)
96 EOF
97
98     # Make sure /dev/fuse permissions are correct (the device appears after fuse is loaded)
99     chmod 1660 /dev/fuse && chgrp fuse /dev/fuse
100 fi
101
102 UUID=`grep \"uuid\" /root/node.json  |cut -f4 -d\"`
103 PING_SECRET=`grep \"ping_secret\" /root/node.json  |cut -f4 -d\"`
104
105 if ! test -f /etc/cron.d/node_ping ; then
106     echo "*/5 * * * * root /usr/bin/curl -k -d ping_secret=$PING_SECRET https://api/arvados/v1/nodes/$UUID/ping" > /etc/cron.d/node_ping
107 fi
108
109 /usr/bin/curl -k -d ping_secret=$PING_SECRET https://api/arvados/v1/nodes/$UUID/ping?ping_secret=$PING_SECRET
110 </code>
111 </pre>
112 </notextile>
113
114 And remove your token from the environment:
115
116 <notextile>
117 <pre><code>
118 ~$ <span class="userinput">unset ARVADOS_API_TOKEN</span>
119 ~$ <span class="userinput">unset ARVADOS_API_HOST</span>
120 </code>
121 </pre>
122 </notextile>
123