mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	postgresql: Decouple wal_g from streaming replication.
Streaming replication may be used even if `wal-g` is not -- as long as the user can move a copy of the base backup to the replica (e.g. using `pg_basebackup`). Remove the warning about this combination, and move the `primary_conninfo` setting outside of the `s3_backups_bucket` check.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							c5fe866297
						
					
				
				
					commit
					eb202446f8
				
			@@ -55,13 +55,6 @@ class zulip::profile::postgresql {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if $replication_primary != undef and $replication_user != undef {
 | 
			
		||||
    if $s3_backups_bucket == '' {
 | 
			
		||||
      $message = @(EOT/L)
 | 
			
		||||
          Replication is enabled, but s3_backups_bucket is not set in zulip-secrets.conf!  \
 | 
			
		||||
          Streaming replication requires wal-g backups be configured.
 | 
			
		||||
          |-EOT
 | 
			
		||||
      warning($message)
 | 
			
		||||
    }
 | 
			
		||||
    # The presence of a standby.signal file triggers replication
 | 
			
		||||
    file { "${zulip::postgresql_base::postgresql_datadir}/standby.signal":
 | 
			
		||||
      ensure  => file,
 | 
			
		||||
 
 | 
			
		||||
@@ -788,17 +788,18 @@ listen_addresses = <%= @listen_addresses %>
 | 
			
		||||
<% end -%>
 | 
			
		||||
 | 
			
		||||
<% if @s3_backups_bucket != '' -%>
 | 
			
		||||
# Streaming backups and replication
 | 
			
		||||
# WAL backups to S3 (may also be used for replication)
 | 
			
		||||
archive_mode = on
 | 
			
		||||
archive_command = '/usr/bin/timeout 10m /usr/local/bin/env-wal-g wal-push %p'
 | 
			
		||||
restore_command = '/usr/local/bin/env-wal-g wal-fetch "%f" "%p"'
 | 
			
		||||
<% end -%>
 | 
			
		||||
<% unless @replication_primary.nil? || @replication_user.nil? -%>
 | 
			
		||||
# Streaming replication
 | 
			
		||||
primary_conninfo = 'host=<%= @replication_primary %> user=<%= @replication_user -%>
 | 
			
		||||
<% if @replication_password != '' %> password=<%= @replication_password %><% end -%>
 | 
			
		||||
<% unless @ssl_mode.nil? %> sslmode=<%= @ssl_mode %><% end -%>
 | 
			
		||||
'
 | 
			
		||||
<% end -%>
 | 
			
		||||
<% end -%>
 | 
			
		||||
 | 
			
		||||
<% unless @ssl_cert_file.nil? -%>
 | 
			
		||||
ssl_cert_file = '<%= @ssl_cert_file %>'		# (change requires restart)
 | 
			
		||||
 
 | 
			
		||||
@@ -819,17 +819,18 @@ listen_addresses = <%= @listen_addresses %>
 | 
			
		||||
<% end -%>
 | 
			
		||||
 | 
			
		||||
<% if @s3_backups_bucket != '' -%>
 | 
			
		||||
# Streaming backups and replication
 | 
			
		||||
# WAL backups to S3 (may also be used for replication)
 | 
			
		||||
archive_mode = on
 | 
			
		||||
archive_command = '/usr/bin/timeout 10m /usr/local/bin/env-wal-g wal-push %p'
 | 
			
		||||
restore_command = '/usr/local/bin/env-wal-g wal-fetch "%f" "%p"'
 | 
			
		||||
<% end -%>
 | 
			
		||||
<% unless @replication_primary.nil? || @replication_user.nil? -%>
 | 
			
		||||
# Streaming replication
 | 
			
		||||
primary_conninfo = 'host=<%= @replication_primary %> user=<%= @replication_user -%>
 | 
			
		||||
<% if @replication_password != '' %> password=<%= @replication_password %><% end -%>
 | 
			
		||||
<% unless @ssl_mode.nil? %> sslmode=<%= @ssl_mode %><% end -%>
 | 
			
		||||
'
 | 
			
		||||
<% end -%>
 | 
			
		||||
<% end -%>
 | 
			
		||||
 | 
			
		||||
<% unless @ssl_cert_file.nil? -%>
 | 
			
		||||
ssl_cert_file = '<%= @ssl_cert_file %>'		# (change requires restart)
 | 
			
		||||
 
 | 
			
		||||
@@ -840,17 +840,18 @@ listen_addresses = <%= @listen_addresses %>
 | 
			
		||||
<% end -%>
 | 
			
		||||
 | 
			
		||||
<% if @s3_backups_bucket != '' -%>
 | 
			
		||||
# Streaming backups and replication
 | 
			
		||||
# WAL backups to S3 (may also be used for replication)
 | 
			
		||||
archive_mode = on
 | 
			
		||||
archive_command = '/usr/bin/timeout 10m /usr/local/bin/env-wal-g wal-push %p'
 | 
			
		||||
restore_command = '/usr/local/bin/env-wal-g wal-fetch "%f" "%p"'
 | 
			
		||||
<% end -%>
 | 
			
		||||
<% unless @replication_primary.nil? || @replication_user.nil? -%>
 | 
			
		||||
# Streaming replication
 | 
			
		||||
primary_conninfo = 'host=<%= @replication_primary %> user=<%= @replication_user -%>
 | 
			
		||||
<% if @replication_password != '' %> password=<%= @replication_password %><% end -%>
 | 
			
		||||
<% unless @ssl_mode.nil? %> sslmode=<%= @ssl_mode %><% end -%>
 | 
			
		||||
'
 | 
			
		||||
<% end -%>
 | 
			
		||||
<% end -%>
 | 
			
		||||
 | 
			
		||||
<% unless @ssl_cert_file.nil? -%>
 | 
			
		||||
ssl_cert_file = '<%= @ssl_cert_file %>'		# (change requires restart)
 | 
			
		||||
 
 | 
			
		||||
@@ -40,17 +40,18 @@ effective_io_concurrency = <%= @effective_io_concurrency %>
 | 
			
		||||
<% end -%>
 | 
			
		||||
 | 
			
		||||
<% if @s3_backups_bucket != '' -%>
 | 
			
		||||
# Streaming backups and replication
 | 
			
		||||
# WAL backups to S3 (may also be used for replication)
 | 
			
		||||
archive_mode = on
 | 
			
		||||
archive_command = '/usr/bin/timeout 10m /usr/local/bin/env-wal-g wal-push %p'
 | 
			
		||||
restore_command = '/usr/local/bin/env-wal-g wal-fetch "%f" "%p"'
 | 
			
		||||
<% end -%>
 | 
			
		||||
<% unless @replication_primary.nil? || @replication_user.nil? -%>
 | 
			
		||||
# Streaming replication
 | 
			
		||||
primary_conninfo = 'host=<%= @replication_primary %> user=<%= @replication_user -%>
 | 
			
		||||
<% if @replication_password != '' %> password=<%= @replication_password %><% end -%>
 | 
			
		||||
<% unless @ssl_mode.nil? %> sslmode=<%= @ssl_mode %><% end -%>
 | 
			
		||||
'
 | 
			
		||||
<% end -%>
 | 
			
		||||
<% end -%>
 | 
			
		||||
 | 
			
		||||
<% unless @ssl_cert_file.nil? -%>
 | 
			
		||||
ssl_cert_file = '<%= @ssl_cert_file %>'		# (change requires restart)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user