ubicloud/rhizome/postgres/bin/initialize-empty-database
Burak Yucesoy ca8b85f8ac Use UTF8 encoding instead of SQL_ASCII
Previously, we set the locale to C using pg_createcluster's --locale option,
which unintentionally also set the encoding to SQL_ASCII. We prefer UTF8 as the
default encoding.
2024-07-29 20:31:28 +02:00

15 lines
434 B
Ruby
Executable file

#!/bin/env ruby
# frozen_string_literal: true
require_relative "../../common/lib/util"
r "chown postgres /dat"
# Below commands are required for idempotency
r "rm -rf /dat/16"
r "rm -rf /etc/postgresql/16"
r "pg_createcluster 16 main --start --locale=C.UTF8"
r "sudo -u postgres psql -c 'CREATE ROLE ubi_replication WITH REPLICATION LOGIN'"
r "sudo -u postgres psql -c 'CREATE ROLE ubi_monitoring WITH LOGIN IN ROLE pg_monitor'"