Skip to content

Commit

Permalink
Vagrant VM : move httpd to port 5040, both in the VM and outside
Browse files Browse the repository at this point in the history
  • Loading branch information
rombert committed Jan 11, 2014
1 parent fd20cbd commit 58445a1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
6 changes: 2 additions & 4 deletions testing/vms/Vagrantfile
Expand Up @@ -5,6 +5,7 @@
VAGRANTFILE_API_VERSION = "2"

# NOTE - you need to install
# - http://forge.puppetlabs.com/puppetlabs/stdlib
# - https://forge.puppetlabs.com/puppetlabs/mysql
# - https://forge.puppetlabs.com/spiette/selinux
#
Expand All @@ -19,10 +20,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# doesn't already exist on the user's system.
config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210.box"

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network :forwarded_port, guest: 80, host: 8082
config.vm.network :forwarded_port, guest: 5040, host: 5040

config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
Expand Down
7 changes: 7 additions & 0 deletions testing/vms/modules/reviewboard/files/httpd-firewalld.xml
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>WWW (HTTP)</short>
<description>HTTP is the protocol used to serve Web pages. If you plan to make your Web server publicly available, enable this option. This option is not required for viewing pages locally or developing Web pages.</description>
<port protocol="tcp" port="80"/>
<port protocol="tcp" port="5040"/>
</service>
14 changes: 13 additions & 1 deletion testing/vms/modules/reviewboard/manifests/init.pp
Expand Up @@ -21,14 +21,26 @@
ensure => installed
}

file {'/usr/lib/firewalld/services/http.xml':
ensure => present,
source => 'puppet:///modules/reviewboard/httpd-firewalld.xml'
}

exec {'enable http in firewall':
command => 'firewall-cmd --add-service=http',
unless => 'firewall-cmd --query-service=http',
user => 'root',
path => ['/bin','/usr/bin'],
require => Package['httpd']
require => [Package['httpd'], File['/usr/lib/firewalld/services/http.xml']]
}

file_line {'httpd port is 5040':
ensure => present,
line => 'Listen 5040',
match => '^Listen .*$',
path => '/etc/httpd/conf/httpd.conf',
require => Package['httpd']
}

# Install and configure reviewboard
exec {'rb-site':
Expand Down
4 changes: 2 additions & 2 deletions testing/vms/modules/reviewboard/manifests/subversion.pp
@@ -1,9 +1,9 @@
class reviewboard::subversion {

exec {'add svn repo':
command => 'curl -s -u admin:admin --data "name=Local%20SVN&path=http://localhost/svn/repo&tool=Subversion&username=admin&password=admin" http://localhost/api/repositories/',
command => 'curl -s -u admin:admin --data "name=Local%20SVN&path=http://localhost:5040/svn/repo&tool=Subversion&username=admin&password=admin" http://localhost:5040/api/repositories/',
path => '/usr/bin',
unless => 'curl -s http://localhost/api/repositories/ | grep -q http://localhost/svn/repo',
unless => 'curl -s http://localhost:5040/api/repositories/ | grep -q http://localhost:5040/svn/repo',
require => [Class['reviewboard'], Class['subversion::httpd']],
logoutput => 'on_failure',
}
Expand Down
4 changes: 2 additions & 2 deletions testing/vms/modules/subversion/manifests/httpd.pp
Expand Up @@ -21,8 +21,8 @@
}

exec{'import initial repo content':
command => 'svn import -m "Initial import" --username admin --password admin --non-interactive /tmp/repo http://localhost/svn/repo',
unless => 'svn ls --username admin --password admin http://localhost/svn/repo | grep -q simple-project',
command => 'svn import -m "Initial import" --username admin --password admin --non-interactive /tmp/repo http://localhost:5040/svn/repo',
unless => 'svn ls --username admin --password admin http://localhost:5040/svn/repo | grep -q simple-project',
path => '/usr/bin',
require => [File['/tmp/repo'], Service['httpd']],
logoutput => 'on_failure'
Expand Down

0 comments on commit 58445a1

Please sign in to comment.