502 bad gateway

Good morning everyone!

About a week ago my installation of Discourse may have updated. I’m not 100% sure, but all I know is whenever I would visit the site I’d get a 502 error issued by nginx.

This was your typical docker install.

I have since went in and ran “./launcher rebuild app” and it seemed to error out.

I then ran “./discourse-setup” and it errored out as well.

I’m no pro though and fairly new to discourse so I can post the results of the rebuild here if required.

After about a week of searching around and trying to find fix, I may just go ahead and do a complete fresh install on the VPS. That said, I’m not sure how to backup and restore the user accounts and databases.

Any advice would be amazing!
Thank you for your time!

Hello and welcome @stokedcrf :slight_smile:

If you include the logs of your rebuild we may be able to pinpoint what the issue is. :crossed_fingers:

2 Likes

Sorry for the delay.

While the rebuild log seems quite long, it seems this is around when it fails:

Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)
I, [2024-01-29T18:40:10.599024 #1]  INFO -- :
I, [2024-01-29T18:40:10.627958 #1]  INFO -- : Terminating async processes
I, [2024-01-29T18:40:10.629723 #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: 42
2024-01-29 18:40:10.630 UTC [42] LOG:  received fast shutdown request
2024-01-29 18:40:10.644 UTC [42] LOG:  aborting any active transactions
2024-01-29 18:40:10.651 UTC [42] LOG:  background worker "logical replication launcher" (PID 51) exited with exit code 1
2024-01-29 18:40:10.654 UTC [46] LOG:  shutting down
2024-01-29 18:40:10.811 UTC [42] LOG:  database system is shut down


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 3290 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
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.
963d90233930c09a993e084bf1e858d7486ddb797bd5743e6073f4563db0777a

Please do as that log says and:

Thanks for all the tips folks.
I ended up just doing a fresh install and restoring a backup from the backup directory. All is well! :slight_smile:

1 Like