diff --git a/CHANGELOG.md b/CHANGELOG.md index e8a67394bf..e4c8382d06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Add PostgreSQL quota manager and storage backend by @robstradling in https://github.com/google/trillian/pull/3644 * PostgreSQL deployment example by @robstradling in https://github.com/google/trillian/pull/3675 +* PostgreSQL documentation / consistency fixes by @robstradling in https://github.com/google/trillian/pull/3676 ### Misc diff --git a/scripts/resetpgdb.sh b/scripts/resetpgdb.sh index 73c898445c..47281cd669 100755 --- a/scripts/resetpgdb.sh +++ b/scripts/resetpgdb.sh @@ -8,19 +8,17 @@ $(basename $0) [--force] [--verbose] ... All unrecognised arguments will be passed through to the 'psql' command. Accepts environment variables: - POSTGRESQL_ROOT_USER: A user with sufficient rights to create/reset the Trillian - database (default: root). + database (default: postgres). - POSTGRESQL_ROOT_PASSWORD: The password for \$POSTGRESQL_ROOT_USER (default: none). -- POSTGRESQL_HOST: The hostname of the PostgreSQL} server (default: localhost). +- POSTGRESQL_HOST: The hostname of the PostgreSQL server (default: localhost). - POSTGRESQL_PORT: The port the PostgreSQL server is listening on (default: 5432). - POSTGRESQL_DATABASE: The name to give to the new Trillian user and database - (default: test). + (default: defaultdb). - POSTGRESQL_USER: The name to give to the new Trillian user (default: test). - POSTGRESQL_PASSWORD: The password to use for the new Trillian user (default: zaphod). -- POSTGRESQL_USER_HOST: The host that the Trillian user will connect from; use '%' as - a wildcard (default: localhost). - POSTGRESQL_IN_CONTAINER: If set, the script will assume it is running in a Docker - container and will exec into the container to operate. + container and will exec into the container to operate (default: false). - POSTGRESQL_CONTAINER_NAME: The name of the Docker container to exec into (default: pgsql). EOF @@ -39,7 +37,6 @@ collect_vars() { [ -z ${POSTGRESQL_DATABASE+x} ] && POSTGRESQL_DATABASE="defaultdb" [ -z ${POSTGRESQL_USER+x} ] && POSTGRESQL_USER="test" [ -z ${POSTGRESQL_PASSWORD+x} ] && POSTGRESQL_PASSWORD="zaphod" - [ -z ${POSTGRESQL_USER_HOST+x} ] && POSTGRESQL_USER_HOST="localhost" [ -z ${POSTGRESQL_INSECURE+x} ] && POSTGRESQL_INSECURE="true" [ -z ${POSTGRESQL_IN_CONTAINER+x} ] && POSTGRESQL_IN_CONTAINER="false" [ -z ${POSTGRESQL_CONTAINER_NAME+x} ] && POSTGRESQL_CONTAINER_NAME="pgsql" @@ -103,7 +100,7 @@ main() { $CMD "${FLAGS[@]}" -c "CREATE USER ${POSTGRESQL_USER} WITH PASSWORD '${POSTGRESQL_PASSWORD}';" || \ die "Error: Failed to create user '${POSTGRESQL_USER}'." fi - $CMD "${FLAGS[@]}" -c "GRANT ALL PRIVILEGES ON DATABASE ${POSTGRESQL_DATABASE} TO ${POSTGRESQL_USER} WITH GRANT OPTION" || \ + $CMD "${FLAGS[@]}" -c "GRANT ALL PRIVILEGES ON DATABASE ${POSTGRESQL_DATABASE} TO ${POSTGRESQL_USER} WITH GRANT OPTION;" || \ die "Error: Failed to grant '${POSTGRESQL_USER}' user all privileges on '${POSTGRESQL_DATABASE}'." $CMD "${FLAGS[@]}" -d ${POSTGRESQL_DATABASE} < ${TRILLIAN_PATH}/storage/postgresql/schema/storage.sql || \ die "Error: Failed to create tables in '${POSTGRESQL_DATABASE}' database." diff --git a/storage/postgresql/provider.go b/storage/postgresql/provider.go index 9d593c9704..dcb81971ee 100644 --- a/storage/postgresql/provider.go +++ b/storage/postgresql/provider.go @@ -25,7 +25,7 @@ import ( ) var ( - postgreSQLURI = flag.String("postgresql_uri", "postgresql:///ctlog?host=localhost&user=ctlog", "Connection URI for PostgreSQL database") + postgreSQLURI = flag.String("postgresql_uri", "postgresql:///defaultdb?host=localhost&user=test", "Connection URI for PostgreSQL database") postgresqlMu sync.Mutex postgresqlErr error