Discourse rebuild fails after upgrade to 2.0.0 beta7 (Perl/PostgreSQL issues)


(Markus) #1

Hi guys,
I have similar issues related to this post from @Slack-Moehrle earlier this day. In my case, it looks like a Perl or PostgreSQL problem. I’ve also executed ./launcher rebuild app and got this console output:

I, [2018-04-25T18:56:30.788538 #13] INFO -- : Upgrading PostgreSQL from version 9.5 to 10

The files belonging to this database system will be owned by user "postgres".

This user must also own the server process.

I, [2018-04-25T18:56:30.788776 #13] INFO -- : > rm /root/upgrade_postgres

I, [2018-04-25T18:56:30.790792 #13] INFO -- :

I, [2018-04-25T18:56:30.791043 #13] INFO -- : Replacing data_directory = '/var/lib/postgresql/10/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.791563 #13] INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.792216 #13] INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.792579 #13] INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.792927 #13] INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.793265 #13] INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.793550 #13] INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup

I, [2018-04-25T18:56:30.796055 #13] INFO -- :

I, [2018-04-25T18:56:30.796576 #13] INFO -- : Replacing (?-mix:#?max_wal_senders *=.*) with max_wal_senders = $db_max_wal_senders in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.797300 #13] INFO -- : Replacing (?-mix:#?wal_level *=.*) with wal_level = $db_wal_level in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.797977 #13] INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.798581 #13] INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.799242 #13] INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/10/main/postgresql.conf

I, [2018-04-25T18:56:30.799853 #13] INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres peer in /etc/postgresql/10/main/pg_hba.conf

I, [2018-04-25T18:56:30.800403 #13] INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/10/main/pg_hba.conf

I, [2018-04-25T18:56:30.800984 #13] INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/10/bin/postmaster -D /etc/postgresql/10/main

I, [2018-04-25T18:56:30.802680 #13] INFO -- : > sleep 5

2018-04-25 18:56:30.816 UTC [57] FATAL: database files are incompatible with server

2018-04-25 18:56:30.816 UTC [57] DETAIL: The data directory was initialized by PostgreSQL version 9.5, which is not compatible with this version 10.3 (Ubuntu 10.3-1.pgdg16.04+1).

I, [2018-04-25T18:56:35.805526 #13] INFO -- :

I, [2018-04-25T18:56:35.805829 #13] INFO -- : > su postgres -c 'createdb discourse' || true

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

LANGUAGE = (unset),

LC_ALL = (unset),

LANG = "en_EN.UTF-8"

are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C").

createdb: could not connect to database template1: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

I, [2018-04-25T18:56:35.868574 #13] INFO -- :

I, [2018-04-25T18:56:35.868880 #13] INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

LANGUAGE = (unset),

LC_ALL = (unset),

LANG = "en_EN.UTF-8"

are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C").

psql: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

I, [2018-04-25T18:56:35.943731 #13] INFO -- :

I, [2018-04-25T18:56:35.943998 #13] INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

LANGUAGE = (unset),

LC_ALL = (unset),

LANG = "en_EN.UTF-8"

are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C").

psql: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

I, [2018-04-25T18:56:36.011776 #13] INFO -- :

I, [2018-04-25T18:56:36.012040 #13] INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

LANGUAGE = (unset),

LC_ALL = (unset),

LANG = "en_EN.UTF-8"

are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C").

psql: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

I, [2018-04-25T18:56:36.083163 #13] INFO -- :

I, [2018-04-25T18:56:36.083581 #13] INFO -- : Terminating async processes

FAILED

--------------------

Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 83 exit 2>

Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'

exec failed with the params "su postgres -c 'psql $db_name -c \"alter schema public owner to $db_user;\"'"

d12ec123f163a504d9093c040df5a9fee19285634a7b4c7dcef18f049344f934

** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

The only workaround I’ve found, is to start the container manually by ./launcher start app and run the web-based upgrade routine with Docker Managermysite.tld/admin/upgrade.

Any clue how to solve this issue?


(Sam Saffron) #2

@tgxworld can you add this to your list?


(Alan Tan) #3

Did you make any changes to the LANG env variable?

en_EN.UTF-8 isn’t a valid locale that can be configured.


(Markus) #4

Thank you very much for this hint.

I found my mistake inside the app.yml - but I‘m not sure, why it has worked before. Now it works pretty nice.


(Matt Palmer) #5

Perhaps older versions of PostgreSQL ignored invalid locales?