Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Provide a Vagrant setup for the server components
Browse files Browse the repository at this point in the history
  • Loading branch information
craigw committed Oct 2, 2011
1 parent a675ea6 commit 66b668e
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
constable-*.gem
.vagrant
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
source :gemcutter

gem 'stomp'

group :example do
gem 'vagrant'
end
21 changes: 21 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
GEM
remote: http://rubygems.org/
specs:
archive-tar-minitar (0.5.2)
erubis (2.7.0)
ffi (1.0.9)
i18n (0.6.0)
json (1.5.4)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-ssh (2.1.4)
stomp (1.1.9)
thor (0.14.6)
vagrant (0.8.7)
archive-tar-minitar (= 0.5.2)
erubis (~> 2.7.0)
i18n (~> 0.6.0)
json (~> 1.5.1)
net-scp (~> 1.0.4)
net-ssh (~> 2.1.4)
thor (~> 0.14.6)
virtualbox (~> 0.9.1)
virtualbox (0.9.2)
ffi (~> 1.0.9)

PLATFORMS
ruby

DEPENDENCIES
stomp
vagrant
13 changes: 13 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Vagrant::Config.run do |config|
config.vm.box = "lucid32"
config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
config.vm.network "33.33.33.10"
config.vm.forward_port "stomp", 61613, 61613

config.vm.share_folder "gem-source", "/usr/local/src/constable", "."

config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "imagemagick.pp"
end
end
69 changes: 69 additions & 0 deletions puppet/manifests/apollo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and
limitations under the License.
-->

<!--
For more information on how configure this file please
reference:
http://activemq.apache.org/apollo/versions/1.0-beta5/website/documentation/user-manual.html
-->
<broker xmlns="http://activemq.apache.org/schema/activemq/apollo">

<notes>
The default configuration with tls/ssl enabled.
</notes>

<log_category console="console" security="security" connection="connection" audit="audit"/>


<authentication domain="apollo"/>
<!-- Give admins full access -->
<access_rule allow="admins" action="*"/>
<access_rule allow="*" action="connect" kind="connector"/>


<virtual_host id="broker">
<!--
You should add all the host names that this virtual host is known as
to properly support the STOMP 1.1 virtual host feature.
-->
<host_name>broker</host_name>
<host_name>localhost</host_name>
<host_name>127.0.0.1</host_name>

<!-- Uncomment to disable security for the virtual host -->
<authentication enabled="false"/>

<!-- Uncomment to disable security for the virtual host -->
<!-- <authentication enabled="false"/> -->
<access_rule allow="users" action="connect create destroy send receive consume"/>


<!-- You can delete this element if you want to disable persistence for this virtual host -->
<jdbm2_store directory="${apollo.base}/data"/>


</virtual_host>

<web_admin bind="http://127.0.0.1:61680"/>
<web_admin bind="https://127.0.0.1:61681"/>

<connector id="tcp" bind="tcp://0.0.0.0:61613" connection_limit="2000"/>
<connector id="tls" bind="tls://0.0.0.0:61614" connection_limit="2000"/>

<key_storage file="${apollo.base}/etc/keystore" password="password" key_password="password"/>

</broker>
106 changes: 106 additions & 0 deletions puppet/manifests/imagemagick.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
node default {
exec { '/usr/bin/apt-get update': }

group { 'puppet': ensure => present }

package {
'imagemagick': ensure => installed,
require => Exec['/usr/bin/apt-get update'];
'curl': ensure => installed,
require => Exec['/usr/bin/apt-get update'];
'openjdk-6-jre': ensure => installed,
require => Exec['/usr/bin/apt-get update'];
'build-essential': ensure => installed,
require => Exec['/usr/bin/apt-get update'];
'libssl-dev': ensure => installed,
require => Exec['/usr/bin/apt-get update'];
'libreadline5-dev': ensure => installed,
require => Exec['/usr/bin/apt-get update'];
'zlib1g-dev': ensure => installed,
require => Exec['/usr/bin/apt-get update'];
'libsqlite3-dev': ensure => installed,
require => Exec['/usr/bin/apt-get update'];
}

exec { 'download apollo':
command => "/usr/bin/curl -O http://apache.mirrors.timporter.net/activemq/activemq-apollo/1.0-beta5/apache-apollo-1.0-beta5-unix-distro.tar.gz",
cwd => "/tmp",
creates => "/tmp/apache-apollo-1.0-beta5-unix-distro.tar.gz",
require => Package['curl']
}

exec { 'unpack apollo':
require => Exec['download apollo'],
creates => "/tmp/apache-apollo-1.0-beta5",
cwd => "/tmp",
command => "/bin/tar -xzf ./apache-apollo-1.0-beta5-unix-distro.tar.gz"
}

exec { 'create broker':
require => [ Exec['unpack apollo'], Package['openjdk-6-jre'] ],
creates => '/tmp/broker',
cwd => "/tmp/apache-apollo-1.0-beta5",
command => "/tmp/apache-apollo-1.0-beta5/bin/apollo create /tmp/broker"
}

file { '/etc/init.d/broker':
ensure => link,
target => '/tmp/broker/bin/apollo-broker-service',
require => Exec['create broker']
}

file { '/tmp/broker/etc/apollo.xml':
source => '/tmp/vagrant-puppet/manifests/apollo.xml',
ensure => present,
require => Exec['create broker']
}

service { 'broker':
provider => base,
ensure => running,
start => '/etc/init.d/broker start && sleep 5',
pattern => 'apollo',
require => [ File['/etc/init.d/broker'], File['/tmp/broker/etc/apollo.xml'] ]
}

exec { 'download Ruby':
command => "/usr/bin/curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz",
creates => "/tmp/ruby-1.9.2-p290.tar.gz",
cwd => "/tmp",
require => Package["curl"]
}

exec { 'unpack Ruby':
command => "/bin/tar -xzf ./ruby-1.9.2-p290.tar.gz",
creates => "/tmp/ruby-1.9.2-p290",
cwd => "/tmp",
require => Exec['download Ruby']
}

exec { 'install Ruby':
command => "/tmp/ruby-1.9.2-p290/configure --prefix=/usr && make && make install",
cwd => "/tmp/ruby-1.9.2-p290",
refreshonly => true,
subscribe => Exec['unpack Ruby'],
path => [ ".", "/usr/bin", "/bin" ]
}

package { 'bundler':
provider => gem,
ensure => installed,
require => Exec['install Ruby']
}

exec { 'bundle gems':
cwd => '/usr/local/src/constable',
command => '/usr/bin/bundle',
require => Package['bundler']
}

service { 'constabled':
provider => base,
ensure => running,
start => 'cd /usr/local/src/constable && nohup bundle exec /usr/local/src/constable/bin/constabled >/tmp/constabled.log 2>/tmp/constabled.err &',
require => [ Service['broker'], Exec['bundle gems'], Package['imagemagick'] ]
}
}

0 comments on commit 66b668e

Please sign in to comment.