Hi, I’m trying to install a really old version (2.9.0.beta6) of discourse for testing purpose, the reason why I need to install it is because currently, our production discourse is on that version (we have custom plugin as well). which before upgrading I see lots of topics regarding failing when upgrading, so I want to really sure to upgrade the discourse to the latest version (3.3.0.beta1).
I’ve tried to checkout the old discourse docker using this command (i’ve tried using the main branch as well)
git checkout 7ab9e3afc7724ac47b9de0271371f6526177bf0c
as well as specify the image version using this command
./launcher rebuild app --run-image discourse/base:2.0.20220621-0049
but there are lots of errors that needs to be addressed first,
Is it not possible to install the old version anymore?
Previously this question asked on this topic (Fresh install old Discourse version? - #7 by Khrisna_Gunanasurya) but didn’t get any response.
Here is the log when rebuilding the app
root@staging-forums:/var/discourse# ./launcher rebuild app
x86_64 arch detected.
fatal: ref HEAD is not a symbolic ref
fatal: ref HEAD is not a symbolic ref
Stopping old container
+ /usr/bin/docker stop -t 60 app
app
2.0.20220621-0049: Pulling from discourse/base
Digest: sha256:086668a3aa42a62fa4de6ea146e6fded1793cba470b4c19269e204983cf9518c
Status: Image is up to date for discourse/base:2.0.20220621-0049
docker.io/discourse/base:2.0.20220621-0049
/usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2024-04-15T01:29:28.739159 #1] INFO -- : Reading from stdin
I, [2024-04-15T01:29:28.756495 #1] INFO -- : > locale-gen $LANG && update-locale
I, [2024-04-15T01:29:28.828362 #1] INFO -- : Generating locales (this might take a while)...
Generation complete.
I, [2024-04-15T01:29:28.829582 #1] INFO -- : > mkdir -p /shared/postgres_run
I, [2024-04-15T01:29:28.835547 #1] INFO -- :
I, [2024-04-15T01:29:28.836675 #1] INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2024-04-15T01:29:28.840904 #1] INFO -- :
I, [2024-04-15T01:29:28.841901 #1] INFO -- : > chmod 775 /shared/postgres_run
I, [2024-04-15T01:29:28.845799 #1] INFO -- :
I, [2024-04-15T01:29:28.846605 #1] INFO -- : > rm -fr /var/run/postgresql
I, [2024-04-15T01:29:28.850323 #1] INFO -- :
I, [2024-04-15T01:29:28.851133 #1] INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2024-04-15T01:29:28.855406 #1] INFO -- :
I, [2024-04-15T01:29:28.856408 #1] INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2024/04/15 01:29:28 socat[18] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2024-04-15T01:29:28.877070 #1] INFO -- :
I, [2024-04-15T01:29:28.877882 #1] INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2024-04-15T01:29:28.883564 #1] INFO -- :
I, [2024-04-15T01:29:28.884353 #1] INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2024-04-15T01:29:28.890020 #1] INFO -- :
I, [2024-04-15T01:29:28.890811 #1] INFO -- : > mkdir -p /shared/postgres_run/13-main.pg_stat_tmp
I, [2024-04-15T01:29:28.895525 #1] INFO -- :
I, [2024-04-15T01:29:28.896646 #1] INFO -- : > chown postgres:postgres /shared/postgres_run/13-main.pg_stat_tmp
I, [2024-04-15T01:29:28.901725 #1] INFO -- :
I, [2024-04-15T01:29:28.912934 #1] INFO -- : File > /etc/service/postgres/run chmod: +x chown:
I, [2024-04-15T01:29:28.922028 #1] INFO -- : File > /etc/service/postgres/log/run chmod: +x chown:
I, [2024-04-15T01:29:28.929631 #1] INFO -- : File > /etc/runit/3.d/99-postgres chmod: +x chown:
I, [2024-04-15T01:29:28.937065 #1] INFO -- : File > /root/upgrade_postgres chmod: +x chown:
I, [2024-04-15T01:29:28.938111 #1] INFO -- : > chown -R root /var/lib/postgresql/13/main
I, [2024-04-15T01:29:33.246175 #1] INFO -- :
I, [2024-04-15T01:29:33.247493 #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, [2024-04-15T01:29:33.252193 #1] INFO -- :
I, [2024-04-15T01:29:33.252953 #1] INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2024-04-15T01:29:33.282507 #1] INFO -- :
I, [2024-04-15T01:29:33.283672 #1] INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2024-04-15T01:29:33.288287 #1] INFO -- :
I, [2024-04-15T01:29:33.289123 #1] INFO -- : > /root/upgrade_postgres
I, [2024-04-15T01:29:33.297364 #1] INFO -- :
I, [2024-04-15T01:29:33.298314 #1] INFO -- : > rm /root/upgrade_postgres
I, [2024-04-15T01:29:33.302547 #1] INFO -- :
I, [2024-04-15T01:29:33.304293 #1] INFO -- : Replacing data_directory = '/var/lib/postgresql/13/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/13/main/postgresql.conf
I, [2024-04-15T01:29:33.305725 #1] INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/13/main/postgresql.conf
I, [2024-04-15T01:29:33.306611 #1] INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/13/main/postgresql.conf
I, [2024-04-15T01:29:33.307313 #1] INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/13/main/postgresql.conf
I, [2024-04-15T01:29:33.308055 #1] INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/13/main/postgresql.conf
I, [2024-04-15T01:29:33.308747 #1] INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/13/main/postgresql.conf
I, [2024-04-15T01:29:33.309553 #1] INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2024-04-15T01:29:33.322380 #1] INFO -- :
I, [2024-04-15T01:29:33.327032 #1] INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/13/main/postgresql.conf
I, [2024-04-15T01:29:33.330690 #1] INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/13/main/postgresql.conf
I, [2024-04-15T01:29:33.331608 #1] INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/13/main/postgresql.conf
I, [2024-04-15T01:29:33.333035 #1] INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres peer in /etc/postgresql/13/main/pg_hba.conf
I, [2024-04-15T01:29:33.334344 #1] INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2024-04-15T01:29:33.338738 #1] INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/13/main/pg_hba.conf
I, [2024-04-15T01:29:33.339512 #1] INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main
I, [2024-04-15T01:29:33.345868 #1] INFO -- : > sleep 5
2024-04-15 01:29:33.440 UTC [41] LOG: starting PostgreSQL 13.7 (Debian 13.7-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2024-04-15 01:29:33.441 UTC [41] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-04-15 01:29:33.441 UTC [41] LOG: listening on IPv6 address "::", port 5432
2024-04-15 01:29:33.457 UTC [41] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-04-15 01:29:33.472 UTC [44] LOG: database system was shut down at 2024-04-15 01:28:32 UTC
2024-04-15 01:29:33.482 UTC [41] LOG: database system is ready to accept connections
I, [2024-04-15T01:29:38.360685 #1] INFO -- :
I, [2024-04-15T01:29:38.362211 #1] INFO -- : > su postgres -c 'createdb discourse' || true
2024-04-15 01:29:38.531 UTC [54] postgres@postgres ERROR: database "discourse" already exists
2024-04-15 01:29:38.531 UTC [54] postgres@postgres STATEMENT: CREATE DATABASE discourse;
createdb: error: database creation failed: ERROR: database "discourse" already exists
I, [2024-04-15T01:29:38.536606 #1] INFO -- :
I, [2024-04-15T01:29:38.537742 #1] INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2024-04-15 01:29:38.638 UTC [58] postgres@discourse ERROR: role "discourse" already exists
2024-04-15 01:29:38.638 UTC [58] postgres@discourse STATEMENT: create user discourse;
ERROR: role "discourse" already exists
I, [2024-04-15T01:29:38.642388 #1] INFO -- :
I, [2024-04-15T01:29:38.643420 #1] INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
I, [2024-04-15T01:29:38.729718 #1] INFO -- : GRANT
I, [2024-04-15T01:29:38.730757 #1] INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
I, [2024-04-15T01:29:38.813306 #1] INFO -- : ALTER SCHEMA
I, [2024-04-15T01:29:38.814422 #1] INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists hstore;"'
NOTICE: extension "hstore" already exists, skipping
I, [2024-04-15T01:29:38.923056 #1] INFO -- : CREATE EXTENSION
I, [2024-04-15T01:29:38.924149 #1] INFO -- : > su postgres -c 'psql template1 -c "create extension if not exists pg_trgm;"'
NOTICE: extension "pg_trgm" already exists, skipping
I, [2024-04-15T01:29:39.018840 #1] INFO -- : CREATE EXTENSION
I, [2024-04-15T01:29:39.019873 #1] INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists hstore;"'
NOTICE: extension "hstore" already exists, skipping
I, [2024-04-15T01:29:39.117333 #1] INFO -- : CREATE EXTENSION
I, [2024-04-15T01:29:39.118273 #1] INFO -- : > su postgres -c 'psql discourse -c "create extension if not exists pg_trgm;"'
NOTICE: extension "pg_trgm" already exists, skipping
I, [2024-04-15T01:29:39.197935 #1] INFO -- : CREATE EXTENSION
I, [2024-04-15T01:29:39.198942 #1] INFO -- : > sudo -u postgres psql discourse
I, [2024-04-15T01:29:39.208142 #1] INFO -- : update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = 'discourse' AND encoding = pg_char_to_encoding('SQL_ASCII');
I, [2024-04-15T01:29:39.338312 #1] INFO -- : File > /var/lib/postgresql/take-database-backup chmod: +x chown: postgres:postgres
I, [2024-04-15T01:29:39.343902 #1] INFO -- : File > /var/spool/cron/crontabs/postgres chmod: chown:
I, [2024-04-15T01:29:39.344669 #1] INFO -- : > echo postgres installed!
I, [2024-04-15T01:29:39.347872 #1] INFO -- : postgres installed!
I, [2024-04-15T01:29:39.356732 #1] INFO -- : File > /etc/service/redis/run chmod: +x chown:
I, [2024-04-15T01:29:39.366745 #1] INFO -- : File > /etc/service/redis/log/run chmod: +x chown:
I, [2024-04-15T01:29:39.376178 #1] INFO -- : File > /etc/runit/3.d/10-redis chmod: +x chown:
I, [2024-04-15T01:29:39.377966 #1] INFO -- : Replacing daemonize yes with in /etc/redis/redis.conf
I, [2024-04-15T01:29:39.379359 #1] INFO -- : Replacing (?-mix:^pidfile.*$) with in /etc/redis/redis.conf
I, [2024-04-15T01:29:39.380353 #1] INFO -- : > install -d -m 0755 -o redis -g redis /shared/redis_data
I, [2024-04-15T01:29:39.386273 #1] INFO -- :
I, [2024-04-15T01:29:39.387745 #1] INFO -- : Replacing (?-mix:^logfile.*$) with logfile "" in /etc/redis/redis.conf
I, [2024-04-15T01:29:39.388891 #1] INFO -- : Replacing (?-mix:^bind .*$) with in /etc/redis/redis.conf
I, [2024-04-15T01:29:39.390202 #1] INFO -- : Replacing (?-mix:^dir .*$) with dir /shared/redis_data in /etc/redis/redis.conf
I, [2024-04-15T01:29:39.391233 #1] INFO -- : Replacing (?-mix:^protected-mode yes) with protected-mode no in /etc/redis/redis.conf
I, [2024-04-15T01:29:39.392128 #1] INFO -- : Replacing # io-threads 4 with io-threads $redis_io_threads in /etc/redis/redis.conf
I, [2024-04-15T01:29:39.393004 #1] INFO -- : > echo redis installed
I, [2024-04-15T01:29:39.398235 #1] INFO -- : redis installed
I, [2024-04-15T01:29:39.399872 #1] INFO -- : > cat /etc/redis/redis.conf | grep logfile
I, [2024-04-15T01:29:39.413734 #1] INFO -- : logfile ""
I, [2024-04-15T01:29:39.414735 #1] INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2024-04-15T01:29:39.418733 #1] INFO -- : > sleep 10
102:C 15 Apr 2024 01:29:39.451 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
102:C 15 Apr 2024 01:29:39.451 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=102, just started
102:C 15 Apr 2024 01:29:39.452 # Configuration loaded
102:M 15 Apr 2024 01:29:39.454 * monotonic clock: POSIX clock_gettime
102:M 15 Apr 2024 01:29:39.456 * Running mode=standalone, port=6379.
102:M 15 Apr 2024 01:29:39.456 # Server initialized
102:M 15 Apr 2024 01:29:39.459 # Can't handle RDB format version 10
102:M 15 Apr 2024 01:29:39.459 # Fatal error loading the DB: Invalid argument. Exiting.
I, [2024-04-15T01:29:49.426666 #1] INFO -- :
I, [2024-04-15T01:29:49.428141 #1] INFO -- : > thpoff echo "thpoff is installed!"
I, [2024-04-15T01:29:49.435908 #1] INFO -- : thpoff is installed!
I, [2024-04-15T01:29:49.436953 #1] INFO -- : > /usr/local/bin/ruby -e 'if ENV["DISCOURSE_SMTP_ADDRESS"] == "smtp.example.com"; puts "Aborting! Mail is not configured!"; exit 1; end'
I, [2024-04-15T01:29:49.542700 #1] INFO -- :
I, [2024-04-15T01:29:49.543698 #1] INFO -- : > /usr/local/bin/ruby -e 'if ENV["DISCOURSE_HOSTNAME"] == "discourse.example.com"; puts "Aborting! Domain is not configured!"; exit 1; end'
I, [2024-04-15T01:29:49.649171 #1] INFO -- :
I, [2024-04-15T01:29:49.650223 #1] INFO -- : > /usr/local/bin/ruby -e 'if (ENV["DISCOURSE_CDN_URL"] || "")[0..1] == "//"; puts "Aborting! CDN must have a protocol specified. Once fixed you should rebake your posts now to correct all posts."; exit 1; end'
I, [2024-04-15T01:29:49.754140 #1] INFO -- :
I, [2024-04-15T01:29:49.755203 #1] INFO -- : > rm -f /etc/cron.d/anacron
I, [2024-04-15T01:29:49.760454 #1] INFO -- :
I, [2024-04-15T01:29:49.766990 #1] INFO -- : File > /etc/cron.d/anacron chmod: chown:
I, [2024-04-15T01:29:49.778588 #1] INFO -- : File > /etc/runit/1.d/copy-env chmod: +x chown:
I, [2024-04-15T01:29:49.789173 #1] INFO -- : File > /etc/service/unicorn/run chmod: +x chown:
I, [2024-04-15T01:29:49.796649 #1] INFO -- : File > /etc/service/nginx/run chmod: +x chown:
I, [2024-04-15T01:29:49.804036 #1] INFO -- : File > /etc/runit/3.d/01-nginx chmod: +x chown:
I, [2024-04-15T01:29:49.812110 #1] INFO -- : File > /etc/runit/3.d/02-unicorn chmod: +x chown:
I, [2024-04-15T01:29:49.812963 #1] INFO -- : Replacing # postgres with sv start postgres || exit 1 in /etc/service/unicorn/run
I, [2024-04-15T01:29:49.813854 #1] INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2024-04-15T01:29:49.818403 #1] INFO -- : > cd /var/www/discourse && git reset --hard
129:C 15 Apr 2024 01:29:49.836 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
129:C 15 Apr 2024 01:29:49.837 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=129, just started
129:C 15 Apr 2024 01:29:49.837 # Configuration loaded
129:M 15 Apr 2024 01:29:49.839 * monotonic clock: POSIX clock_gettime
129:M 15 Apr 2024 01:29:49.842 * Running mode=standalone, port=6379.
129:M 15 Apr 2024 01:29:49.843 # Server initialized
129:M 15 Apr 2024 01:29:49.844 # Can't handle RDB format version 10
129:M 15 Apr 2024 01:29:49.844 # Fatal error loading the DB: Invalid argument. Exiting.
Updating files: 100% (31151/31151), done.
I, [2024-04-15T01:29:55.772184 #1] INFO -- : HEAD is now at 54a518b2 FIX: Quoting local dates bbcode regeneration (#17141)
I, [2024-04-15T01:29:55.773207 #1] INFO -- : > cd /var/www/discourse && git clean -f
I, [2024-04-15T01:29:56.053284 #1] INFO -- :
I, [2024-04-15T01:29:56.054826 #1] INFO -- : > cd /var/www/discourse && git remote set-branches --add origin main
I, [2024-04-15T01:29:56.064364 #1] INFO -- :
I, [2024-04-15T01:29:56.065324 #1] INFO -- : > cd /var/www/discourse && git remote set-branches origin v2.9.0.beta6
I, [2024-04-15T01:29:56.073576 #1] INFO -- :
I, [2024-04-15T01:29:56.074501 #1] INFO -- : > cd /var/www/discourse && git fetch --depth 1 origin v2.9.0.beta6
From https://github.com/discourse/discourse
* tag v2.9.0.beta6 -> FETCH_HEAD
I, [2024-04-15T01:29:57.220378 #1] INFO -- :
I, [2024-04-15T01:29:57.221277 #1] INFO -- : > cd /var/www/discourse && git checkout v2.9.0.beta6
error: pathspec 'v2.9.0.beta6' did not match any file(s) known to git
I, [2024-04-15T01:29:57.241696 #1] INFO -- :
I, [2024-04-15T01:29:57.242641 #1] INFO -- : Terminating async processes
I, [2024-04-15T01:29:57.243043 #1] 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/13/bin/postmaster -D /etc/postgresql/13/main pid: 41
2024-04-15 01:29:57.243 UTC [41] LOG: received fast shutdown request
2024-04-15 01:29:57.258 UTC [41] LOG: aborting any active transactions
2024-04-15 01:29:57.270 UTC [41] LOG: background worker "logical replication launcher" (PID 50) exited with exit code 1
2024-04-15 01:29:57.271 UTC [45] LOG: shutting down
2024-04-15 01:29:57.308 UTC [41] LOG: database system is shut down
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && git checkout v2.9.0.beta6 failed with return #<Process::Status: pid 153 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"code", "cmd"=>["git reset --hard", "git clean -f", "git remote set-branches --add origin main", "git remote set-branches origin $version", "git fetch --depth 1 origin $version", "git checkout $version", "mkdir -p tmp", "chown discourse:www-data tmp", "mkdir -p tmp/pids", "mkdir -p tmp/sockets", "touch tmp/.gitkeep", "mkdir -p /shared/log/rails", "bash -c \"touch -a /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log\"", "bash -c \"ln -s /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log $home/log\"", "bash -c \"mkdir -p /shared/{uploads,backups}\"", "bash -c \"ln -s /shared/{uploads,backups} $home/public\"", "bash -c \"mkdir -p /shared/tmp/{backups,restores}\"", "bash -c \"ln -s /shared/tmp/{backups,restores} $home/tmp\"", "chown -R discourse:www-data /shared/log/rails /shared/uploads /shared/backups /shared/tmp", "find public/plugins/ -maxdepth 1 -xtype l -delete"]}
bootstrap failed with exit code 1
** 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.
37c827d8fec787b69e0f8ee38b06dbbebf2003a7fd7065f65032828897a17d1f