21700: Install Bundler system-wide in Rails postinst
[arvados.git] / doc / install / install-postgresql.html.textile.liquid
index 7259f5bde6e41575cf8f5b54888fe7f2debf418d..56ad95635c9947e06a2ff31615386181899e54bc 100644 (file)
@@ -1,46 +1,65 @@
 ---
 layout: default
 navsection: installguide
-title: Set up PostgreSQL databases
+title: Install PostgreSQL 9.4+
 ...
+{% comment %}
+Copyright (C) The Arvados Authors. All rights reserved.
 
-Two Arvados Rails servers store data in a PostgreSQL database: the SSO server, and the API server.  The API server requires at least version 9.1 of PostgreSQL.  Beyond that, you have the flexibility to deploy PostgreSQL any way that the Rails servers will be able to connect to it.  Our recommended deployment strategy is:
+SPDX-License-Identifier: CC-BY-SA-3.0
+{% endcomment %}
 
-* Install PostgreSQL on the the same host as the SSO server, and dedicate that install to hosting the SSO database.  This provides the best security for the SSO server, because the database does not have to accept any client connections over the network.  Typical load on the SSO server is light enough that deploying both it and its database on the same host does not compromise performance.
-* If you want to provide the most scalability for your Arvados cluster, install PostgreSQL for the API server on a dedicated host.  This gives you the most flexibility to avoid resource contention, and tune performance separately for the API server and its database.  If performance is less of a concern for your installation, you can install PostgreSQL on the API server host directly, as with the SSO server.
+Arvados requires at least version *9.4* of PostgreSQL. We recommend using version 10 or newer.
 
-Find the section for your distribution below, and follow it to install PostgreSQL on each host where you will deploy it.  Then follow the steps in the later section(s) to set up PostgreSQL for the Arvados service(s) that need it.
+* "AWS":#aws
+* "CentOS 7":#centos7
+* "Alma/CentOS/Red Hat/Rocky 8":#rh8
+* "Debian or Ubuntu":#debian
 
-h2(#centos7). Install PostgreSQL on CentOS 7
+h3(#aws). AWS
 
-# Install PostgreSQL:
-  <notextile><pre>~$ <span class="userinput">sudo yum install postgresql-server</span></pre></notextile>
-# Initialize the database:
-  <notextile><pre>~$ <span class="userinput">sudo postgresql-setup initdb</span></pre></notextile>
-# Configure the database to accept password connections:
-  <notextile><pre><code>~$ <span class="userinput">sudo sed -ri -e 's/^(host +all +all +(127\.0\.0\.1\/32|::1\/128) +)ident$/\1md5/' /var/lib/pgsql/data/pg_hba.conf</span></code></pre></notextile>
-# Configure the database to launch at boot:
-  <notextile><pre>~$ <span class="userinput">sudo systemctl enable postgresql</span></pre></notextile>
-# Start the database:
-  <notextile><pre>~$ <span class="userinput">sudo systemctl start postgresql</span></pre></notextile>
-# "Set up Arvados credentials and databases":#rails_setup for the services that will use this PostgreSQL install.
+When deploying on AWS, Arvados can use an Aurora RDS PostgreSQL database. Aurora Serverless is not recommended.
 
-h2(#debian). Install PostgreSQL on Debian or Ubuntu
+h3(#centos7). CentOS 7
+{% assign rh_version = "7" %}
+{% include 'note_python_sc' %}
 
-# Install PostgreSQL:
-  <notextile><pre>~$ <span class="userinput">sudo apt-get install postgresql</span></pre></notextile>
-# "Set up Arvados credentials and databases":#rails_setup for the services that will use this PostgreSQL install.
+# Install PostgreSQL
+  <notextile><pre># <span class="userinput">yum install rh-postgresql12 rh-postgresql12-postgresql-contrib</span>
+~$ <span class="userinput">scl enable rh-postgresql12 bash</span></pre></notextile>
+# Initialize the database
+  <notextile><pre># <span class="userinput">postgresql-setup initdb</span></pre></notextile>
+# Configure the database to accept password connections from localhost
+  <notextile><pre><code># <span class="userinput">sed -ri -e 's/^(host +all +all +(127\.0\.0\.1\/32|::1\/128) +)ident$/\1md5/' /var/lib/pgsql/data/pg_hba.conf</span></code></pre></notextile>
+# Configure the database to accept password connections from the local network (replace @10.9.8.0/24@ with your private network mask)
+  <notextile><pre><code># <span class="userinput">echo 'host all all 10.9.8.0/24 md5' | tee -a /var/lib/pgsql/data/pg_hba.conf</span></code></pre></notextile>
+# Configure the database to launch at boot and start now
+  <notextile><pre># <span class="userinput">systemctl enable --now rh-postgresql12-postgresql</span></pre></notextile>
 
-<a name="rails_setup"></a>
+h3(#rh8). Alma/CentOS/Red Hat/Rocky 8
 
-h2(#sso). Set up SSO server credentials and database
+{% comment %}
+The default version on RH8 is PostgreSQL 10. You can install up to PostgreSQL 13.
+{% endcomment %}
 
-{% assign service_role = "arvados_sso" %}
-{% assign service_database = "arvados_sso_production" %}
-{% include 'install_postgres_database' %}
+# Install PostgreSQL
+  <notextile><pre># <span class="userinput">dnf install postgresql-server postgresql-contrib</span></pre></notextile>
+# Initialize the database
+  <notextile><pre># <span class="userinput">postgresql-setup initdb</span></pre></notextile>
+# Configure the database to accept password connections from localhost
+  <notextile><pre><code># <span class="userinput">sed -ri -e 's/^(host +all +all +(127\.0\.0\.1\/32|::1\/128) +)ident$/\1md5/' /var/lib/pgsql/data/pg_hba.conf</span></code></pre></notextile>
+# Configure the database to accept password connections from the local network (replace @10.9.8.0/24@ with your private network mask)
+  <notextile><pre><code># <span class="userinput">echo 'host all all 10.9.8.0/24 md5' | tee -a /var/lib/pgsql/data/pg_hba.conf</span></code></pre></notextile>
+# Configure the database to launch at boot and start now
+  <notextile><pre># <span class="userinput">systemctl enable --now postgresql</span></pre></notextile>
 
-h2(#api). Set up API server credentials and database
+h3(#debian). Debian or Ubuntu
 
-{% assign service_role = "arvados" %}
-{% assign service_database = "arvados_production" %}
-{% include 'install_postgres_database' %}
+Debian 10 (Buster) and Ubuntu 16.04 (Xenial) and later versions include a sufficiently recent version of Postgres.
+
+# Install PostgreSQL
+<notextile><pre># <span class="userinput">apt-get --no-install-recommends install postgresql postgresql-contrib</span></pre></notextile>
+# Configure PostgreSQL to accept password connections from the local network (replace @10.9.8.0/24@ with your private network mask)
+<notextile><pre># <span class="userinput">echo 'host all all 10.9.8.0/24 md5' | tee -a /etc/postgresql/*/main/pg_hba.conf</span></pre></notextile>
+# Configure the database to launch at boot and start now
+<notextile><pre># <span class="userinput">systemctl enable --now postgresql</span></pre></notextile>