Deployment fails - exec_command.rb:117:in `spawn

Hi guys.
Before I clutter here with long logs I pasted that below.
Deployment fails each time this very way. Anybody can share any suggestion on what is the issue & how to fix I’ll appreciate very much.

I, [2023-06-20T14:08:40.997134 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'LOAD_PLUGINS=0 bundle exec rake plugin:pull_compatible_all'
I, [2023-06-20T14:08:43.104608 #1]  INFO -- : docker_manager is already at latest compatible version

I, [2023-06-20T14:08:43.104825 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
Redis::CommandError: READONLY You can't write against a read only replica. script: bcec1d9b3bbcfb089dc0b7316771be9f011872b6, on @user_script:8.
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/client.rb:162:in `call'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rack-mini-profiler-3.1.0/lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis.rb:270:in `block in send_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis.rb:269:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis.rb:269:in `send_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/commands/scripting.rb:110:in `_eval'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/commands/scripting.rb:97:in `evalsha'
/var/www/discourse/lib/discourse_redis.rb:273:in `eval'
/var/www/discourse/lib/distributed_mutex.rb:82:in `get_lock'
/var/www/discourse/lib/distributed_mutex.rb:50:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:221:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2023-06-20T14:08:45.555646 #1]  INFO -- : 


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 687 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117: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.
1 Like

Auhh… that is Redis - being a novice took a while - right?
But if yes so then how to deploy in a manner such that one would think of it, would call it “standby replica”? - yes, such Discourse instance I do mean.

Is this a standard install, or a development install or something else? Did you make your own redis? For a standard install redis should be in the container and Just Work.

1 Like

Hi.
I did not mention - I presumed & still do, that what I try is not non-common - that both Redis & pgSQL are external to Discourse container.
Is it a possible to deploy Discourse in more-less standard way as “standby” - in the same/similar manner to Redis - so such container instantiation/deployment would not fail?

1 Like

Yes, but you’ll need to debug your redis server on your own.

The error is

You can't write against a read only replica 

It looks like you’ve created a replica and you need to be writing to the main one. If you’re trying to fail over then you’ll need to figure out how to switch the replica to be active and stop being a replica.

You’ll need to get that help elsewhere.

Yes. But fail-over is not the issue I’m having here, not yet.
Here I’m trying to instantiate such a “standby/secondary” Discourse container on a different, separate node/system, where both Redis & pgSQL are such read-only replicas - how to do that?

The error is self-explanatory and obvious question is - to me, as it’s very fist foray of mine into Discourse - how to deploy & run such a “hot-standby” container, if it’s possible at all.

You’ll need to have discourse use the primary. When it fails you’d use dns or haproxy to switch to the secondary.

This isn’t a Discourse issue. If you want to learn how to manage redis and postgres I’m a high availability setup, you’ll need to search elsewhere.