$ ruby -e 'puts rand(2**128).to_s(36)'
+{% comment %}
+Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: CC-BY-SA-3.0
+{% endcomment %}
+
+
+- Start a shell for the postgres user:
+
# su postgres
+
+- Generate a new database password:
+
postgres$ tr -dc 0-9a-zA-Z </dev/urandom | head -c25; echo
yourgeneratedpassword
Record this. You'll need it when you set up the Rails server later.
-# Create a database user with the password you generated:
- $ createuser --encrypted -R -S --pwprompt {{service_role}}
-Enter password for new role: yourgeneratedpassword
-Enter it again: yourgeneratedpassword
-
-# Create a database owned by the new user:
- $ createdb {{service_database}} -T template0 -E UTF8 -O {{service_role}}
-# Exit the postgres user shell:
- $ exit
+
+- Create a database user with the password you generated:
+
postgres$ createuser --encrypted --no-createrole --no-superuser --pwprompt {{service_role}}
+ Enter password for new role: yourgeneratedpassword
+ Enter it again: yourgeneratedpassword
+
+- Create a database owned by the new user:
+
postgres$ createdb {{service_database}} -T template0 -E UTF8 -O {{service_role}}
+
+{% if use_contrib %}
+- Enable the pg_trgm extension
+
postgres$ psql {{service_database}} -c "CREATE EXTENSION IF NOT EXISTS pg_trgm"
+
+{% endif %}
+- Exit the postgres user shell:
+
postgres$ exit
+
+