6591: Add ssl_certificate lines to sample install nginx configs.
[arvados.git] / doc / install / install-api-server.html.textile.liquid
index 7bfad836920373922c23b5d2a072df43d33bfc46..3c188e3828f3145ca59717c425526378149586d9 100644 (file)
@@ -16,21 +16,19 @@ h3(#install_postgres). Install PostgreSQL
 
 {% include 'install_postgres' %}
 
-h3(#build_tools_apiserver). Build tools
-
-On older distributions, you may need to use a backports repository to satisfy these requirements.  For example, on older Red Hat-based systems, consider using the "postgresql92":https://www.softwarecollections.org/en/scls/rhscl/postgresql92/ and "nginx16":https://www.softwarecollections.org/en/scls/rhscl/nginx16/ Software Collections.
+h2(#install_apiserver). Install API server and dependencies
 
 On a Debian-based system, install the following packages:
 
 <notextile>
-<pre><code>~$ <span class="userinput">sudo apt-get install bison build-essential libcurl4-openssl-dev git nginx arvados-api-server</span>
+<pre><code>~$ <span class="userinput">sudo apt-get install bison build-essential libcurl4-openssl-dev git arvados-api-server</span>
 </code></pre>
 </notextile>
 
 On a Red Hat-based system, install the following packages:
 
 <notextile>
-<pre><code>~$ <span class="userinput">sudo yum install bison make automake gcc gcc-c++ libcurl-devel nginx git arvados-api-server</span>
+<pre><code>~$ <span class="userinput">sudo yum install bison make automake gcc gcc-c++ libcurl-devel git arvados-api-server</span>
 </code></pre>
 </notextile>
 
@@ -84,18 +82,15 @@ Edit @/etc/arvados/api/database.yml@ and replace the @xxxxxxxx@ database passwor
 
 h2(#configure_application). Configure the API server
 
-Edit @/etc/arvados/api/application.yml@ and to configure the settings described in the following sections.  The deployment script will consistently deploy this to the API server's configuration directory.  The API server reads both @application.yml@ and its own @config/application.default.yml@ file.  The settings in @application.yml@ take precedence over the defaults that are defined in @config/application.default.yml@.  The @config/application.yml.example@ file is not read by the API server and is provided as a starting template only.
+Edit @/etc/arvados/api/application.yml@ to configure the settings described in the following sections.  The deployment script will consistently deploy this to the API server's configuration directory.  The API server reads both @application.yml@ and its own @config/application.default.yml@ file.  The settings in @application.yml@ take precedence over the defaults that are defined in @config/application.default.yml@.  The @config/application.yml.example@ file is not read by the API server and is provided as a starting template only.
 
-Only put local configuration in @application.yml@, do not edit @application.default.yml@.
+@config/application.default.yml@ documents additional configuration settings not listed here.  You can "view the current source version":https://arvados.org/projects/arvados/repository/revisions/master/entry/services/api/config/application.default.yml for reference.
 
-h3(#uuid_prefix). uuid_prefix
+Only put local configuration in @application.yml@.  Do not edit @application.default.yml@.
 
-The @uuid_prefix@ is used for all database identifiers to identify the record as originating from this site.  It is a string consisting of exactly 5 lowercase ASCII letters and digits.  Generate a random value and set it in @application.yml@:
+h3(#uuid_prefix). uuid_prefix
 
-<notextile>
-<pre><code>~$ <span class="userinput">ruby -e 'puts rand(2**40).to_s(36)[0,5]'</span>
-zzzzz
-</code></pre></notextile>
+Define your @uuid_prefix@ in @application.yml@ by setting the @uuid_prefix@ field in the section for your environment.  This prefix is used for all database identifiers to identify the record as originating from this site.  It must be exactly 5 lowercase ASCII letters and digits.
 
 Example @application.yml@:
 
@@ -105,7 +100,7 @@ Example @application.yml@:
 
 h3. secret_token
 
-The @secret_token@ is used for for signing cookies.  IMPORTANT: This is a site secret. It should be at least 50 characters.  Generate a random value and set it to @application.yml@:
+The @secret_token@ is used for for signing cookies.  IMPORTANT: This is a site secret. It should be at least 50 characters.  Generate a random value and set it in @application.yml@:
 
 <notextile>
 <pre><code>~$ <span class="userinput">ruby -e 'puts rand(2**400).to_s(36)'</span>
@@ -120,7 +115,7 @@ Example @application.yml@:
 
 h3(#blob_signing_key). blob_signing_key
 
-The @blob_signing_key@ is used to enforce access control to Keep blocks.  This same key must be provided to the Keepstore daemons when "installing Keepstore servers.":install-keepstore.html  IMPORTANT: This is a site secret. It should be at least 50 characters.  Generate a random value and set it to @application.yml@:
+The @blob_signing_key@ is used to enforce access control to Keep blocks.  This same key must be provided to the Keepstore daemons when "installing Keepstore servers.":install-keepstore.html  IMPORTANT: This is a site secret. It should be at least 50 characters.  Generate a random value and set it in @application.yml@:
 
 <notextile>
 <pre><code>~$ <span class="userinput">ruby -e 'puts rand(2**400).to_s(36)'</span>
@@ -162,31 +157,42 @@ Example @application.yml@:
 
 h3. websockets_address
 
-Set @websockets_address@ to the @@wss://@ URL of the API server websocket endpoint after following "Set up Web servers.":#set_up
+Set @websockets_address@ to the @wss://@ URL of the API server websocket endpoint after following "Set up Web servers.":#set_up
 
 Example @application.yml@:
 
 <notextile>
-<pre><code>  websockets_address: <span class="userinput">https://ws.zzzzz.example.com</span></code></pre>
+<pre><code>  websockets_address: <span class="userinput">wss://ws.zzzzz.example.com</span></code></pre>
 </notextile>
 
-h3(#git_repositories_dir). git_repositories_dir, git_internal_dir
+h3(#git_repositories_dir). git_repositories_dir
 
-The @git_repositories_dir@ setting specifies the directory is where user git repositories will be stored.  By default this is @/var/lib/arvados/git@. You can change the location by defining it in @application.yml@.
-
-The @git_internal_dir@ setting specifies the directory is where the system internal git repository will be stored.  By default this is @/var/lib/arvados/internal.git@.  This repository stores git branches that have been used to run crunch jobs.
+The @git_repositories_dir@ setting specifies the directory where user git repositories will be stored.  By default this is @/var/lib/arvados/git@.
 
 Example @application.yml@:
 
 <notextile>
 <pre><code>  git_repositories_dir: <span class="userinput">/var/lib/arvados/git</span>
-  git_internal_dir: <span class="userinput">/var/lib/arvados/internal.git</span>
 </code></pre>
 </notextile>
 
-h3. Additional settings
+Make sure a clone of the arvados repository exists in @git_repositories_dir@.
+
+<notextile>
+<pre><code>~$ <span class="userinput">sudo mkdir -p /var/lib/arvados/git</span>
+~$ <span class="userinput">sudo git clone --bare git://git.curoverse.com/arvados.git /var/lib/arvados/git/arvados.git</span>
+</code></pre></notextile>
+
+h3(#git_internal_dir). git_internal_dir
 
-The file @config/application.default.yml@ (online at "https://arvados.org/projects/arvados/repository/revisions/master/entry/services/api/config/application.default.yml":https://arvados.org/projects/arvados/repository/revisions/master/entry/services/api/config/application.default.yml documents a number of additional configuration settings.  Only put local configuration in @application.yml@, do not edit @application.default.yml@.
+The @git_internal_dir@ setting specifies the location of Arvados' internal git repository.  By default this is @/var/lib/arvados/internal.git@.  This repository stores git commits that have been used to run Crunch jobs.  It should _not_ be a subdirectory of @git_repositories_dir@.
+
+Example @application.yml@:
+
+<notextile>
+<pre><code>  git_internal_dir: <span class="userinput">/var/lib/arvados/internal.git</span>
+</code></pre>
+</notextile>
 
 h2. Prepare the API server deployment
 
@@ -206,11 +212,9 @@ For best performance, we recommend you use Nginx as your Web server front-end, w
 
 <notextile>
 <ol>
-<li>Install Nginx via your distribution or a backports repository.</li>
-
-<li><a href="https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html">Install Phusion Passenger for Nginx</a>.</li>
+<li><a href="https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html">Install Nginx and Phusion Passenger</a>.</li>
 
-<li><p>Puma is already included with the API server's gems.  We recommend you use a tool like <a href="http://smarden.org/runit/">runit</a> or something similar.  Here's a sample run script for that:</p>
+<li><p>Puma is already included with the API server's gems.  We recommend you run it as a service under <a href="http://smarden.org/runit/">runit</a> or a similar tool.  Here's a sample runit script for that:</p>
 
 <pre><code>#!/bin/bash
 
@@ -258,17 +262,31 @@ upstream websockets {
 
 proxy_http_version 1.1;
 
+# When Keep clients request a list of Keep services from the API server, the
+# server will automatically return the list of available proxies if
+# the request headers include X-External-Client: 1.  Following the example
+# here, at the end of this section, add a line for each netmask that has
+# direct access to Keep storage daemons to set this header value to 0.
+geo $external_client {
+  default        1;
+  <span class="userinput">10.20.30.0/24</span>  0;
+}
+
 server {
   listen       <span class="userinput">[your public IP address]</span>:443 ssl;
   server_name  <span class="userinput">uuid_prefix.your.domain</span>;
 
   ssl on;
+  ssl_certificate     <span class="userinput">/YOUR/PATH/TO/cert.pem</span>;
+  ssl_certificate_key <span class="userinput">/YOUR/PATH/TO/cert.key</span>;
 
   index  index.html index.htm index.php;
 
   location / {
     proxy_pass            http://api;
     proxy_redirect        off;
+    proxy_connect_timeout 90s;
+    proxy_read_timeout    300s;
 
     proxy_set_header      X-Forwarded-Proto https;
     proxy_set_header      Host $http_host;
@@ -283,12 +301,16 @@ server {
   server_name  ws.<span class="userinput">uuid_prefix.your.domain</span>;
 
   ssl on;
+  ssl_certificate     <span class="userinput">/YOUR/PATH/TO/cert.pem</span>;
+  ssl_certificate_key <span class="userinput">/YOUR/PATH/TO/cert.key</span>;
 
   index  index.html index.htm index.php;
 
   location / {
     proxy_pass            http://websockets;
     proxy_redirect        off;
+    proxy_connect_timeout 90s;
+    proxy_read_timeout    300s;
 
     proxy_set_header      Upgrade $http_upgrade;
     proxy_set_header      Connection "upgrade";