Skip to content

Instantly share code, notes, and snippets.

@ulysses4ever
Last active February 14, 2021 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ulysses4ever/35e8683dfc39358c20f6d2e2309ca79e to your computer and use it in GitHub Desktop.
Save ulysses4ever/35e8683dfc39358c20f6d2e2309ca79e to your computer and use it in GitHub Desktop.
Discourse recover from filesystem backup
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
cd /pups && git pull && /pups/bin/pups --stdin
Already up to date.
I, [2021-02-14T01:33:08.901887 #1] INFO -- : Loading --stdin
I, [2021-02-14T01:33:08.913468 #1] INFO -- : > locale-gen $LANG && update-locale
I, [2021-02-14T01:33:08.982208 #1] INFO -- : Generating locales (this might take a while)...
Generation complete.
I, [2021-02-14T01:33:08.982785 #1] INFO -- : > mkdir -p /shared/postgres_run
I, [2021-02-14T01:33:08.987074 #1] INFO -- :
I, [2021-02-14T01:33:08.987594 #1] INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2021-02-14T01:33:08.991164 #1] INFO -- :
I, [2021-02-14T01:33:08.991488 #1] INFO -- : > chmod 775 /shared/postgres_run
I, [2021-02-14T01:33:08.994708 #1] INFO -- :
I, [2021-02-14T01:33:08.995005 #1] INFO -- : > rm -fr /var/run/postgresql
I, [2021-02-14T01:33:08.998386 #1] INFO -- :
I, [2021-02-14T01:33:08.998659 #1] INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2021-02-14T01:33:09.003148 #1] INFO -- :
I, [2021-02-14T01:33:09.003823 #1] INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2021/02/14 01:33:09 socat[27] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2021-02-14T01:33:09.012348 #1] INFO -- :
I, [2021-02-14T01:33:09.012761 #1] INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2021-02-14T01:33:09.018464 #1] INFO -- :
I, [2021-02-14T01:33:09.018901 #1] INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2021-02-14T01:33:09.025376 #1] INFO -- :
I, [2021-02-14T01:33:09.025860 #1] INFO -- : > mkdir -p /shared/postgres_run/13-main.pg_stat_tmp
I, [2021-02-14T01:33:09.031101 #1] INFO -- :
I, [2021-02-14T01:33:09.031933 #1] INFO -- : > chown postgres:postgres /shared/postgres_run/13-main.pg_stat_tmp
I, [2021-02-14T01:33:09.037196 #1] INFO -- :
I, [2021-02-14T01:33:09.048648 #1] INFO -- : File > /etc/service/postgres/run chmod: +x chown:
I, [2021-02-14T01:33:09.059616 #1] INFO -- : File > /etc/service/postgres/log/run chmod: +x chown:
I, [2021-02-14T01:33:09.070790 #1] INFO -- : File > /etc/runit/3.d/99-postgres chmod: +x chown:
I, [2021-02-14T01:33:09.081824 #1] INFO -- : File > /root/upgrade_postgres chmod: +x chown:
I, [2021-02-14T01:33:09.082688 #1] INFO -- : > chown -R root /var/lib/postgresql/13/main
I, [2021-02-14T01:33:09.958591 #1] INFO -- :
I, [2021-02-14T01:33:09.958982 #1] INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/13/bin/initdb -D /shared/postgres_data || exit 0
I, [2021-02-14T01:33:09.962851 #1] INFO -- :
I, [2021-02-14T01:33:09.963014 #1] INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2021-02-14T01:33:09.990103 #1] INFO -- :
I, [2021-02-14T01:33:09.990428 #1] INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2021-02-14T01:33:09.994965 #1] INFO -- :
I, [2021-02-14T01:33:09.995362 #1] INFO -- : > /root/upgrade_postgres
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
debconf: delaying package configuration, since apt-utils is not installed
I, [2021-02-14T01:33:32.126451 #1] INFO -- : Upgrading PostgreSQL from version 12 to 13
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /shared/postgres_data_new ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
/usr/lib/postgresql/13/bin/pg_ctl -D /shared/postgres_data_new -l logfile start
Get:1 http://deb.debian.org/debian buster InRelease [122 kB]
Get:2 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:3 http://apt.postgresql.org/pub/repos/apt buster-pgdg InRelease [104 kB]
Get:4 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:5 http://security.debian.org/debian-security buster/updates/main amd64 Packages [267 kB]
Get:6 http://deb.debian.org/debian buster/main amd64 Packages [7,907 kB]
Get:7 https://deb.nodesource.com/node_10.x buster InRelease [4,584 B]
Get:8 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages [216 kB]
Get:9 https://deb.nodesource.com/node_10.x buster/main amd64 Packages [768 B]
Get:10 http://deb.debian.org/debian buster-updates/main amd64 Packages.diff/Index [5,656 B]
Get:11 http://deb.debian.org/debian buster-updates/main amd64 Packages 2020-12-24-1401.30.pdiff [286 B]
Get:12 http://deb.debian.org/debian buster-updates/main amd64 Packages 2021-01-29-2000.47.pdiff [408 B]
Get:13 http://deb.debian.org/debian buster-updates/main amd64 Packages 2021-02-07-1359.56.pdiff [2,302 B]
Get:13 http://deb.debian.org/debian buster-updates/main amd64 Packages 2021-02-07-1359.56.pdiff [2,302 B]
Fetched 8,746 kB in 4s (2,353 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
postgresql-client-12
Suggested packages:
postgresql-doc-12
The following NEW packages will be installed:
postgresql-12 postgresql-client-12
0 upgraded, 2 newly installed, 0 to remove and 28 not upgraded.
Need to get 16.1 MB of archives.
After this operation, 54.1 MB of additional disk space will be used.
Get:1 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 postgresql-client-12 amd64 12.6-1.pgdg100+1 [1,424 kB]
Get:2 http://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 postgresql-12 amd64 12.6-1.pgdg100+1 [14.7 MB]
Fetched 16.1 MB in 5s (3,262 kB/s)
Selecting previously unselected package postgresql-client-12.
(Reading database ... 43899 files and directories currently installed.)
Preparing to unpack .../postgresql-client-12_12.6-1.pgdg100+1_amd64.deb ...
Unpacking postgresql-client-12 (12.6-1.pgdg100+1) ...
Selecting previously unselected package postgresql-12.
Preparing to unpack .../postgresql-12_12.6-1.pgdg100+1_amd64.deb ...
Unpacking postgresql-12 (12.6-1.pgdg100+1) ...
Setting up postgresql-client-12 (12.6-1.pgdg100+1) ...
update-alternatives: warning: forcing reinstallation of alternative /usr/share/postgresql/13/man/man1/psql.1.gz because link group psql.1.gz is broken
Setting up postgresql-12 (12.6-1.pgdg100+1) ...
Creating new PostgreSQL cluster 12/main ...
/usr/lib/postgresql/12/bin/initdb -D /var/lib/postgresql/12/main --auth-local peer --auth-host md5
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "C.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/12/main ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
pg_ctlcluster 12 main start
Ver Cluster Port Status Owner Data directory Log file
12 main 5433 down postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
update-alternatives: warning: forcing reinstallation of alternative /usr/share/postgresql/13/man/man1/postmaster.1.gz because link group postmaster.1.gz is broken
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for postgresql-common (223.pgdg100+1) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Stopping PostgreSQL 12 database server: main.
Stopping PostgreSQL 13 database server: main.
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
The source cluster was not shut down cleanly.
Failure, exiting
-------------------------------------------------------------------------------------
UPGRADE OF POSTGRES FAILED
Please visit https://meta.discourse.org/t/postgresql-13-update/172563 for support.
You can run ./launcher start app to restart your app in the meanwhile
FAILED
--------------------
Pups::ExecError: /root/upgrade_postgres failed with return #<Process::Status: pid 46 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params "/root/upgrade_postgres"
c959fd1cf9d94e8ca5e60a1e631dc8d957259683fc156bd4993bba8df37ac23a
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=3 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e DISCOURSE_DEVELOPER_EMAILS=bravit111@gmail.com,ulysses4ever@gmail.com -e DISCOURSE_HOSTNAME=forum.mmcs.sfedu.ru -e DISCOURSE_SMTP_ADDRESS=class.mmcs.sfedu.ru -e DISCOURSE_ENABLE_CORS=true -e 'DISCOURSE_CORS_ORIGIN=*' -e DONT_PRECOMPILE_CSS=1 -h users-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 8088:80 -p 2222:22 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:b1:c6:37:24:01 local_discourse/app /sbin/boot
Unable to find image 'local_discourse/app:latest' locally
docker: Error response from daemon: pull access denied for local_discourse/app, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment