Resource error reconfiguring a Geo secondary
Seen while demoing, the secondary outputs this error:
Recipe: gitlab::postgresql
* template[/opt/gitlab/etc/gitlab-psql-rc] action create (up to date)
* postgresql_user[gitlab] action create
* execute[create gitlab postgresql user] action run (skipped due to not_if)
* execute[set password for gitlab postgresql user] action run (skipped due to not_if)
(up to date)
* execute[create gitlabhq_production database] action run (skipped due to not_if)
* postgresql_user[gitlab_replicator] action create
* execute[create gitlab_replicator postgresql user] action run (skipped due to not_if)
* execute[set password for gitlab_replicator postgresql user] action run
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
[execute] ERROR: cannot execute ALTER ROLE in a read-only transaction
================================================================================
Error executing action `run` on resource 'execute[set password for gitlab_replicator postgresql user]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/bin/gitlab-psql -d template1 -c "ALTER USER \"gitlab_replicator\" replication" ----
STDOUT:
STDERR: ERROR: cannot execute ALTER ROLE in a read-only transaction
---- End output of /opt/gitlab/bin/gitlab-psql -d template1 -c "ALTER USER \"gitlab_replicator\" replication" ----
Ran /opt/gitlab/bin/gitlab-psql -d template1 -c "ALTER USER \"gitlab_replicator\" replication" returned 1
Resource Declaration:
---------------------
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/postgresql_user.rb
24: execute "set password for #{username} postgresql user" do
25: command %(/opt/gitlab/bin/#{helper.service_cmd} -d template1 -c "#{query}")
26: user account_helper.postgresql_user
27: # Added retries to give the service time to start on slower systems
28: retries 20
29: not_if { !helper.is_running? || !helper.user_exists?(username) || helper.user_password_match?(username, password) }
30: end
31: end
Compiled Resource:
------------------
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/postgresql_user.rb:24:in `block in class_from_file'
execute("set password for gitlab_replicator postgresql user") do
action [:run]
retries 20
retry_delay 2
default_guard_interpreter :execute
command "/opt/gitlab/bin/gitlab-psql -d template1 -c \"ALTER USER \\\"gitlab_replicator\\\" replication\""
backup 5
returns 0
user "gitlab-psql"
declared_type :execute
cookbook_name "gitlab"
not_if { #code block }
end
Platform:
---------
x86_64-linux
================================================================================
Error executing action `create` on resource 'postgresql_user[gitlab_replicator]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
execute[set password for gitlab_replicator postgresql user] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/postgresql_user.rb line 24) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/bin/gitlab-psql -d template1 -c "ALTER USER \"gitlab_replicator\" replication" ----
STDOUT:
STDERR: ERROR: cannot execute ALTER ROLE in a read-only transaction
---- End output of /opt/gitlab/bin/gitlab-psql -d template1 -c "ALTER USER \"gitlab_replicator\" replication" ----
Ran /opt/gitlab/bin/gitlab-psql -d template1 -c "ALTER USER \"gitlab_replicator\" replication" returned 1
It doesn't prevent the secondary from completing, but it isn't pretty.
gitlab.rb contains defaults except for:
nginx['custom_gitlab_server_config'] = 'location /.well-known/acme-challenge { alias /var/lib/dehydrated/acme-challenges; }'
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = '/var/lib/dehydrated/certs/secondary/fullchain.pem'
nginx['ssl_certificate_key'] = '/var/lib/dehydrated/certs/secondary/privkey.pem'
geo_secondary_role['enable'] = true