Merge branch '7724-scoped-token' closes #7724
[arvados.git] / doc / install / install-keep-web.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install the keep-web server
5 ...
6
7 The keep-web server provides read-only HTTP access to files stored in Keep. It serves public data to unauthenticated clients, and serves private data to clients that supply Arvados API tokens. It can be installed anywhere with access to Keep services, typically behind a web proxy that provides SSL support. See the "godoc page":http://godoc.org/github.com/curoverse/arvados/services/keep-web for more detail.
8
9 By convention, we use the following hostname for the keep-web service:
10
11 <notextile>
12 <pre><code>collections.<span class="userinput">uuid_prefix</span>.your.domain
13 </code></pre>
14 </notextile>
15
16 This hostname should resolve from anywhere on the internet.
17
18 h2. Install keep-web
19
20 On Debian-based systems:
21
22 <notextile>
23 <pre><code>~$ <span class="userinput">sudo apt-get install keep-web</span>
24 </code></pre>
25 </notextile>
26
27 On Red Hat-based systems:
28
29 <notextile>
30 <pre><code>~$ <span class="userinput">sudo yum install keep-web</span>
31 </code></pre>
32 </notextile>
33
34 Verify that @keep-web@ is functional:
35
36 <notextile>
37 <pre><code>~$ <span class="userinput">keep-web -h</span>
38 Usage of keep-web:
39   -allow-anonymous
40         Serve public data to anonymous clients. Try the token supplied in the ARVADOS_API_TOKEN environment variable when none of the tokens provided in an HTTP request succeed in reading the desired collection. (default false)
41   -attachment-only-host string
42         Accept credentials, and add "Content-Disposition: attachment" response headers, for requests at this hostname:port. Prohibiting inline display makes it possible to serve untrusted and non-public content from a single origin, i.e., without wildcard DNS or SSL.
43   -listen string
44         Address to listen on: "host:port", or ":port" to listen on all interfaces. (default ":80")
45   -trust-all-content
46         Serve non-public content from a single origin. Dangerous: read docs before using!
47 </code></pre>
48 </notextile>
49
50 If you intend to use Keep-web to serve public data to anonymous clients, configure it with an anonymous token. You can use the same one you used when you set up your Keepproxy server, or use the following command on the <strong>API server</strong> to create another:
51
52 <notextile>
53 <pre><code>/var/www/arvados-api/current/script$ <span class="userinput">RAILS_ENV=production bundle exec ./get_anonymous_user_token.rb</span>
54 hoShoomoo2bai3Ju1xahg6aeng1siquuaZ1yae2gi2Uhaeng2r
55 </code></pre></notextile>
56
57 We recommend running @keep-web@ under "runit":https://packages.debian.org/search?keywords=runit or a similar supervisor. The basic command to start @keep-web@ is:
58
59 <notextile>
60 <pre><code>export ARVADOS_API_HOST=<span class="userinput">uuid_prefix</span>.your.domain
61 export ARVADOS_API_TOKEN="<span class="userinput">hoShoomoo2bai3Ju1xahg6aeng1siquuaZ1yae2gi2Uhaeng2r</span>"
62 exec sudo -u nobody keep-web -listen=<span class="userinput">:9002</span> -allow-anonymous 2&gt;&amp;1
63 </code></pre>
64 </notextile>
65
66 Omit the @-allow-anonymous@ argument if you do not want to serve public data.
67
68 Set @ARVADOS_API_HOST_INSECURE=1@ if your API server's SSL certificate is not signed by a recognized CA.
69
70 h3. Set up a reverse proxy with SSL support
71
72 The keep-web service will be accessible from anywhere on the internet, so we recommend using SSL for transport encryption.
73
74 This is best achieved by putting a reverse proxy with SSL support in front of keep-web, running on port 443 and passing requests to keep-web on port 9002 (or whatever port you chose in your run script).
75
76 Note: A wildcard SSL certificate is required in order to proxy keep-web effectively.
77
78 For example, using Nginx:
79
80 <notextile><pre>
81 upstream keep-web {
82   server                127.0.0.1:<span class="userinput">9002</span>;
83 }
84
85 server {
86   listen                <span class="userinput">[your public IP address]</span>:443 ssl;
87   server_name           collections.<span class="userinput">uuid_prefix</span>.your.domain *.collections.<span class="userinput">uuid_prefix</span>.your.domain ~.*--collections.<span class="userinput">uuid_prefix</span>.your.domain;
88
89   proxy_connect_timeout 90s;
90   proxy_read_timeout    300s;
91
92   ssl                   on;
93   ssl_certificate       <span class="userinput"/>YOUR/PATH/TO/cert.pem</span>;
94   ssl_certificate_key   <span class="userinput"/>YOUR/PATH/TO/cert.key</span>;
95
96   location / {
97     proxy_pass          http://keep-web;
98     proxy_set_header    Host            $host;
99     proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
100   }
101 }
102 </pre></notextile>
103
104 h3. Configure DNS
105
106 Configure your DNS servers so the following names resolve to your Nginx proxy's public IP address.
107 * @*--collections.uuid_prefix.your.domain@, if your DNS server allows this without interfering with other DNS names; or
108 * @*.collections.uuid_prefix.your.domain@, if you have a wildcard SSL certificate valid for these names; or
109 * @collections.uuid_prefix.your.domain@, if neither of the above options is feasible. In this case, only unauthenticated requests will be served, i.e., public data and collection sharing links.
110
111 h3. Tell Workbench about the keep-web service
112
113 Add *one* of the following entries to your Workbench configuration file (@/etc/arvados/workbench/application.yml@), depending on your DNS setup:
114
115 <notextile>
116 <pre><code>keep_web_url: https://%{uuid_or_pdh}--collections.<span class="userinput">uuid_prefix</span>.your.domain
117 keep_web_url: https://%{uuid_or_pdh}.collections.<span class="userinput">uuid_prefix</span>.your.domain
118 keep_web_url: https://collections.<span class="userinput">uuid_prefix</span>.your.domain
119 </code></pre>
120 </notextile>