I was doing some routine on my box and also decided upgrade Discourse via ./launcher rebuild. Surprisingly, it failed. Never seen this before. I am on stable branch, so the update was from 1.6.7 to 1.6.9.
./launcher rebuild app
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 10 app
app
cd /pups && git pull && /pups/bin/pups --stdin
Already up-to-date.
I, [2016-12-17T09:18:04.758572 #14] INFO -- : Loading --stdin
I, [2016-12-17T09:18:04.784722 #14] INFO -- : > mkdir -p /shared/postgres_run
I, [2016-12-17T09:18:04.791334 #14] INFO -- :
I, [2016-12-17T09:18:04.792137 #14] INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2016-12-17T09:18:04.798552 #14] INFO -- :
I, [2016-12-17T09:18:04.799377 #14] INFO -- : > chmod 775 /shared/postgres_run
I, [2016-12-17T09:18:04.803513 #14] INFO -- :
I, [2016-12-17T09:18:04.804269 #14] INFO -- : > rm -fr /var/run/postgresql
I, [2016-12-17T09:18:04.808721 #14] INFO -- :
I, [2016-12-17T09:18:04.809443 #14] INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2016-12-17T09:18:04.813831 #14] INFO -- :
I, [2016-12-17T09:18:04.814460 #14] INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2016/12/17 09:18:04 socat[22] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): Connection refused
I, [2016-12-17T09:18:04.822875 #14] INFO -- :
I, [2016-12-17T09:18:04.823462 #14] INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2016-12-17T09:18:04.829064 #14] INFO -- :
I, [2016-12-17T09:18:04.829724 #14] INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2016-12-17T09:18:04.835050 #14] INFO -- :
I, [2016-12-17T09:18:04.835530 #14] INFO -- : > mkdir -p /shared/postgres_run/9.5-main.pg_stat_tmp
I, [2016-12-17T09:18:04.840017 #14] INFO -- :
I, [2016-12-17T09:18:04.840702 #14] INFO -- : > chown postgres:postgres /shared/postgres_run/9.5-main.pg_stat_tmp
I, [2016-12-17T09:18:04.845316 #14] INFO -- :
I, [2016-12-17T09:18:04.854594 #14] INFO -- : File > /etc/service/postgres/run chmod: +x
I, [2016-12-17T09:18:04.863172 #14] INFO -- : File > /etc/runit/3.d/99-postgres chmod: +x
I, [2016-12-17T09:18:04.871895 #14] INFO -- : File > /root/upgrade_postgres chmod: +x
I, [2016-12-17T09:18:04.872971 #14] INFO -- : > chown -R root /var/lib/postgresql/9.5/main
I, [2016-12-17T09:18:05.067071 #14] INFO -- :
I, [2016-12-17T09:18:05.067390 #14] INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/9.5/bin/initdb -D /shared/postgres_data || exit 0
I, [2016-12-17T09:18:05.072457 #14] INFO -- :
I, [2016-12-17T09:18:05.073063 #14] INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2016-12-17T09:18:05.094604 #14] INFO -- :
I, [2016-12-17T09:18:05.095566 #14] INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2016-12-17T09:18:05.101806 #14] INFO -- :
I, [2016-12-17T09:18:05.102894 #14] INFO -- : > /root/upgrade_postgres
I, [2016-12-17T09:18:05.112732 #14] INFO -- :
I, [2016-12-17T09:18:05.113478 #14] INFO -- : > rm /root/upgrade_postgres
I, [2016-12-17T09:18:05.117602 #14] INFO -- :
I, [2016-12-17T09:18:05.118501 #14] INFO -- : Replacing data_directory = '/var/lib/postgresql/9.5/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.120126 #14] INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.121516 #14] INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.122976 #14] INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.124371 #14] INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.125726 #14] INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.126940 #14] INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2016-12-17T09:18:05.132320 #14] INFO -- :
I, [2016-12-17T09:18:05.133328 #14] INFO -- : Replacing (?-mix:#?max_wal_senders *=.*) with max_wal_senders = $db_max_wal_senders in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.134681 #14] INFO -- : Replacing (?-mix:#?wal_level *=.*) with wal_level = $db_wal_level in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.136064 #14] INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.137345 #14] INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.138644 #14] INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/9.5/main/postgresql.conf
I, [2016-12-17T09:18:05.139813 #14] INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres peer in /etc/postgresql/9.5/main/pg_hba.conf
I, [2016-12-17T09:18:05.140959 #14] INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/9.5/main/pg_hba.conf
I, [2016-12-17T09:18:05.141949 #14] INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main
I, [2016-12-17T09:18:05.145214 #14] INFO -- : > sleep 5
2016-12-17 09:18:05 UTC [46-1] LOG: database system was interrupted; last known up at 2016-12-17 08:57:21 UTC
I, [2016-12-17T09:18:10.149505 #14] INFO -- :
I, [2016-12-17T09:18:10.150408 #14] INFO -- : > su postgres -c 'createdb discourse' || true
2016-12-17 09:18:10 UTC [50-1] postgres@postgres FATAL: the database system is starting up
2016-12-17 09:18:10 UTC [51-1] postgres@template1 FATAL: the database system is starting up
createdb: could not connect to database template1: FATAL: the database system is starting up
I, [2016-12-17T09:18:10.283260 #14] INFO -- :
I, [2016-12-17T09:18:10.284283 #14] INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2016-12-17 09:18:10 UTC [62-1] postgres@discourse FATAL: the database system is starting up
psql: FATAL: the database system is starting up
I, [2016-12-17T09:18:10.433879 #14] INFO -- :
I, [2016-12-17T09:18:10.434862 #14] INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
2016-12-17 09:18:10 UTC [73-1] postgres@discourse FATAL: the database system is starting up
psql: FATAL: the database system is starting up
I, [2016-12-17T09:18:10.580972 #14] INFO -- :
I, [2016-12-17T09:18:10.581433 #14] INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
2016-12-17 09:18:10 UTC [84-1] postgres@discourse FATAL: the database system is starting up
psql: FATAL: the database system is starting up
I, [2016-12-17T09:18:10.726359 #14] INFO -- :
I, [2016-12-17T09:18:10.727477 #14] INFO -- : Terminating async processes
I, [2016-12-17T09:18:10.727748 #14] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main pid: 43
2016-12-17 09:18:10 UTC [43-1] LOG: received fast shutdown request
I, [2016-12-17T09:18:20.729327 #14] INFO -- : HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main pid:43 did not terminate cleanly, forcing termination!
FAILED
--------------------
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 74 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;\"'"
a00b2a37440a0d25746f80f9b2efb53e606e63216ea1a1014b2e440f9c6e3d0a
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one
So site down. Any ideas?
Edit: Actually, site not 100% down. Came up with start app, but still at 1.6.7.
Edit 2: Wrote this post, had a cup of coffee, tried again with the rebuild and it looks like it is going to work now. Wtf.