Skip to content

Commit

Permalink
disable rabbitmq puppet module and run it manually
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Mayorga committed Aug 28, 2014
1 parent b5d2f99 commit 862811e
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 35 deletions.
8 changes: 5 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
rbs1.vm.hostname = 'rabbitmqserver1'
rbs1.vm.network :private_network, ip: '10.11.0.100'
rbs1.vm.provision :shell, path: 'scripts/initial-setup.sh'
rbs1.vm.provision :shell, path: 'scripts/install-puppet-modules.sh'
#rbs1.vm.provision :shell, path: 'scripts/install-puppet-modules.sh'
rbs1.vm.provision :shell, inline: 'echo 10.11.0.101 rabbitmqserver2 >> /etc/hosts'
rbs1.vm.provision :shell, inline: 'echo 10.11.0.102 rabbitmqserver3 >> /etc/hosts'

Expand Down Expand Up @@ -46,7 +46,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
rbs2.vm.hostname = 'rabbitmqserver2'
rbs2.vm.network :private_network, ip: '10.11.0.101'
rbs2.vm.provision :shell, path: 'scripts/initial-setup.sh'
rbs2.vm.provision :shell, path: 'scripts/install-puppet-modules.sh'
#rbs2.vm.provision :shell, path: 'scripts/install-puppet-modules.sh'
rbs2.vm.provision :shell, inline: 'echo 10.11.0.100 rabbitmqserver1 >> /etc/hosts'
rbs2.vm.provision :shell, inline: 'echo 10.11.0.102 rabbitmqserver3 >> /etc/hosts'

Expand Down Expand Up @@ -76,7 +76,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
rbs3.vm.hostname = 'rabbitmqserver3'
rbs3.vm.network :private_network, ip: '10.11.0.102'
rbs3.vm.provision :shell, path: 'scripts/initial-setup.sh'
rbs3.vm.provision :shell, path: 'scripts/install-puppet-modules.sh'
#rbs3.vm.provision :shell, path: 'scripts/install-puppet-modules.sh'
rbs3.vm.provision :shell, inline: 'echo 10.11.0.100 rabbitmqserver1 >> /etc/hosts'
rbs3.vm.provision :shell, inline: 'echo 10.11.0.101 rabbitmqserver2 >> /etc/hosts'

Expand Down Expand Up @@ -117,6 +117,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
puppet.options = '--verbose'
end

bunny.vm.provision :shell, path: 'scripts/configure-cluster.sh', privileged: false

#ubuntu.vm.provision :shell, path: 'scripts/post-puppet-provisioning.sh'

bunny.vm.provider :virtualbox do |v|
Expand Down
4 changes: 2 additions & 2 deletions manifests/site.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
}

node 'bunny1' {

node 'bunny1' inherits base {
include client
}

27 changes: 27 additions & 0 deletions modules/client/files/id_rsa
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAtMFdGYPW5QNbSBW09wiT4vGq5M2MNBPTMtXwRbi8RDI9hXGb
sxULmprMdKNA6b12ppxEsUG5tvnuuqSRdlmTN0b3VM2tGukgBpGRImpnwBTx2Ziy
nyDl/wyxMRN/0TbvPllHjUA8FxufpT/pbVD0JsF+bGLxcM+KRRJxfgA/ZjPWad0s
wIrqLXnQb6egfjEawrQvaji0E4o6LlLkIexzbs1Bse8GtFxCLA5oGvvj9pcBpCY3
EA5J6Eq4UAmZUG9bDC45/+uucl5wN+X5I+XR5+lvdAiOb26f7rfbXCoJNrEJ+qfc
cZCT9xeUpHraZRD5x0OzHVz3+GDldJ3npRhF+QIDAQABAoIBADz6YosCBBP8PuYh
lIwmE6Xi+1D22s6SxZQHwmfy+2hSPpjvC6Ste92rTUAn9vUjmox4eWAHGTzWMig6
7murqlNimHu+ayCB9vDgWMLwfJG7Px+2OMQgGBcj0/8HYf5Vdv5kphPL0LnG8uOP
nRLo1YThj+HGu0bgbPgCUdE9CiZS0v6oDkaZ0vuXrOy2O5NMmBMYYAaCfN3dIbsn
Hn2q2hBtS16Hngsl2xsXHwCcp+Vv5Zi55TEsj2SlFM5QCInYuaYMh1nzp0JsSZjD
+6jEZlLCP28J4WaMa/gpxQ6lE94mIgJjuD5r2iuDiZgEUpEQoHUjsMXQAKCv2EVN
66ISWVECgYEA58QFJmewkOLB41t/wse2ZAOU9HHQgiqXExvIUrG8BTs+IOBrlrxj
R14Q/goKPb2e3Uzf6JKsJ1GZTKO72cbKP48LgPuIAndmImcjm/V3CXKXddr/wlrL
/7UIW/qUh1kIukJlRjCkIKDM0WcDg/YJRPcK4a9yGQ82olNNJCqJEcUCgYEAx6fh
lAgZkDfBitCdFqbzMGA9DnNP5drkl0f65mtAp9+Gs3fqUlov0JyFlQzuE7xP7vpK
I+PNa2UeLUfncxJGJ2UGr3KEYUiK+ZDq4rOgD+wIdS1VoVxYlXM5flWTNW4m2EbB
HWbpx9AtCcLnScX8cgo+GWAbODM1EOAljS9XqqUCgYEAsnjVSmzAn+GuUsksCi9G
eZ/0fYSDfykS60kSqvNpCVJEloaa8xmhDd0XErlih4bUpi/DoNIJtcF1XnobdylI
p0cdIbcQVm3hfY6U8k1E3Eac8cmx99V5kDC0/jdpVwyt1ti4KiPcz69j6cD9CQpW
uv/OJlq3byqy9K9XEQmcQc0CgYEAtr3pkcWsKD1wT69L6RzcAE5F9EEFQ1yL2A/R
DS/j2QOV1hSPC9tyYl2xQtC35KZ6/0Bltd3e+kpuSYHDzaZPQeWNLe8CTczJL04+
P0ur2Ibw4tegxfWxOvFhEUogWEo/EbwJK/EzT2kyn/meGv81ZegMGMvHfjQYgR64
IDbR5eUCgYBa/zexeyiuKno9isUUEut3+OL2bamQiU9fJU8Rj4PYS5G8QKEk1zcq
B+GzMkqYr05n4vdm1MNqCuhPcGWsDpANDjXB5nB1Vf4jv1WJ684GOEWdtMzDvjAd
vaYdhH4QSKbmJF4OCUjTNc1Gms/BHmM3wFkHQ6NxFata08VZo71lkQ==
-----END RSA PRIVATE KEY-----
3 changes: 3 additions & 0 deletions modules/client/files/known_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
|1|vaC0TiLAKljuFW4Yz7OrZq7vmg0=|4OlE3iLDoOSId5Vo3YGmcxBHlq4= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFY/1P1Q/VFmHM2RIUvnPyt56R4AB6J+zOR5iy+erhwz017RC9Y2+yupoqrLQnsx955h9gxk3bk/Rf3tZKcaSgA=
|1|x/28QnMhU4gNVm9KsCpWxd2CnSA=|3OKv6wD0alQyZN9K/TlD8bmnauY= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFY/1P1Q/VFmHM2RIUvnPyt56R4AB6J+zOR5iy+erhwz017RC9Y2+yupoqrLQnsx955h9gxk3bk/Rf3tZKcaSgA=
|1|iuL87tmyWqdsdXuZTzOxjzhmoC0=|6yCHxwlrOHVirU9+nLIHBB4aG6g= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFY/1P1Q/VFmHM2RIUvnPyt56R4AB6J+zOR5iy+erhwz017RC9Y2+yupoqrLQnsx955h9gxk3bk/Rf3tZKcaSgA=
19 changes: 19 additions & 0 deletions modules/client/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#simple bunny client class
class client{

file {'/home/vagrant/.ssh/known_hosts':
ensure => present,
source => 'puppet:///modules/client/known_hosts',
mode => '0644',
}

file {'/home/vagrant/.ssh/id_rsa':
ensure => present,
source => 'puppet:///modules/client/id_rsa',
mode => '0600',
owner => 'vagrant',
group => 'vagrant',
}


}
2 changes: 2 additions & 0 deletions modules/qserver/files/authorized_keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0wV0Zg9blA1tIFbT3CJPi8arkzYw0E9My1fBFuLxEMj2FcZuzFQuamsx0o0DpvXamnESxQbm2+e66pJF2WZM3RvdUza0a6SAGkZEiamfAFPHZmLKfIOX/DLExE3/RNu8+WUeNQDwXG5+lP+ltUPQmwX5sYvFwz4pFEnF+AD9mM9Zp3SzAiuotedBvp6B+MRrCtC9qOLQTijouUuQh7HNuzUGx7wa0XEIsDmga++P2lwGkJjcQDknoSrhQCZlQb1sMLjn/665yXnA35fkj5dHn6W90CI5vbp/ut9tcKgk2sQn6p9xxkJP3F5SketplEPnHQ7MdXPf4YOV0neelGEX5 bunny ssh key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
1 change: 1 addition & 0 deletions modules/qserver/files/erlang.cookie
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LCYFNFDSMYAXKRVSAPZS
57 changes: 45 additions & 12 deletions modules/qserver/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,16 +1,49 @@
class qserver($node_name, $cluster_node_type, $cluster_nodes) {

class { 'rabbitmq':
service_manage => true,
port => '5672',
delete_guest_user => true,
environment_variables => {
'RABBITMQ_NODENAME' => $nodename,
'RABBITMQ_SERVICENAME' => 'RabbitMQ',
},
config_cluster => true,
cluster_nodes => $cluster_nodes,
cluster_node_type => $cluster_node_type,
wipe_db_on_cookie_change => true,
file {'/home/vagrant/.ssh/authorized_keys':
ensure => present,
source => 'puppet:///modules/qserver/authorized_keys',
mode => '0600',
owner => 'vagrant',
group => 'vagrant',
}

package { 'rabbitmq-server':
ensure => present,
} ->

exec { 'stop rabbitmq-server':
command => '/usr/sbin/service rabbitmq-server stop',
logoutput => true,
} ->

file { '/var/lib/rabbitmq/.erlang.cookie':
ensure => present,
source => 'puppet:///modules/qserver/erlang.cookie',
mode => '0400',
owner => 'rabbitmq',
group => 'rabbitmq',
} ->

exec { 'start rabbitmq-server':
command => '/usr/sbin/service rabbitmq-server start',
logoutput => true,
}

#class { 'rabbitmq':
# service_manage => true,
# port => '5672',
# delete_guest_user => true,
# environment_variables => {
# 'RABBITMQ_NODENAME' => $nodename,
# 'RABBITMQ_SERVICENAME' => 'RabbitMQ',
# },
# erlang_cookie => 'LCYFNFDSMYAXKRVSAPZS',
# wipe_db_on_cookie_change => true,
# config_cluster => true,
# cluster_nodes => $cluster_nodes,
# cluster_node_type => $cluster_node_type,
#}
}


15 changes: 15 additions & 0 deletions scripts/configure-cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#based on https://www.rabbitmq.com/clustering.html
#configure clustering on rbs2 (rabbitmqserver2) as --ram
ssh [email protected] 'echo vagrant | sudo rabbitmqctl stop_app'
ssh [email protected] 'echo vagrant | sudo rabbitmqctl join_cluster --ram rabbit@rabbitmqserver1'
ssh [email protected] 'echo vagrant | sudo rabbitmqctl start_app'

#configure clustering on rbs3 (rabbitmqserver3) as disc
ssh [email protected] 'echo vagrant | sudo rabbitmqctl stop_app'
ssh [email protected] 'echo vagrant | sudo rabbitmqctl join_cluster rabbit@rabbitmqserver2'
ssh [email protected] 'echo vagrant | sudo rabbitmqctl start_app'

#checking for clustering status
ssh [email protected] 'echo vagrant | sudo rabbitmqctl cluster_status'
ssh [email protected] 'echo vagrant | sudo rabbitmqctl cluster_status'
ssh [email protected] 'echo vagrant | sudo rabbitmqctl cluster_status'
4 changes: 2 additions & 2 deletions scripts/initial-setup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
echo 'updating packages no verbose'
# apt-get -y update -q=2
apt-get -y update -q=2

2 changes: 1 addition & 1 deletion scripts/install-puppet-modules.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
puppet module list | grep puppetlabs-rabbitmq

if ! [ $? -eq 0 ]; then
if ! [ $? -eq 0 ]; then
puppet module install puppetlabs-rabbitmq
fi

Expand Down
15 changes: 0 additions & 15 deletions scripts/post-puppet-provisioning.sh
Original file line number Diff line number Diff line change
@@ -1,15 +0,0 @@
#i had some errors intalling this package with puppet.
npm install -g [email protected] --loglevel error
echo '----------------------------------------'

echo 'changing permissions on gems'
chown vagrant:vagrant /home/vagrant/gems -R
echo '----------------------------------------'

echo 'installing npm local packages from packages.json'
sudo -H -u vagrant bash -c 'cd /home/vagrant/gems && npm install --loglevel error'
echo '----------------------------------------'

echo 'start server with gulp'
sudo -H -u vagrant bash -c 'cd /home/vagrant/gems && gulp serve'
echo '----------------------------------------'

0 comments on commit 862811e

Please sign in to comment.