15924: Update github links to arvados org.
[arvados.git] / doc / install / install-keep-web.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install Keep-web server
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 The Keep-web server provides read/write HTTP (WebDAV) 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 TLS support. See the "godoc page":http://godoc.org/github.com/arvados/arvados/services/keep-web for more detail.
13
14 By convention, we use the following hostnames for the Keep-web service:
15
16 <notextile>
17 <pre><code>download.<span class="userinput">uuid_prefix</span>.your.domain
18 collections.<span class="userinput">uuid_prefix</span>.your.domain
19 *.collections.<span class="userinput">uuid_prefix</span>.your.domain
20 </code></pre>
21 </notextile>
22
23 The above hostnames should resolve from anywhere on the internet.
24
25 h2. Install Keep-web
26
27 Typically Keep-web runs on the same host as Keepproxy.
28
29 On Debian-based systems:
30
31 <notextile>
32 <pre><code>~$ <span class="userinput">sudo apt-get install keep-web</span>
33 </code></pre>
34 </notextile>
35
36 On Red Hat-based systems:
37
38 <notextile>
39 <pre><code>~$ <span class="userinput">sudo yum install keep-web</span>
40 </code></pre>
41 </notextile>
42
43 Verify that @Keep-web@ is functional:
44
45 <notextile>
46 <pre><code>~$ <span class="userinput">keep-web -h</span>
47 Usage of keep-web:
48   -config file
49         Site configuration file (default may be overridden by setting an ARVADOS_CONFIG environment variable) (default "/etc/arvados/config.yml")
50   -dump-config
51         write current configuration to stdout and exit
52 [...]
53   -version
54         print version information and exit.
55 </code></pre>
56 </notextile>
57
58 h3. Set up a reverse proxy with TLS support
59
60 The Keep-web service will be accessible from anywhere on the internet, so we recommend using TLS for transport encryption.
61
62 This is best achieved by putting a reverse proxy with TLS 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).
63
64 Note: A wildcard TLS 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 TLS certificate and DNS configured appropriately, all data can be served as web content.
65
66 For example, using Nginx:
67
68 <notextile><pre>
69 upstream keep-web {
70   server                127.0.0.1:<span class="userinput">9002</span>;
71 }
72
73 server {
74   listen                <span class="userinput">[your public IP address]</span>:443 ssl;
75   server_name           download.<span class="userinput">uuid_prefix</span>.your.domain
76                         collections.<span class="userinput">uuid_prefix</span>.your.domain
77                         *.collections.<span class="userinput">uuid_prefix</span>.your.domain
78                         ~.*--collections.<span class="userinput">uuid_prefix</span>.your.domain;
79
80   proxy_connect_timeout 90s;
81   proxy_read_timeout    300s;
82
83   ssl                   on;
84   ssl_certificate       <span class="userinput"/>YOUR/PATH/TO/cert.pem</span>;
85   ssl_certificate_key   <span class="userinput"/>YOUR/PATH/TO/cert.key</span>;
86
87   location / {
88     proxy_pass          http://keep-web;
89     proxy_set_header    Host            $host;
90     proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
91
92     client_max_body_size    0;
93     proxy_http_version      1.1;
94     proxy_request_buffering off;
95   }
96 }
97 </pre></notextile>
98
99 {% include 'notebox_begin' %}
100 If you restrict access to your Arvados services based on network topology -- for example, your proxy server is not reachable from the public internet -- additional proxy configuration might be needed to thwart cross-site scripting attacks that would circumvent your restrictions. Read the "'Intranet mode' section of the Keep-web documentation":https://godoc.org/github.com/arvados/arvados/services/keep-web#hdr-Intranet_mode now.
101 {% include 'notebox_end' %}
102
103 h3(#dns). Configure DNS
104
105 Configure your DNS servers so the following names resolve to your Nginx proxy's public IP address.
106 * @download.uuid_prefix.your.domain@
107 * @collections.uuid_prefix.your.domain@
108 * @*--collections.uuid_prefix.your.domain@, if you have a wildcard TLS certificate valid for @*.uuid_prefix.your.domain@ and your DNS server allows this without interfering with other DNS names.
109 * @*.collections.uuid_prefix.your.domain@, if you have a wildcard TLS certificate valid for these names.
110
111 If neither of the above wildcard options is feasible, you have two choices:
112 # Serve web content at @collections.uuid_prefix.your.domain@, but only for unauthenticated requests (public data and collection sharing links). Authenticated requests will always result in file downloads, using the @download@ name. For example, the Workbench "preview" button and the "view entire log file" link will invoke file downloads instead of displaying content in the browser window.
113 # In the special case where you know you are immune to XSS exploits, you can enable the "trust all content" mode in Keep-web and Workbench (setting @Collections.TrustAllContent: true@ on the config file). With this enabled, inline web content can be served from a single @collections@ host name; no wildcard DNS or certificate is needed. Do not do this without understanding the security implications described in the "Keep-web documentation":http://godoc.org/github.com/arvados/arvados/services/keep-web.
114
115 h2. Configure Keep-web
116
117 {% assign railscmd = "bundle exec ./script/get_anonymous_user_token.rb --get" %}
118 {% assign railsout = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" %}
119 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. {% include 'install_rails_command' %}
120
121 Set the cluster config file like the following:
122
123 <notextile>
124 <pre><code>Clusters:
125   <span class="userinput">uuid_prefix</span>:
126     Services:
127       Controller:
128         ExternalURL: "https://<span class="userinput">uuid_prefix</span>.your.domain"
129       WebDAV:
130         InternalURLs:
131           "http://keep_web_hostname_goes_here:9002/": {}
132         ExternalURL: "https://collections.<span class="userinput">uuid_prefix</span>.your.domain"
133       WebDAVDownload:
134         InternalURLs:
135           "http://keep_web_hostname_goes_here:9002/": {}
136         ExternalURL: "https://download.<span class="userinput">uuid_prefix</span>.your.domain"
137     Users:
138       AnonymousUserToken: "{{railsout}}"
139     Collections:
140       TrustAllContent: false
141     TLS:
142       Insecure: false
143 </code></pre>
144 </notextile>
145
146 Set @Users.AnonymousUserToken: ""@ (empty string) if you do not want to serve public data.
147
148 Set @TLS.Insecure: true@ if your API server's TLS certificate is not signed by a recognized CA.
149
150 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.
151
152 The following entry on your cluster configuration file (@/etc/arvados/config.yml@) details the URL that will be used for file downloads.
153
154 <notextile>
155 <pre><code>Clusters:
156   <span class="userinput">uuid_prefix</span>:
157     Services:
158       WebDAVDownload:
159         ExternalURL: "https://download.<span class="userinput">uuid_prefix</span>.your.domain"
160 </code></pre>
161 </notextile>
162
163 Additionally, one of the following entries on your cluster configuration file (depending on your DNS setup) tells Workbench which URL will be used to serve user content that can be displayed in the browser, like image previews and static HTML pages.
164
165 <notextile>
166 <pre><code>Clusters:
167   <span class="userinput">uuid_prefix</span>:
168     Services:
169       WebDAV:
170         ExternalURL: "https://*--collections.<span class="userinput">uuid_prefix</span>.your.domain"
171         ExternalURL: "https://*.collections.<span class="userinput">uuid_prefix</span>.your.domain"
172         ExternalURL: "https://collections.<span class="userinput">uuid_prefix</span>.your.domain"
173 </code></pre>
174 </notextile>
175
176 h2. Run Keep-web
177
178 h3. Start the service (option 1: systemd)
179
180 If your system does not use systemd, skip this section and follow the "runit instructions":#runit instead.
181
182 If your system uses systemd, the keep-web service should already be set up. Start it and check its status:
183
184 <notextile>
185 <pre><code>~$ <span class="userinput">sudo systemctl restart keep-web</span>
186 ~$ <span class="userinput">sudo systemctl status keep-web</span>
187 &#x25cf; keep-web.service - Arvados Keep web gateway
188    Loaded: loaded (/lib/systemd/system/keep-web.service; enabled)
189    Active: active (running) since Sat 2019-08-10 10:33:21 UTC; 3 days ago
190      Docs: https://doc.arvados.org/
191  Main PID: 4242 (keep-web)
192    CGroup: /system.slice/keep-web.service
193            └─4242 /usr/bin/keep-web
194 [...]
195 </code></pre>
196 </notextile>
197
198 h3(#runit). Start the service (option 2: runit)
199
200 Install runit to supervise the Keep-web daemon.  {% include 'install_runit' %}
201
202 The basic command to start Keep-web in the service run script is:
203
204 <notextile>
205 <pre><code>exec keep-web
206 </code></pre>
207 </notextile>
208