Problem with changing SMTP credentials

Discourse version: v3.2.0 stable
We are currently migrating to a new email service provider. To complete this transition, we need to update the SMTP credentials in the app.yaml file. After updating the credentials, we need to rebuild the container for the changes to take effect.

cd /var/discourse/
./launcher rebuild app

The issue is that the rebuild is failing.

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3' failed with return #<Process::Status: pid 530 exit 5>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3'"]}
bootstrap failed with exit code 5
** 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.
b0b1f4d0ed01a9bf5b9037585a4b0416b4b4efa2b8e67557ced3d7507380ad0d
root:/#

Based on the logs, I have identified two potential causes:
1

2024-10-14 12:39:33.606 UTC [55] postgres@postgres ERROR:  database "discourse" already exists
2024-10-14 12:39:33.606 UTC [55] postgres@postgres STATEMENT:  CREATE DATABASE discourse;
createdb: error: database creation failed: ERROR:  database "discourse" already exists
2024-10-14 12:39:33.728 UTC [58] postgres@discourse ERROR:  role "discourse" already exists
2024-10-14 12:39:33.728 UTC [58] postgres@discourse STATEMENT:  create user discourse;
ERROR:  role "discourse" already exists
  • I saw in another thread that this error can be ignore. It’s not a real problem.

2

I, [2024-10-14T12:41:56.391691 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle install --jobs $(($(nproc) - 1)) --retry 3'
google-protobuf-3.25.2-x86_64-linux requires ruby version < 3.3.dev, >= 2.7,
which is incompatible with the current version, 3.3.4
  • It looks like the we are not using the ruby version required.

I’ve attached the full log if you want to give it a better look.
AWS Emails Restart Discourse VM Log 1.txt (39.8 KB)

One possible solution is to migrate to the latest stable version, however, this is not feasible at the moment.

With the version upgrade off the table, what other options do we have? Is it possible to rebuild without updating the setup script? I’m not sure if that would solve the problem.

Is is possible to set the SMTP credentials as environment variables?

Any help is greatly appreciated.

Thanks

1 Like

Rather than rebuilding, if you’ve not done any upgrades frrom the UX, you can

./launcher destroy app;./launcher start app

to apply the new SMTP settings.

2 Likes