I’m trying to install the workaround for AWS’s incompatability with Backblaze from this topic:
# This template reverts aws-sdk-s3 to a version that works with backblaze params: home: /var/www/discourse hooks: after_bundle_exec: - exec: cd: $home cmd: - bundle config set frozen false - "sed -i 's/gem \"aws-sdk-s3\", require: false/gem \"aws-sdk-s3\", \"1.177.0\", require: false/' Gemfile" - bundle update aws-sdk-s3 - bundle add aws-sdk-core --version 3.215
I added this file at templates/aws-revert.template.yml
. This template can then be included in the app.yml
:
templates:
- "templates/aws-revert.template.yml"
I didn’t know why it was using /var/www/discourse
, but that seemed incorrect to me since Discourse is installed at /var/discourse
. So, I tried using that path instead. However, that caused the build to fail:
I, [2025-06-04T17:18:12.912694 #1] INFO -- : > cd /var/discourse && sudo -H -E -u discourse git clean -f
sh: 1: cd: can't cd to /var/discourse
I, [2025-06-04T17:18:12.916206 #1] INFO -- :
I, [2025-06-04T17:18:12.917758 #1] INFO -- : Terminating async processes
I, [2025-06-04T17:18:12.917919 #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/15/bin/postmaster -D /etc/postgresql/15/main pid: 42
2025-06-04 17:18:12.918 UTC [42] LOG: received fast shutdown request
I, [2025-06-04T17:18:12.919159 #1] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 109
109:signal-handler (1749057492) Received SIGTERM scheduling shutdown...
2025-06-04 17:18:12.920 UTC [42] LOG: aborting any active transactions
2025-06-04 17:18:12.931 UTC [42] LOG: background worker "logical replication launcher" (PID 56) exited with exit code 1
2025-06-04 17:18:12.932 UTC [51] LOG: shutting down
2025-06-04 17:18:12.933 UTC [51] LOG: checkpoint starting: shutdown immediate
2025-06-04 17:18:12.940 UTC [51] LOG: checkpoint complete: wrote 4 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.003 s, sync=0.002 s, total=0.008 s; sync files=3, longest=0.001 s, average=0.001 s; distance=7 kB, estimate=7 kB
2025-06-04 17:18:12.949 UTC [42] LOG: database system is shut down
109:M 04 Jun 2025 17:18:13.013 # User requested shutdown...
109:M 04 Jun 2025 17:18:13.014 * Saving the final RDB snapshot before exiting.
109:M 04 Jun 2025 17:18:13.055 * DB saved on disk
109:M 04 Jun 2025 17:18:13.056 # Redis is now ready to exit, bye bye...
FAILED
--------------------
Pups::ExecError: cd /var/discourse && sudo -H -E -u discourse git clean -f failed with return #<Process::Status: pid 139 exit 2>
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"=>"code", "cmd"=>["sudo -H -E -u discourse git clean -f", "sudo -H -E -u discourse bash -c '\n set -o errexit\n if [ $(git rev-parse --is-shallow-repository) == \"true\" ]; then\n git remote set-branches --add origin main\n git remote set-branches origin $version\n git fetch --depth 1 origin $version\n else\n git fetch --tags --prune-tags --prune --force origin\n fi\n'", "sudo -H -E -u discourse bash -c '\n set -o errexit\n if [[ $(git symbolic-ref --short HEAD) == $version ]] ; then\n git pull\n else\n git -c advice.detachedHead=false checkout $version\n fi\n'", "sudo -H -E -u discourse git config user.discourse-version $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", "[ ! -d public/plugins ] || find public/plugins/ -maxdepth 1 -xtype l -delete"]}
bootstrap failed with exit code 2
** 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.
0abe373946b8296a6961c245b3d756d85d9482d00c7b82a6ce5c8e91850c3f3c
I realized eventually that this is because /var/www/discourse
is the path inside the docker container, not on the host. Changing it back to /var/www/discourse
fixes the issue. However, I noticed that $home
is already defined in the app.yml
, so I ended up just leaving it out:
# Revert aws-sdk-s3 to a version that works with Backblaze
hooks:
after_bundle_exec:
- exec:
cd: $home
cmd:
- bundle config set frozen false
- "sed -i 's/gem \"aws-sdk-s3\", require: false/gem \"aws-sdk-s3\", \"1.177.0\", require: false/' Gemfile"
- bundle update aws-sdk-s3
- bundle add aws-sdk-core --version 3.215
This worked as well.