mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	travis: Remove rabbitmq nodename dependency on hostname.
Because rabbitmq doesn't support changing the nodename of a running rabbitmq node, Zulip installations suffered a plague of issues where e.g. a Zulip server would reboot, the hostname would change, and suddenly the local rabbitmq instance being used by Zulip would stop working. We address this problem by using, by default, a fixed rabbitmq nodename, but providing server administrators the option to set the rabbitmq nodename used by Zulip however they choose. To upgrade an existing server to use this new configuration, one will need to add something like the following to /etc/zulip/zulip.conf: [rabbitmq] nodename = zulip@localhost However, I don't believe we have the puppet code in place to make this work correctly at initial installation without rabbitmq-server being already installed (but off), as we can easily setup in Travis CI but I haven't been willing to do for the installer. So for now, this just fixes our Travis CI problems. Fixes: #1579.
This commit is contained in:
		@@ -40,6 +40,18 @@ class zulip::rabbit {
 | 
				
			|||||||
    source => "puppet:///modules/zulip/rabbitmq/rabbitmq.config",
 | 
					    source => "puppet:///modules/zulip/rabbitmq/rabbitmq.config",
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  $rabbitmq_nodename = zulipconf("rabbitmq", "nodename", "")
 | 
				
			||||||
 | 
					  if $rabbitmq_nodename != "" {
 | 
				
			||||||
 | 
					    file { "/etc/rabbitmq/rabbitmq-env.conf":
 | 
				
			||||||
 | 
					      require => Package[rabbitmq-server],
 | 
				
			||||||
 | 
					      before => Service[rabbitmq-server],
 | 
				
			||||||
 | 
					      ensure => file,
 | 
				
			||||||
 | 
					      owner  => "root",
 | 
				
			||||||
 | 
					      group  => "root",
 | 
				
			||||||
 | 
					      mode => 644,
 | 
				
			||||||
 | 
					      content => template("zulip/rabbitmq-env.conf.template.erb"),
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  # epmd doesn't have an init script, so we just check if it is
 | 
					  # epmd doesn't have an init script, so we just check if it is
 | 
				
			||||||
  # running, and if it isn't, start it.  Even in case of a race, this
 | 
					  # running, and if it isn't, start it.  Even in case of a race, this
 | 
				
			||||||
  # won't leak epmd processes, because epmd checks if one is already
 | 
					  # won't leak epmd processes, because epmd checks if one is already
 | 
				
			||||||
@@ -53,7 +65,9 @@ class zulip::rabbit {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  service { "rabbitmq-server":
 | 
					  service { "rabbitmq-server":
 | 
				
			||||||
    ensure => running,
 | 
					    ensure => running,
 | 
				
			||||||
    require => Exec["epmd"],
 | 
					    require => [Exec["epmd"],
 | 
				
			||||||
 | 
					                File["/etc/rabbitmq/rabbitmq.config"],
 | 
				
			||||||
 | 
					                File["/etc/default/rabbitmq-server"]],
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # TODO: Should also call exactly once "configure-rabbitmq"
 | 
					  # TODO: Should also call exactly once "configure-rabbitmq"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								puppet/zulip/templates/rabbitmq-env.conf.template.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								puppet/zulip/templates/rabbitmq-env.conf.template.erb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					# Defaults to rabbit. This can be useful if you want to run more than one node
 | 
				
			||||||
 | 
					# per machine - RABBITMQ_NODENAME should be unique per erlang-node-and-machine
 | 
				
			||||||
 | 
					# combination. See the clustering on a single machine guide for details:
 | 
				
			||||||
 | 
					# http://www.rabbitmq.com/clustering.html#single-machine
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# By default, we set nodename to rabbit@localhost so it will always resolve
 | 
				
			||||||
 | 
					<% if @rabbitmq_nodename != '' -%>
 | 
				
			||||||
 | 
					NODENAME=<%= @rabbitmq_nodename %>
 | 
				
			||||||
 | 
					<% else -%>
 | 
				
			||||||
 | 
					NODENAME=rabbit
 | 
				
			||||||
 | 
					<% end -%>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# By default RabbitMQ will bind to all interfaces, on IPv4 and IPv6 if
 | 
				
			||||||
 | 
					# available. Set this if you only want to bind to one network interface or#
 | 
				
			||||||
 | 
					# address family.
 | 
				
			||||||
 | 
					#NODE_IP_ADDRESS=127.0.0.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Defaults to 5672.
 | 
				
			||||||
 | 
					#NODE_PORT=5672
 | 
				
			||||||
@@ -28,7 +28,12 @@ fi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# puppet apply
 | 
					# puppet apply
 | 
				
			||||||
mkdir -p /etc/zulip
 | 
					mkdir -p /etc/zulip
 | 
				
			||||||
echo -e "[machine]\npuppet_classes = $PUPPET_CLASSES\ndeploy_type = $DEPLOYMENT_TYPE" > /etc/zulip/zulip.conf
 | 
					(
 | 
				
			||||||
 | 
					    echo -e "[machine]\npuppet_classes = $PUPPET_CLASSES\ndeploy_type = $DEPLOYMENT_TYPE";
 | 
				
			||||||
 | 
					    if [ -n "$TRAVIS" ]; then
 | 
				
			||||||
 | 
					        echo -e "\n[rabbitmq]\nnodename = zulip@localhost"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					) > /etc/zulip/zulip.conf
 | 
				
			||||||
/root/zulip/scripts/zulip-puppet-apply -f
 | 
					/root/zulip/scripts/zulip-puppet-apply -f
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Detect which features were selected for the below
 | 
					# Detect which features were selected for the below
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,11 @@ apt-mark hold initramfs-tools initramfs-tools-bin oracle-java8-installer udev li
 | 
				
			|||||||
apt-mark hold apport apt apt-transport-https apt-utils bash-completion bind9-host binutils binutils-doc bsdutils bzr cloud-guest-utils cloud-init coreutils cpio dnsutils docker-engine dosfstools dpkg dpkg-dev e2fslibs e2fsprogs firefox-locale-pt gcc-4.9-base git-core grub-common grub-pc grub-pc-bin grub2-common icedtea-6-plugin icedtea-7-plugin icedtea-netx icedtea-netx-common ifupdown imagemagick imagemagick-common initscripts irqbalance isc-dhcp-client isc-dhcp-common klibc-utils kpartx krb5-locales krb5-multidev libapt-inst1.5 libapt-pkg4.12 libarchive13 libbind9-90 libblkid1 libc-bin libcgmanager0 libcups2 libcupsfilters1 libcupsimage2 libcurl3-gnutls libcurl4-gnutls-dev libdns100 libdpkg-perl libdrm-dev libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libexpat1 libexpat1-dev libfreexl1 libgcc1 libgcrypt11 libgcrypt11-dev libgd3 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgnutls-dev libgnutls-openssl27 libgnutls26 libgnutlsxx27 libgraphite2-3 libgssapi-krb5-2 libgssrpc4 libgstreamer-plugins-base1.0-0 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libgudev-1.0-0 libisc95 libisccc90 libisccfg90 libjasper-dev libjasper1 libk5crypto3 libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-7 libklibc libkrb5-3 libkrb5-dev libkrb5support0 liblcms2-2 liblcms2-dev liblwres90 liblxc1 libmagickcore-dev libmagickcore5 libmagickcore5-extra libmagickwand-dev libmagickwand5 libmount1 libmysqlclient-dev libmysqlclient18 libnettle4 libnl-3-200 libnl-genl-3-200 libnspr4 libnss3 libnss3-nssdb libnuma1 libpam-modules libpam-modules-bin libpam-runtime libpam-systemd libpam0g libpam0g-dev libpci3 libpcre3 libpcre3-dev libpcrecpp0 libpixman-1-0 libpixman-1-dev libpng12-0 libpng12-dev libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libpoppler44 libpython3.4 libpython3.4-dev libpython3.4-minimal libpython3.4-stdlib libsndfile1 libss2 libssl-dev libssl-doc libssl1.0.0 libsystemd-daemon0 libsystemd-login0 libtasn1-6 libtasn1-6-dev libtdb1 libtiff5 libtiff5-dev libtiffxx5 libuuid1 libxerces-c3.1 libxml2 libxml2-dev linux-libc-dev login lsb-base lshw lxc lxc-templates mesa-common-dev mount multiarch-support mysql-client mysql-client-5.5 mysql-client-core-5.5 mysql-common ntpdate openjdk-6-jre-lib openssh-client openssh-server openssh-sftp-server os-prober passwd pciutils perl perl-base perl-modules policykit-1 pollinate postgresql-9.1-postgis-scripts postgresql-9.2-postgis-scripts postgresql-client postgresql-client-9.1 postgresql-client-9.2 postgresql-client-9.4 postgresql-client-common postgresql-common python-apt python-apt-common python-bzrlib python-urllib3 python3-apport python3-apt python3-distupgrade python3-gdbm python3-lxc python3-problem-report python3-software-properties python3-update-manager python3.4 python3.4-dev python3.4-minimal rsync scons software-properties-common systemd-services sysv-rc sysvinit-utils tzdata tzdata-java ubuntu-release-upgrader-core uidmap unattended-upgrades unzip update-manager-core usbutils util-linux uuid-runtime
 | 
					apt-mark hold apport apt apt-transport-https apt-utils bash-completion bind9-host binutils binutils-doc bsdutils bzr cloud-guest-utils cloud-init coreutils cpio dnsutils docker-engine dosfstools dpkg dpkg-dev e2fslibs e2fsprogs firefox-locale-pt gcc-4.9-base git-core grub-common grub-pc grub-pc-bin grub2-common icedtea-6-plugin icedtea-7-plugin icedtea-netx icedtea-netx-common ifupdown imagemagick imagemagick-common initscripts irqbalance isc-dhcp-client isc-dhcp-common klibc-utils kpartx krb5-locales krb5-multidev libapt-inst1.5 libapt-pkg4.12 libarchive13 libbind9-90 libblkid1 libc-bin libcgmanager0 libcups2 libcupsfilters1 libcupsimage2 libcurl3-gnutls libcurl4-gnutls-dev libdns100 libdpkg-perl libdrm-dev libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libexpat1 libexpat1-dev libfreexl1 libgcc1 libgcrypt11 libgcrypt11-dev libgd3 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgnutls-dev libgnutls-openssl27 libgnutls26 libgnutlsxx27 libgraphite2-3 libgssapi-krb5-2 libgssrpc4 libgstreamer-plugins-base1.0-0 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libgudev-1.0-0 libisc95 libisccc90 libisccfg90 libjasper-dev libjasper1 libk5crypto3 libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-7 libklibc libkrb5-3 libkrb5-dev libkrb5support0 liblcms2-2 liblcms2-dev liblwres90 liblxc1 libmagickcore-dev libmagickcore5 libmagickcore5-extra libmagickwand-dev libmagickwand5 libmount1 libmysqlclient-dev libmysqlclient18 libnettle4 libnl-3-200 libnl-genl-3-200 libnspr4 libnss3 libnss3-nssdb libnuma1 libpam-modules libpam-modules-bin libpam-runtime libpam-systemd libpam0g libpam0g-dev libpci3 libpcre3 libpcre3-dev libpcrecpp0 libpixman-1-0 libpixman-1-dev libpng12-0 libpng12-dev libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libpoppler44 libpython3.4 libpython3.4-dev libpython3.4-minimal libpython3.4-stdlib libsndfile1 libss2 libssl-dev libssl-doc libssl1.0.0 libsystemd-daemon0 libsystemd-login0 libtasn1-6 libtasn1-6-dev libtdb1 libtiff5 libtiff5-dev libtiffxx5 libuuid1 libxerces-c3.1 libxml2 libxml2-dev linux-libc-dev login lsb-base lshw lxc lxc-templates mesa-common-dev mount multiarch-support mysql-client mysql-client-5.5 mysql-client-core-5.5 mysql-common ntpdate openjdk-6-jre-lib openssh-client openssh-server openssh-sftp-server os-prober passwd pciutils perl perl-base perl-modules policykit-1 pollinate postgresql-9.1-postgis-scripts postgresql-9.2-postgis-scripts postgresql-client postgresql-client-9.1 postgresql-client-9.2 postgresql-client-9.4 postgresql-client-common postgresql-common python-apt python-apt-common python-bzrlib python-urllib3 python3-apport python3-apt python3-distupgrade python3-gdbm python3-lxc python3-problem-report python3-software-properties python3-update-manager python3.4 python3.4-dev python3.4-minimal rsync scons software-properties-common systemd-services sysv-rc sysvinit-utils tzdata tzdata-java ubuntu-release-upgrader-core uidmap unattended-upgrades unzip update-manager-core usbutils util-linux uuid-runtime
 | 
				
			||||||
 | 
					
 | 
				
			||||||
apt-get dist-upgrade -y $APT_OPTIONS
 | 
					apt-get dist-upgrade -y $APT_OPTIONS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Disable existing rabbitmq node so we can change it
 | 
				
			||||||
 | 
					service rabbitmq-server stop
 | 
				
			||||||
 | 
					rm -rf /var/lib/rabbitmq/mnesia/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Install Zulip
 | 
					# Install Zulip
 | 
				
			||||||
env TRAVIS=1 /root/zulip/scripts/setup/install
 | 
					env TRAVIS=1 /root/zulip/scripts/setup/install
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user