Merge branch '5353-node-sizes' closes #5353
[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 hostnames for the keep-web service:
10
11 <notextile>
12 <pre><code>download.<span class="userinput">uuid_prefix</span>.your.domain
13 collections.<span class="userinput">uuid_prefix</span>.your.domain
14 </code></pre>
15 </notextile>
16
17 The above hostnames should resolve from anywhere on the internet.
18
19 h2. Install keep-web
20
21 On Debian-based systems:
22
23 <notextile>
24 <pre><code>~$ <span class="userinput">sudo apt-get install keep-web</span>
25 </code></pre>
26 </notextile>
27
28 On Red Hat-based systems:
29
30 <notextile>
31 <pre><code>~$ <span class="userinput">sudo yum install keep-web</span>
32 </code></pre>
33 </notextile>
34
35 Verify that @keep-web@ is functional:
36
37 <notextile>
38 <pre><code>~$ <span class="userinput">keep-web -h</span>
39 Usage of keep-web:
40   -allow-anonymous
41         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)
42   -attachment-only-host string
43         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.
44   -listen string
45         Address to listen on: "host:port", or ":port" to listen on all interfaces. (default ":80")
46   -trust-all-content
47         Serve non-public content from a single origin. Dangerous: read docs before using!
48 </code></pre>
49 </notextile>
50
51 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:
52
53 <notextile>
54 <pre><code>/var/www/arvados-api/current/script$ <span class="userinput">RAILS_ENV=production bundle exec ./get_anonymous_user_token.rb</span>
55 hoShoomoo2bai3Ju1xahg6aeng1siquuaZ1yae2gi2Uhaeng2r
56 </code></pre></notextile>
57
58 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:
59
60 <notextile>
61 <pre><code>export ARVADOS_API_HOST=<span class="userinput">uuid_prefix</span>.your.domain
62 export ARVADOS_API_TOKEN="<span class="userinput">hoShoomoo2bai3Ju1xahg6aeng1siquuaZ1yae2gi2Uhaeng2r</span>"
63 exec sudo -u nobody keep-web \
64  -listen=<span class="userinput">:9002</span> \
65  -attachment-only-host=<span class="userinput">download.uuid_prefix.your.domain</span> \
66  -allow-anonymous \
67  2&gt;&amp;1
68 </code></pre>
69 </notextile>
70
71 Omit the @-allow-anonymous@ argument if you do not want to serve public data.
72
73 Set @ARVADOS_API_HOST_INSECURE=1@ if your API server's SSL certificate is not signed by a recognized CA.
74
75 h3. Set up a reverse proxy with SSL support
76
77 The keep-web service will be accessible from anywhere on the internet, so we recommend using SSL for transport encryption.
78
79 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).
80
81 Note: A wildcard SSL certificate is required in order to support a full-featured secure keep-web service. Without it, keep-web can offer file downloads for all Keep data; however, in order to avoid cross-site scripting vulnerabilities, keep-web refuses to serve private data as web content except when it is accessed using a "secret link" share. With a wildcard SSL certificate and DNS configured appropriately, all data can be served as web content.
82
83 For example, using Nginx:
84
85 <notextile><pre>
86 upstream keep-web {
87   server                127.0.0.1:<span class="userinput">9002</span>;
88 }
89
90 server {
91   listen                <span class="userinput">[your public IP address]</span>:443 ssl;
92   server_name           download.<span class="userinput">uuid_prefix</span>.your.domain
93                         collections.<span class="userinput">uuid_prefix</span>.your.domain
94                         *.collections.<span class="userinput">uuid_prefix</span>.your.domain
95                         ~.*--collections.<span class="userinput">uuid_prefix</span>.your.domain;
96
97   proxy_connect_timeout 90s;
98   proxy_read_timeout    300s;
99
100   ssl                   on;
101   ssl_certificate       <span class="userinput"/>YOUR/PATH/TO/cert.pem</span>;
102   ssl_certificate_key   <span class="userinput"/>YOUR/PATH/TO/cert.key</span>;
103
104   location / {
105     proxy_pass          http://keep-web;
106     proxy_set_header    Host            $host;
107     proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
108   }
109 }
110 </pre></notextile>
111
112 h3. Configure DNS
113
114 Configure your DNS servers so the following names resolve to your Nginx proxy's public IP address.
115 * @download.uuid_prefix.your.domain@
116 * @collections.uuid_prefix.your.domain@
117 * @*--collections.uuid_prefix.your.domain@, if you have a wildcard SSL certificate valid for @*.uuid_prefix.your.domain@ and your DNS server allows this without interfering with other DNS names.
118 * @*.collections.uuid_prefix.your.domain@, if you have a wildcard SSL certificate valid for these names.
119
120 If neither of the above wildcard options is feasible, only unauthenticated requests (public data and collection sharing links) will be served as web content at @collections.uuid_prefix.your.domain@. The @download@ name will be used to serve authenticated content, but only as file downloads.
121
122 h3. Tell Workbench about the keep-web service
123
124 Workbench has features like "download file from collection" and "show image" which work better if the content is served by keep-web rather than Workbench itself. We recommend using the two different hostnames ("download" and "collections" above) for file downloads and inline content respectively.
125
126 Add the following entry to your Workbench configuration file (@/etc/arvados/workbench/application.yml@). This URL will be used for file downloads.
127
128 <notextile>
129 <pre><code>keep_web_download_url: https://download.<span class="userinput">uuid_prefix</span>.your.domain/c=%{uuid_or_pdh}
130 </code></pre>
131 </notextile>
132
133 Additionally, add *one* of the following entries to your Workbench configuration file, depending on your DNS setup. This URL will be used to serve user content that can be displayed in the browser, like image previews and static HTML pages.
134
135 <notextile>
136 <pre><code>keep_web_url: https://%{uuid_or_pdh}--collections.<span class="userinput">uuid_prefix</span>.your.domain
137 keep_web_url: https://%{uuid_or_pdh}.collections.<span class="userinput">uuid_prefix</span>.your.domain
138 keep_web_url: https://collections.<span class="userinput">uuid_prefix</span>.your.domain/c=%{uuid_or_pdh}
139 </code></pre>
140 </notextile>