Merge branch '21258-flaky-adc-test'
[arvados.git] / doc / _includes / _install_postgres_database.liquid
1 {% comment %}
2 Copyright (C) The Arvados Authors. All rights reserved.
3
4 SPDX-License-Identifier: CC-BY-SA-3.0
5 {% endcomment %}
6
7 <ol class=>
8 <li>Start a shell for the postgres user:
9 <notextile><pre># <span class="userinput">su postgres</span></pre></notextile>
10 </li>
11 <li>Generate a new database password:
12 <notextile><pre>postgres$ <span class="userinput"><span class="userinput">tr -dc 0-9a-zA-Z &lt;/dev/urandom | head -c25; echo</span>
13 yourgeneratedpassword
14 </pre></notextile> Record this.  You'll need it when you set up the Rails server later.
15 </li>
16 <li>Create a database user with the password you generated:
17   <notextile><pre><code>postgres$ <span class="userinput">createuser --encrypted --no-createrole --no-superuser --pwprompt {{service_role}}</span>
18   Enter password for new role: <span class="userinput">yourgeneratedpassword</span>
19   Enter it again: <span class="userinput">yourgeneratedpassword</span></code></pre></notextile>
20 </li>
21 <li>Create a database owned by the new user:
22   <notextile><pre><code>postgres$ <span class="userinput">createdb {{service_database}} -T template0 -E UTF8 -O {{service_role}}</span></code></pre></notextile>
23 </li>
24 {% if use_contrib %}
25 <li>Enable the pg_trgm extension
26   <notextile><pre>postgres$ <span class="userinput">psql {{service_database}} -c "CREATE EXTENSION IF NOT EXISTS pg_trgm"</span></pre></notextile>
27 </li>
28 {% endif %}
29 <li>Exit the postgres user shell:
30   <notextile><pre>postgres$ <span class="userinput">exit</span></pre></notextile>
31 </li>
32 </ol>