8784: Fix test for latest firefox.
[arvados.git] / doc / install / install-keepproxy.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install Keepproxy server
5 ...
6
7 The Keepproxy server is a gateway into your Keep storage. Unlike the Keepstore servers, which are only accessible on the local LAN, Keepproxy is suitable for clients located elsewhere on the internet. Specifically, in contrast to Keepstore:
8 * A client writing through Keepproxy generates less network traffic: the client sends a single copy of a data block, and Keepproxy sends copies to the appropriate Keepstore servers.
9 * A client can write through Keepproxy without precomputing content hashes. Notably, the browser-based upload feature in Workbench requires Keepproxy.
10 * Keepproxy checks API token validity before processing requests. (Clients that can connect directly to Keepstore can use it as scratch space even without a valid API token.)
11
12 By convention, we use the following hostname for the Keepproxy server:
13
14 <div class="offset1">
15 table(table table-bordered table-condensed).
16 |_Hostname_|
17 |keep.@uuid_prefix@.your.domain|
18 </div>
19
20 This hostname should resolve from anywhere on the internet.
21
22 h2. Install Keepproxy
23
24 On Debian-based systems:
25
26 <notextile>
27 <pre><code>~$ <span class="userinput">sudo apt-get install keepproxy</span>
28 </code></pre>
29 </notextile>
30
31 On Red Hat-based systems:
32
33 <notextile>
34 <pre><code>~$ <span class="userinput">sudo yum install keepproxy</span>
35 </code></pre>
36 </notextile>
37
38 Verify that Keepproxy is functional:
39
40 <notextile>
41 <pre><code>~$ <span class="userinput">keepproxy -h</span>
42 ...
43 Usage: keepproxy [-config path/to/keepproxy.yml]
44 ...
45 </code></pre>
46 </notextile>
47
48 h3. Create an API token for the Keepproxy server
49
50 {% assign railscmd = "bundle exec ./script/get_anonymous_user_token.rb --get" %}
51 {% assign railsout = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" %}
52 The Keepproxy server needs a token to talk to the API server.  On the <strong>API server</strong>, use the following command to create the token.  {% include 'install_rails_command' %}
53
54 h3. Set up the Keepproxy service
55
56 Install runit to supervise the keepproxy daemon.  {% include 'install_runit' %}
57
58 The run script for the keepproxy service should set the environment variables @ARVADOS_API_TOKEN@ (with the token you just generated), @ARVADOS_API_HOST@, and, if needed, @ARVADOS_API_HOST_INSECURE@.  The core keepproxy command to run is:
59
60 <notextile>
61 <pre><code>ARVADOS_API_TOKEN=<span class="userinput">{{railsout}}</span> ARVADOS_API_HOST=<span class="userinput">uuid_prefix.your.domain</span> exec keepproxy
62 </code></pre>
63 </notextile>
64
65 h3. Set up a reverse proxy with SSL support
66
67 Because the Keepproxy is intended for access from anywhere on the internet, it is recommended to use SSL for transport encryption.
68
69 This is best achieved by putting a reverse proxy with SSL support in front of Keepproxy. Keepproxy itself runs on port 25107 by default; your reverse proxy can run on port 443 and pass requests to Keepproxy on port 25107.
70
71 <notextile><pre>
72 upstream keepproxy {
73   server                127.0.0.1:<span class="userinput">25107</span>;
74 }
75
76 server {
77   listen                <span class="userinput">[your public IP address]</span>:443 ssl;
78   server_name           keep.<span class="userinput">uuid_prefix</span>.your.domain;
79
80   proxy_connect_timeout 90s;
81   proxy_read_timeout    300s;
82   proxy_set_header      X-Real-IP $remote_addr;
83
84   ssl                   on;
85   ssl_certificate       /etc/nginx/keep.<span class="userinput">uuid_prefix</span>.your.domain-ssl.crt;
86   ssl_certificate_key   /etc/nginx/keep.<span class="userinput">uuid_prefix</span>.your.domain-ssl.key;
87
88   # Clients need to be able to upload blocks of data up to 64MiB in size.
89   client_max_body_size  64m;
90
91   location / {
92     proxy_pass          http://keepproxy;
93   }
94 }
95 </pre></notextile>
96
97 Note: if the Web uploader is failing to upload data and there are no logs from keepproxy, be sure to check the nginx proxy logs.  In addition to "GET" and "PUT", The nginx proxy must pass "OPTIONS" requests to keepproxy, which should respond with appropriate Cross-origin resource sharing headers.  If the CORS headers are not present, brower security policy will cause the upload request to silently fail.  The CORS headers are generated by keepproxy and should not be set in nginx.
98
99 h3. Tell the API server about the Keepproxy server
100
101 The API server needs to be informed about the presence of your Keepproxy server. Please execute the following commands on your <strong>shell server</strong>.
102
103 <notextile>
104 <pre><code>~$ <span class="userinput">uuid_prefix=`arv --format=uuid user current | cut -d- -f1`</span>
105 ~$ <span class="userinput">echo "Site prefix is '$uuid_prefix'"</span>
106 ~$ <span class="userinput">read -rd $'\000' keepservice &lt;&lt;EOF; arv keep_service create --keep-service "$keepservice"</span>
107 <span class="userinput">{
108  "service_host":"<strong>keep.$uuid_prefix.your.domain</strong>",
109  "service_port":443,
110  "service_ssl_flag":true,
111  "service_type":"proxy"
112 }
113 EOF</span>
114 </code></pre></notextile>