Skip to content
This repository has been archived by the owner on May 20, 2022. It is now read-only.

FATAL: role "postgres" does not exist #313

Closed
ghost opened this issue Sep 23, 2018 · 3 comments
Closed

FATAL: role "postgres" does not exist #313

ghost opened this issue Sep 23, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Sep 23, 2018

After running docker-compose with a fresh build I get the following log output:

app_1  | Using existing config file /mattermost/config/config.json
db_1   | AWS_ACCESS_KEY_ID is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | AWS_SECRET_ACCESS_KEY is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | WALE_S3_PREFIX is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | AWS_REGION is required for Wal-E but not set. Skipping Wal-E setup.
web_1  | linking plain config
app_1  | Configure database connection...OK
app_1  | Wait until database db:5432 is ready...
db_1   | The files belonging to this database system will be owned by user "postgres".
db_1   | This user must also own the server process.
db_1   |
db_1   | The database cluster will be initialized with locale "en_US.utf8".
db_1   | The default database encoding has accordingly been set to "UTF8".
db_1   | The default text search configuration will be set to "english".
db_1   |
db_1   | Data page checksums are disabled.
db_1   |
db_1   | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db_1   | creating subdirectories ... ok
db_1   | selecting default max_connections ... 100
db_1   | selecting default shared_buffers ... 128MB
db_1   | selecting dynamic shared memory implementation ... posix
db_1   | creating configuration files ... ok
db_1   | creating template1 database in /var/lib/postgresql/data/base/1 ... ok
db_1   | initializing pg_authid ... ok
db_1   | setting password ... ok
db_1   | initializing dependencies ... ok
db_1   | creating system views ... ok
db_1   | loading system objects' descriptions ... ok
db_1   | creating collations ... sh: locale: not found
db_1   | ok
db_1   | No usable system locales were found.
db_1   | Use the option "--debug" to see details.
db_1   | creating conversions ... ok
db_1   | creating dictionaries ... ok
db_1   | setting privileges on built-in objects ... ok
db_1   | creating information schema ... ok
db_1   | loading PL/pgSQL server-side language ... ok
db_1   | vacuuming database template1 ... ok
db_1   | copying template1 to template0 ... ok
db_1   | copying template1 to postgres ... ok
db_1   | syncing data to disk ... ok
db_1   |
db_1   | Success. You can now start the database server using:
db_1   |
db_1   |     postgres -D /var/lib/postgresql/data
db_1   | or
db_1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1   |
db_1   |
db_1   | WARNING: enabling "trust" authentication for local connections
db_1   | You can change this by editing pg_hba.conf or using the option -A, or
db_1   | --auth-local and --auth-host, the next time you run initdb.
db_1   | waiting for server to start....LOG:  database system was shut down at 2018-09-23 12:08:18 UTC
db_1   | LOG:  MultiXact member wraparound protections are now enabled
db_1   | LOG:  database system is ready to accept connections
db_1   | LOG:  autovacuum launcher started
db_1   |  done
db_1   | server started
db_1   | CREATE DATABASE
db_1   |
db_1   |
db_1   | /docker-entrypoint.sh: running /docker-entrypoint-initdb.d/setup-wale.sh
db_1   |
db_1   | waiting for server to shut down...LOG:  received fast shutdown request
db_1   | LOG:  aborting any active transactions
db_1   | LOG:  autovacuum launcher shutting down
db_1   | LOG:  shutting down
db_1   | .LOG:  database system is shut down
db_1   |  done
db_1   | server stopped
db_1   |
db_1   | PostgreSQL init process complete; ready for start up.
db_1   |
db_1   | LOG:  database system was shut down at 2018-09-23 12:08:22 UTC
db_1   | LOG:  MultiXact member wraparound protections are now enabled
db_1   | LOG:  database system is ready to accept connections
db_1   | LOG:  autovacuum launcher started
db_1   | LOG:  incomplete startup packet
app_1  | Starting mattermost
db_1   | ERROR:  relation "idx_teams_name" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_teams_description" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_teams_invite_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_teams_update_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_teams_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_teams_delete_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_teammembers_team_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_teammembers_user_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_teammembers_delete_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_channels_team_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_channels_name" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_channels_update_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_channels_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_channels_delete_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_channels_name_lower" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_channels_displayname_lower" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_channelmembers_channel_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_channelmembers_user_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_channel_search_txt" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_update_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_delete_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_channel_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_root_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_user_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_is_pinned" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_channel_id_update_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_channel_id_delete_at_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_message_txt" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_posts_hashtags_txt" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_email" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_update_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_delete_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_email_lower" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_username_lower" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_nickname_lower" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_firstname_lower" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_lastname_lower" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_all_txt" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_all_no_full_name_txt" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_names_txt" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_users_names_no_full_name_txt" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_audits_user_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_sessions_user_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_sessions_token" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_sessions_expires_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_sessions_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_sessions_last_activity_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_oauthapps_creator_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_oauthaccessdata_client_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_oauthaccessdata_user_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_oauthaccessdata_refresh_token" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_oauthauthdata_client_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_incoming_webhook_user_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_incoming_webhook_team_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_outgoing_webhook_team_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_incoming_webhook_update_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_incoming_webhook_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_incoming_webhook_delete_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_outgoing_webhook_update_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_outgoing_webhook_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_outgoing_webhook_delete_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_command_team_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_command_update_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_command_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_command_delete_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_command_webhook_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_preferences_user_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_preferences_category" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_preferences_name" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_emoji_update_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_emoji_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_emoji_delete_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_emoji_name" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_status_user_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_status_status" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_fileinfo_update_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_fileinfo_create_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_fileinfo_delete_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_fileinfo_postid_at" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_jobs_type" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_user_access_tokens_token" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | ERROR:  relation "idx_user_access_tokens_user_id" does not exist
db_1   | STATEMENT:  SELECT $1::regclass
db_1   | FATAL:  role "postgres" does not exist
web_1  | 127.0.0.1 - - [23/Sep/2018:12:08:36 +0000] "GET / HTTP/1.1" 200 2620 "-" "curl/7.61.1" "-"
db_1   | FATAL:  role "postgres" does not exist
web_1  | 127.0.0.1 - - [23/Sep/2018:12:09:06 +0000] "GET / HTTP/1.1" 200 2620 "-" "curl/7.61.1" "-"

It seems that the database container isn't initialising correctly/the user permissions are being set incorrectly. Any tips for debugging this?

The only change I've made is commenting out the - /etc/localtime:/etc/localtime:ro lines in the docker-compose.yml since I'm running on mac.

@pichouk
Copy link
Contributor

pichouk commented Sep 26, 2018

Hmm that's weird, I don't know what it is. Does it crash your container ?

@ghost
Copy link
Author

ghost commented Oct 3, 2018

@pichouk It turned out to be due to the PG containter healthcheck using postgres as the user instead of mmuser. Fixed it with:

HEALTHCHECK CMD pg_isready -U mmuser -d mattermost || exit 1

pichouk added a commit that referenced this issue Oct 4, 2018
Because the PostgreSQL user is not always "postgres", do not specify a
user to the Healthcheck command. It will also works correctly.

Closes #313
@pichouk
Copy link
Contributor

pichouk commented Oct 4, 2018

Oh good thanks for your report ! I just submitted PR #318 to fix it :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant