How to resolve Pups exec errors during Discourse bootstrap

I am creating a new discourse instance from scratch for development purposes and see this bootstrap error again:

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 1002 exit 1>
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", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1

Container setup is with two containers for webonly and dataonly (redis) and with an external postgresql database. Commenting the maxmind settings does not change anything.

Any ideas what I can do here?

Best guess would be that you don’t have enough memory - in which case, add swap or move to a larger-RAM instance. Try free -h.

Hmmm, nope, we have 4 GB RAM and plenty of harddisk space (2 x 32 GB), the overall environment is the same as the other docker machine where builds run without problems.

MEM status:

root@docker3a:/var/discourse# free -h
gesamt benutzt frei gemns. Puffer/Cache verfĂĽgbar
Speicher: 3,8Gi 819Mi 1,4Gi 22Mi 1,9Gi 3,0Gi
Swap: 974Mi 52Mi 922Mi

1 Like

Any recent errors in the output of dmesg which might be relevant?

Can you share the whole log?

That’s a weird guess, we don’t usually see OoM causing migration errors in Discourses.

x86_64 arch detected.
Ensuring launcher is up to date
Launcher is up-to-date
2.0.20250226-0128: Pulling from discourse/base
Digest: sha256:6f18aa2cd22bba0deb91d69194e577d4f96130ad555ae8ec646a8792cbfe37db
Status: Image is up to date for discourse/base:2.0.20250226-0128
docker.io/discourse/base:2.0.20250226-0128
/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups.rb
/usr/local/bin/pups --stdin
18:C 19 Apr 2025 16:38:41.670 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
18:C 19 Apr 2025 16:38:41.670 # Redis version=7.0.15, bits=64, commit=00000000, modified=0, pid=18, just started
18:C 19 Apr 2025 16:38:41.670 # Configuration loaded
18:M 19 Apr 2025 16:38:41.670 * monotonic clock: POSIX clock_gettime
18:M 19 Apr 2025 16:38:41.670 * Running mode=standalone, port=6379.
18:M 19 Apr 2025 16:38:41.670 # Server initialized
18:M 19 Apr 2025 16:38:41.671 * Loading RDB produced by version 7.0.15
18:M 19 Apr 2025 16:38:41.671 * RDB age 72606 seconds
18:M 19 Apr 2025 16:38:41.671 * RDB memory usage when created 0.82 Mb
18:M 19 Apr 2025 16:38:41.671 * Done loading RDB, keys loaded: 0, keys expired: 0.
18:M 19 Apr 2025 16:38:41.671 * DB loaded from disk: 0.000 seconds
18:M 19 Apr 2025 16:38:41.671 * Ready to accept connections
999:C 19 Apr 2025 16:39:59.006 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
999:C 19 Apr 2025 16:39:59.006 # Redis version=7.0.15, bits=64, commit=00000000, modified=0, pid=999, just started
999:C 19 Apr 2025 16:39:59.006 # Configuration loaded
999:M 19 Apr 2025 16:39:59.006 * monotonic clock: POSIX clock_gettime
999:M 19 Apr 2025 16:39:59.006 # Warning: Could not create server TCP listening socket *:6379: bind: Address already in use
999:M 19 Apr 2025 16:39:59.006 # Failed listening on port 6379 (TCP), aborting.
18:signal-handler (1745080813) Received SIGTERM scheduling shutdown...
18:M 19 Apr 2025 16:40:13.541 # User requested shutdown...
18:M 19 Apr 2025 16:40:13.541 * Saving the final RDB snapshot before exiting.
18:M 19 Apr 2025 16:40:13.549 * DB saved on disk
18:M 19 Apr 2025 16:40:13.549 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 1002 exit 1>
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", "tag"=>"migrate", "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.
48b8aa6c912bbabc42d6b9373808088f5aa9079de1e1f7360fc858891a48556b

If this is a web_only container, why does it have redis on it?

Can you share your yml container definitions? And why are you even running a two container install?

Hey Falco
you are right and I am stupid :wink:
I will correct that …

OK, I fixed the separation of web_only and redis. Error msg now is

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 981 e
xit 1>
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", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migra
te'"]}
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.
801049b69a89d38b1ae5c299d356fc5f8dc6a8f518b1260c2dde05e0b6081556

But maybe its a misunderstanding / lack of knowledge on my side:

The database should be external on another lxc container which has a postgresql database. The database user and database exists, but the database is empty before the first bootstrap of web_only. Does the script create the database itself on the remote system upon first build? Or do I first have to create the database container and then export its default scheme and the data manually to the external postgresql daemon?

Visualization of the overall setup

forum2 Setup.excalidraw

Thanks for the diagram. That’s quite a sophisticated setup - you’d do that if you had a good reason and knew the territory.

If you’re still seeing the following, I think that’s the indication of what’s wrong. Redis can’t open the port it needs to be listening on.

So the questions are about whether redis should be doing that, in this container, and if so, where else on the machine is another redis running. lsof might be a useful tool here.

Hi @Ed_S
thanks for the hint about the missing port. I first want to wait for the reply from Falco concerning my questions about the general setup of discourse with an external postgres database.

Yes, the setup is a bit sophisticated compared to the standard with just one app container. I run everything in a dedicated root machine with Proxmox (https://proxmox.com) as virtualization environment at hetzner.de

1 Like

You still need to share the full logs, including the part where the migration failed. My guess (and it’s a guess since you haven’t shared the error) is that you’re using the AI plugin and your database doesn’t have the add-on that is required.

Nope, its an install without the AI plugin, although this instance shall be a playground for AI features in the future.

Enclosed is a tarball with

./launcher bootstrap web_only >> web_only_bootstrap.log

and the ymls for redis and web_only, passwords are removed.

forum2_build.tar.gz (3.3 KB)

Longshot:

links:
  - link:
      name: redis
      alias: data

why isn’t it alias: redis ?

1 Like