Discourse_docker: issues with bootstrapping

AI-generated summary

A user, sgw, encountered issues bootstrapping Discourse using the discourse_docker project on a Debian 12 VM. The bootstrap process failed with a Pups::ExecError related to gem install bundler, specifically at this line in the web.template.yml. Initial troubleshooting involved checking internet access (merefield) and considering whether the discourse user existed within the Docker container (sgw). However, the root cause turned out to be an outdated Git checkout using the master branch instead of main (sgw). After re-pulling the repository, the bootstrap process completed successfully, allowing sgw to deploy Discourse behind Traefik. The issue was initially reported in relation to a Packer/Ansible deployment (sgw). A repeated error on another host, with a working FQDN, points to a potential sensitivity to git branch (sgw).

Learning how to deploy discourse on docker, on premise, following/using this project. I can’t find any “Issues” there so I ask here.

I work on a packer-project deploying the whole stack via ansible, the target machine is a small local debian-12 VM right now (docker-ce 28.2.2).

The app.yml is more or less close to the default from the repo. I only add labels to the container (integration with traefik) and something like that. Same app.yml built fine on another debian server.

Things fail at ./launcher bootstrap app:

From https://github.com/discourse/discourse
 * branch              tests-passed -> FETCH_HEAD
 * [new branch]        tests-passed -> origin/tests-passed
I, [2025-06-19T15:01:57.466297 #1]  INFO -- : 
I, [2025-06-19T15:01:57.466503 #1]  INFO -- : > cd /var/www/discourse && git checkout tests-passed
Switched to a new branch 'tests-passed'
I, [2025-06-19T15:02:00.166283 #1]  INFO -- : Branch 'tests-passed' set up to track remote branch 'tests-passed' from 'origin'.

I, [2025-06-19T15:02:00.166430 #1]  INFO -- : > cd /var/www/discourse && mkdir -p tmp
I, [2025-06-19T15:02:00.173066 #1]  INFO -- : 
I, [2025-06-19T15:02:00.173236 #1]  INFO -- : > cd /var/www/discourse && chown discourse:www-data tmp
I, [2025-06-19T15:02:00.178867 #1]  INFO -- : 
I, [2025-06-19T15:02:00.178989 #1]  INFO -- : > cd /var/www/discourse && mkdir -p tmp/pids
I, [2025-06-19T15:02:00.183569 #1]  INFO -- : 
I, [2025-06-19T15:02:00.183662 #1]  INFO -- : > cd /var/www/discourse && mkdir -p tmp/sockets
I, [2025-06-19T15:02:00.189147 #1]  INFO -- : 
I, [2025-06-19T15:02:00.189258 #1]  INFO -- : > cd /var/www/discourse && touch tmp/.gitkeep
I, [2025-06-19T15:02:00.195217 #1]  INFO -- : 
I, [2025-06-19T15:02:00.195305 #1]  INFO -- : > cd /var/www/discourse && mkdir -p                    /shared/log/rails
I, [2025-06-19T15:02:00.200411 #1]  INFO -- : 
I, [2025-06-19T15:02:00.200507 #1]  INFO -- : > cd /var/www/discourse && bash -c "touch -a           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log"
I, [2025-06-19T15:02:00.208619 #1]  INFO -- : 
I, [2025-06-19T15:02:00.208771 #1]  INFO -- : > cd /var/www/discourse && bash -c "ln    -s           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log /var/www/discourse/log"
I, [2025-06-19T15:02:00.215673 #1]  INFO -- : 
I, [2025-06-19T15:02:00.215824 #1]  INFO -- : > cd /var/www/discourse && bash -c "mkdir -p           /shared/{uploads,backups}"
I, [2025-06-19T15:02:00.222167 #1]  INFO -- : 
I, [2025-06-19T15:02:00.222270 #1]  INFO -- : > cd /var/www/discourse && bash -c "ln    -s           /shared/{uploads,backups} /var/www/discourse/public"
I, [2025-06-19T15:02:00.229600 #1]  INFO -- : 
I, [2025-06-19T15:02:00.229707 #1]  INFO -- : > cd /var/www/discourse && bash -c "mkdir -p           /shared/tmp/{backups,restores}"
I, [2025-06-19T15:02:00.236308 #1]  INFO -- : 
I, [2025-06-19T15:02:00.236383 #1]  INFO -- : > cd /var/www/discourse && bash -c "ln    -s           /shared/tmp/{backups,restores} /var/www/discourse/tmp"
I, [2025-06-19T15:02:00.243571 #1]  INFO -- : 
I, [2025-06-19T15:02:00.243892 #1]  INFO -- : > cd /var/www/discourse && chown -R discourse:www-data /shared/log/rails /shared/uploads /shared/backups /shared/tmp
I, [2025-06-19T15:02:00.249403 #1]  INFO -- : 
I, [2025-06-19T15:02:00.249501 #1]  INFO -- : > cd /var/www/discourse && find public/plugins/ -maxdepth 1 -xtype l -delete
I, [2025-06-19T15:02:00.258481 #1]  INFO -- : 
I, [2025-06-19T15:02:00.258881 #1]  INFO -- : Replacing # redis with sv start redis || exit 1 in /etc/service/unicorn/run
I, [2025-06-19T15:02:00.259572 #1]  INFO -- : > cd /var/www/discourse/plugins && git clone https://github.com/discourse/docker_manager.git
Cloning into 'docker_manager'...
I, [2025-06-19T15:02:02.757529 #1]  INFO -- : 
I, [2025-06-19T15:02:02.757835 #1]  INFO -- : > cp /var/www/discourse/config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf
I, [2025-06-19T15:02:02.764975 #1]  INFO -- : 
I, [2025-06-19T15:02:02.765341 #1]  INFO -- : > rm /etc/nginx/sites-enabled/default
I, [2025-06-19T15:02:02.771575 #1]  INFO -- : 
I, [2025-06-19T15:02:02.771778 #1]  INFO -- : > mkdir -p /var/nginx/cache
I, [2025-06-19T15:02:02.775586 #1]  INFO -- : 
I, [2025-06-19T15:02:02.776449 #1]  INFO -- : Replacing pid /run/nginx.pid; with daemon off; in /etc/nginx/nginx.conf
I, [2025-06-19T15:02:02.776770 #1]  INFO -- : Replacing (?m-ix:upstream[^\}]+\}) with upstream discourse { server 127.0.0.1:3000; } in /etc/nginx/conf.d/discourse.conf
I, [2025-06-19T15:02:02.777222 #1]  INFO -- : Replacing (?-mix:server_name.+$) with server_name _ ; in /etc/nginx/conf.d/discourse.conf
I, [2025-06-19T15:02:02.777470 #1]  INFO -- : Replacing (?-mix:client_max_body_size.+$) with client_max_body_size $upload_size ; in /etc/nginx/conf.d/discourse.conf
I, [2025-06-19T15:02:02.777812 #1]  INFO -- : > echo "done configuring web"
I, [2025-06-19T15:02:02.781599 #1]  INFO -- : done configuring web

I, [2025-06-19T15:02:02.781828 #1]  INFO -- : > cd /var/www/discourse && gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,""); print $0 }' Gemfile.lock)
ERROR:  Error installing bundler:
	bundler-2.6.4 requires Ruby version >= 3.1.0. The current ruby version is 2.7.2.137.
I, [2025-06-19T15:02:03.280749 #1]  INFO -- : 
I, [2025-06-19T15:02:03.281100 #1]  INFO -- : Terminating async processes
I, [2025-06-19T15:02:03.281175 #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: 60
I, [2025-06-19T15:02:03.281235 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 177
177:signal-handler (1750345323) Received SIGTERM scheduling shutdown...
2025-06-19 15:02:03.281 UTC [60] LOG:  received fast shutdown request
2025-06-19 15:02:03.309 UTC [60] LOG:  aborting any active transactions
2025-06-19 15:02:03.311 UTC [60] LOG:  background worker "logical replication launcher" (PID 69) exited with exit code 1
2025-06-19 15:02:03.312 UTC [64] LOG:  shutting down
177:M 19 Jun 2025 15:02:03.324 # User requested shutdown...
177:M 19 Jun 2025 15:02:03.324 * Saving the final RDB snapshot before exiting.
177:M 19 Jun 2025 15:02:03.347 * DB saved on disk
177:M 19 Jun 2025 15:02:03.347 # Redis is now ready to exit, bye bye...
2025-06-19 15:02:03.493 UTC [60] LOG:  database system is shut down


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,""); print $0 }' Gemfile.lock) failed with return #<Process::Status: pid 315 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"web", "cmd"=>["gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,\"\"); print $0 }' Gemfile.lock)", "find $home ! -user discourse -exec chown discourse {} \\+"]}
3539ee62a81cc2a309d4bfcf4fc6049bd70749d8f7c87bd2bf634eaf33fa4b7b
** 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.

Any hints on how to fix that? help appreciated …

Regards, Stefan

EDIT: increased RAM to 8GB, didn’t change the situation

Does your local VM have full internet access and https?

The normal local install is dev-install

Otherwise use the standard install for production.

The VM is fully online, yes. Although it is not yet reachable from the outside via a working FQDN, DNS-record, static IP. If that matters for bootstrapping (I had assumed, no).

it fails at this line

Doesn’t that maybe relate to the fact that the user discourse doesn’t exist on the docker host … ? … maybe … ? Or is that inside the discourse-container?

I get the same error on a completely different host.

This one has a working FQDN pointing to the server etc

OK , I “solved” that. Somehow the git checkout didn’t pull correctly and was using some strange old combo of image and config.

Re-pulled, starting over. I think I should be able to progress now. thx

EDIT: seems the former git-checkout came from branch master and not main. So it was rather outdated.

Things work now: discourse behind traefik, nice.