Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Issue #5) Replace mkrakowitzer-deploy with nanliu-staging #13

Merged
merged 2 commits into from
Feb 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ fixtures:
confluence: "#{source_dir}"
repositories:
deploy: "http://github.com/mkrakowitzer/puppet-deploy"
staging: "https://github.com/nanliu/puppet-staging"
stdlib: "http://github.com/puppetlabs/puppetlabs-stdlib.git"
15 changes: 10 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
---
language: ruby
rvm:
- 1.9.3
script: "rake spec"
env:
- PUPPET_VERSION=3.4.2
bundler_args: --without system_tests
script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
matrix:
fast_finish: true
include:
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.0"
notifications:
email:
- merritt@krakowitzer.com
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rspecversion = ENV.key?('RSPEC_VERSION') ? "= #{ENV['RSPEC_VERSION']}" : ['>= 2.
gem 'rake'
gem 'puppet-lint'
gem 'rspec', rspecversion
gem 'rspec-puppet'
gem 'rspec-puppet', "1.0.1"
gem 'puppetlabs_spec_helper'
gem 'puppet', puppetversion
gem 'puppet-blacksmith'
Expand Down
6 changes: 5 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
$gid = undef,

# Misc Settings
$downloadURL = 'http://www.atlassian.com/software/confluence/downloads/binary/',
$downloadURL = 'http://www.atlassian.com/software/confluence/downloads/binary',

# Choose whether to use nanliu-staging, or mkrakowitzer-deploy
# Defaults to nanliu-staging as it is puppetlabs approved.
$staging_or_deploy = 'staging',

# Manage confluence server
$manage_service = true,
Expand Down
65 changes: 53 additions & 12 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
#
class confluence::install {

require deploy

group { $confluence::group: ensure => present, gid => $confluence::gid } ->

user { $confluence::user:
comment => 'Confluence daemon account',
shell => '/bin/true',
Expand All @@ -28,16 +27,58 @@
}
}

deploy::file { "atlassian-${confluence::product}-${confluence::version}.${confluence::format}":
target => $confluence::webappdir,
url => $confluence::downloadURL,
strip => true,
notify => Exec["chown_${confluence::webappdir}"],
owner => $confluence::user,
group => $confluence::group,
download_timout => 1800,
require => [ File[$confluence::installdir], User[$confluence::user] ],
} ->
$file = "atlassian-${confluence::product}-${confluence::version}.${confluence::format}"

if $confluence::staging_or_deploy == 'staging' {

require staging

if ! defined(File[$confluence::webappdir]) {
file { $confluence::webappdir:
ensure => 'directory',
owner => $confluence::user,
group => $confluence::group,
}
}

staging::file { $file:
source => "${confluence::downloadURL}/${file}",
timeout => 1800,
} ->

staging::extract { $file:
target => $confluence::webappdir,
creates => "${confluence::webappdir}/conf",
strip => 1,
user => $confluence::user,
group => $confluence::group,
notify => Exec["chown_${confluence::webappdir}"],
before => File[$confluence::homedir],
require => [
File[$confluence::installdir],
User[$confluence::user],
File[$confluence::webappdir] ],
}

} elsif $confluence::staging_or_deploy == 'deploy' {

require deploy

deploy::file { $file:
target => $confluence::webappdir,
url => $confluence::downloadURL,
strip => true,
download_timout => 1800,
owner => $confluence::user,
group => $confluence::group,
notify => Exec["chown_${confluence::webappdir}"],
before => File[$confluence::homedir],
require => [ File[$confluence::installdir], User[$confluence::user] ],
}

} else {
fail('staging_or_deploy must equal "staging" or "deploy"')
}

file { $confluence::homedir:
ensure => 'directory',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
describe 'confluence::install' do
context 'default params' do
let(:params) {{
:javahome => '/opt/java',
:version => '5.5.6',
:user => 'confluence',
:group => 'confluence',
:installdir => '/opt/confluence',
:homedir => '/home/confluence',
:format => 'tar.gz',
:product => 'confluence',
:downloadURL => 'http://www.atlassian.com/software/confluence/downloads/binary/',
:javahome => '/opt/java',
:version => '5.5.6',
:user => 'confluence',
:group => 'confluence',
:installdir => '/opt/confluence',
:homedir => '/home/confluence',
:format => 'tar.gz',
:product => 'confluence',
:downloadURL => 'http://www.atlassian.com/software/confluence/downloads/binary/',
:staging_or_deploy => 'deploy',
}}
it { should contain_group('confluence') }
it { should contain_user('confluence').with_shell('/bin/true') }
Expand All @@ -30,17 +31,18 @@

context 'overwriting params' do
let(:params) {{
:javahome => '/opt/java',
:version => '5.5.5',
:product => 'confluence',
:format => 'tar.gz',
:installdir => '/opt/confluence',
:homedir => '/random/homedir',
:user => 'foo',
:group => 'bar',
:uid => 333,
:gid => 444,
:downloadURL => 'http://downloads.atlassian.com/',
:javahome => '/opt/java',
:version => '5.5.5',
:product => 'confluence',
:format => 'tar.gz',
:installdir => '/opt/confluence',
:homedir => '/random/homedir',
:user => 'foo',
:group => 'bar',
:uid => 333,
:gid => 444,
:downloadURL => 'http://downloads.atlassian.com/',
:staging_or_deploy => 'deploy',
}}
it { should contain_user('foo').with({
'home' => '/random/homedir',
Expand Down
88 changes: 88 additions & 0 deletions spec/classes/confluence_install_staging_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
require 'spec_helper.rb'

describe 'confluence' do
describe 'confluence::install' do
context 'default params' do
let(:params) {{
:javahome => '/opt/java',
:version => '5.5.6',
:user => 'confluence',
:group => 'confluence',
:installdir => '/opt/confluence',
:homedir => '/home/confluence',
:format => 'tar.gz',
:product => 'confluence',
}}

it { should contain_group('confluence') }

it { should contain_user('confluence').with_shell('/bin/true') }

it 'should deploy confluence 5.5.6 from tar.gz' do
should contain_staging__file("atlassian-confluence-5.5.6.tar.gz").with({
'source' => 'http://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-5.5.6.tar.gz',
})
should contain_staging__extract("atlassian-confluence-5.5.6.tar.gz").with({
'target' => '/opt/confluence/atlassian-confluence-5.5.6',
'creates' => '/opt/confluence/atlassian-confluence-5.5.6/conf',
'strip' => '1',
'user' => 'confluence',
'group' => 'confluence',
})
end

it 'should manage the confluence home directory' do
should contain_file('/home/confluence').with({
'ensure' => 'directory',
'owner' => 'confluence',
'group' => 'confluence'
})
end
end

context 'overwriting params' do
let(:params) {{
:javahome => '/opt/java',
:version => '5.5.5',
:product => 'confluence',
:format => 'tar.gz',
:installdir => '/opt/foo/confluence',
:homedir => '/random/homedir',
:user => 'foo',
:group => 'bar',
:uid => 333,
:gid => 444,
:downloadURL => 'http://downloads.atlassian.com',
}}

it { should contain_user('foo').with({
'home' => '/random/homedir',
'shell' => '/bin/true',
'uid' => 333,
'gid' => 444
})}

it { should contain_group('bar') }

it 'should deploy confluence 5.5.5 from tar.gz' do
should contain_staging__file("atlassian-confluence-5.5.5.tar.gz").with({
'source' => 'http://downloads.atlassian.com/atlassian-confluence-5.5.5.tar.gz',
})
should contain_staging__extract("atlassian-confluence-5.5.5.tar.gz").with({
'target' => '/opt/foo/confluence/atlassian-confluence-5.5.5',
'creates' => '/opt/foo/confluence/atlassian-confluence-5.5.5/conf',
'strip' => '1',
'user' => 'foo',
'group' => 'bar',
})
end
it 'should manage the confluence home directory' do
should contain_file('/random/homedir').with({
'ensure' => 'directory',
'owner' => 'foo',
'group' => 'bar'
})
end
end
end
end
3 changes: 0 additions & 3 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'beaker-rspec/spec_helper'
require 'beaker-rspec/helpers/serverspec'

proxyurl = ENV['http_proxy'] if ENV['http_proxy']

unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
hosts.each do |host|
foss_opts = { :default_action => 'gem_install' }
Expand Down Expand Up @@ -39,7 +37,6 @@
end
on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-postgresql'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','yguenane-repoforge'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','mkrakowitzer-deploy'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-java'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','nanliu-staging'), { :acceptable_exit_codes => [0,1] }
Expand Down