19070: Still trying to fix test_with_arvbox
[arvados.git] / doc / _includes / _install_postgres_database.liquid
index b96c5a3cc492ff486d7ffd740499ec8f2f3034b6..e93457f188e2f5ac359dded0f7f5d0531f00a85c 100644 (file)
@@ -1,17 +1,32 @@
-# Start a shell for the postgres user.  On CentOS 6:
-  <notextile><pre>~$ <span class="userinput">sudo -u postgres scl enable rh-postgresql94 bash</span>
-</pre></notextile> On any other distribution:
-  <notextile><pre>~$ <span class="userinput">sudo -u postgres bash</span></pre></notextile>
-# Generate a new database password:
-  <notextile><pre>$ <span class="userinput">ruby -e 'puts rand(2**128).to_s(36)'</span>
+{% comment %}
+Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: CC-BY-SA-3.0
+{% endcomment %}
+
+<ol class=>
+<li>Start a shell for the postgres user:
+<notextile><pre># <span class="userinput">su postgres</span></pre></notextile>
+</li>
+<li>Generate a new database password:
+<notextile><pre>postgres$ <span class="userinput"><span class="userinput">tr -dc 0-9a-zA-Z &lt;/dev/urandom | head -c25; echo</span>
 yourgeneratedpassword
 </pre></notextile> Record this.  You'll need it when you set up the Rails server later.
-# Create a database user with the password you generated:
-  <notextile><pre><code>$ <span class="userinput">createuser --encrypted -R -S --pwprompt {{service_role}}</span>
-Enter password for new role: <span class="userinput">yourgeneratedpassword</span>
-Enter it again: <span class="userinput">yourgeneratedpassword</span>
-</code></pre></notextile>
-# Create a database owned by the new user:
-  <notextile><pre><code>$ <span class="userinput">createdb {{service_database}} -T template0 -E UTF8 -O {{service_role}}</span></code></pre></notextile>
-# Exit the postgres user shell:
-  <notextile><pre>$ <span class="userinput">exit</span></pre></notextile>
+</li>
+<li>Create a database user with the password you generated:
+  <notextile><pre><code>postgres$ <span class="userinput">createuser --encrypted --no-createrole --no-superuser --pwprompt {{service_role}}</span>
+  Enter password for new role: <span class="userinput">yourgeneratedpassword</span>
+  Enter it again: <span class="userinput">yourgeneratedpassword</span></code></pre></notextile>
+</li>
+<li>Create a database owned by the new user:
+  <notextile><pre><code>postgres$ <span class="userinput">createdb {{service_database}} -T template0 -E UTF8 -O {{service_role}}</span></code></pre></notextile>
+</li>
+{% if use_contrib %}
+<li>Enable the pg_trgm extension
+  <notextile><pre>postgres$ <span class="userinput">psql {{service_database}} -c "CREATE EXTENSION IF NOT EXISTS pg_trgm"</span></pre></notextile>
+</li>
+{% endif %}
+<li>Exit the postgres user shell:
+  <notextile><pre>postgres$ <span class="userinput">exit</span></pre></notextile>
+</li>
+</ol>