5824: Rename -address to -listen
[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   -anonymous-token value
40         API token to try when none of the tokens provided in an HTTP request succeed in reading the desired collection. If this flag is used more than once, each token will be attempted in turn until one works. (default [])
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 exec sudo -u nobody keep-web -listen=<span class="userinput">:9002</span> -anonymous-token=<span class="userinput">hoShoomoo2bai3Ju1xahg6aeng1siquuaZ1yae2gi2Uhaeng2r</span> 2&gt;&amp;1
62 </code></pre>
63 </notextile>
64
65 Omit the @-anonymous-token@ arguments if you do not want to serve public data.
66
67 Set @ARVADOS_API_HOST_INSECURE=1@ if your API server's SSL certificate is not signed by a recognized CA.
68
69 h3. Set up a reverse proxy with SSL support
70
71 The keep-web service will be accessible from anywhere on the internet, so we recommend using SSL for transport encryption.
72
73 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).
74
75 Note: A wildcard SSL certificate is required in order to proxy keep-web effectively.
76
77 For example, using Nginx:
78
79 <notextile><pre>
80 upstream keep-web {
81   server                127.0.0.1:<span class="userinput">9002</span>;
82 }
83
84 server {
85   listen                <span class="userinput">[your public IP address]</span>:443 ssl;
86   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;
87
88   proxy_connect_timeout 90s;
89   proxy_read_timeout    300s;
90
91   ssl                   on;
92   ssl_certificate       <span class="userinput"/>YOUR/PATH/TO/cert.pem</span>;
93   ssl_certificate_key   <span class="userinput"/>YOUR/PATH/TO/cert.key</span>;
94
95   location / {
96     proxy_pass          http://keep-web;
97     proxy_set_header    Host            $host;
98     proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
99   }
100 }
101 </pre></notextile>
102
103 h3. Configure DNS
104
105 Configure your DNS servers so the following names resolve to your Nginx proxy's public IP address.
106 * @*--collections.uuid_prefix.your.domain@, if your DNS server allows this without interfering with other DNS names; or
107 * @*.collections.uuid_prefix.your.domain@, if you have a wildcard SSL certificate valid for these names; or
108 * @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.
109
110 h3. Tell Workbench about the keep-web service
111
112 Add *one* of the following entries to your Workbench configuration file (@/etc/arvados/workbench/application.yml@), depending on your DNS setup:
113
114 <notextile>
115 <pre><code>keep_web_url: https://%{uuid_or_pdh}--collections.<span class="userinput">uuid_prefix</span>.your.domain
116 keep_web_url: https://%{uuid_or_pdh}.collections.<span class="userinput">uuid_prefix</span>.your.domain
117 keep_web_url: https://collections.<span class="userinput">uuid_prefix</span>.your.domain
118 </code></pre>
119 </notextile>