Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.
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
7 changes: 3 additions & 4 deletions .kitchen.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ platforms:
disable_upstart: false
run_command: /sbin/init
provision_command:
- /usr/bin/apt-get update
- /usr/bin/apt-get install -y apt-transport-https net-tools initscripts
- name: centos-7.2
- /usr/bin/apt-get update && /usr/bin/apt-get install -y apt-transport-https net-tools initscripts libpq5 libpq-dev
- name: centos-7.5
driver:
image: centos:7
platform: rhel
run_command: /usr/lib/systemd/systemd
provision_command:
- /bin/yum install -y initscripts net-tools wget logrotate
- /bin/yum install -y initscripts net-tools wget logrotate postgresql-libs

suites:
- name: default
Expand Down
2 changes: 1 addition & 1 deletion .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ verifier:

platforms:
- name: ubuntu-14.04
- name: centos-7.2
- name: centos-7.5

suites:
- name: default
Expand Down
12 changes: 4 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
sudo: required
services: docker

addons:
apt:
sources:
- chef-stable-precise
packages:
- chefdk

# Don't `bundle install`
install: echo "skip bundle install"

Expand All @@ -20,11 +13,14 @@ env:
matrix:
- SUITE=default
- SUITE=integration:kitchen:default-ubuntu-1404
- SUITE=integration:kitchen:default-centos-72
- SUITE=integration:kitchen:default-centos-75

before_script:
# https://github.com/zuazo/kitchen-in-travis-native/issues/1#issuecomment-142455888
- sudo iptables -L DOCKER || sudo iptables -N DOCKER
# ChefDK no longer available via APT repo
- wget https://packages.chef.io/files/stable/chefdk/3.2.30/ubuntu/14.04/chefdk_3.2.30-1_amd64.deb
- sudo dpkg -i chefdk_3.2.30-1_amd64.deb
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
- /opt/chefdk/bin/chef gem install kitchen-docker

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# stackstorm cookbook CHANGELOG

## 0.5.0

* Migrate from 'mongodb' to 'sc-mongodb' cookbook for Chef 13+ support
* Update test kitchen to CentOS 7.5
* Cleanups and fixes for ST2 2.9 support, and broken Travis builds

## 0.4.0

* Update Test kitchen to CentOS 7.2
Expand Down
6 changes: 3 additions & 3 deletions attributes/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# https://github.com/StackStorm/st2/blob/master/conf/st2.package.conf
default['stackstorm']['config'] = {
api_url: 'http://127.0.0.1:9101',
api_host: '0.0.0.0',
api_host: '127.0.0.1',
api_port: 9101,
api_mask_secrets: true,
api_allow_origin: '*',

auth_host: '0.0.0.0',
auth_host: '127.0.0.1',
auth_port: 9100,
auth_use_ssl: false,
auth_debug: false,
Expand All @@ -26,7 +26,7 @@
log_mask_secrets: true,

system_user: node['stackstorm']['user']['user'],
ssh_key_file: "#{node['stackstorm']['user']['home']}/.ssh/id_rsa",
ssh_key_file: "#{node['stackstorm']['user']['home']}/.ssh/stanley_rsa",

rmq_host: '127.0.0.1',
rmq_vhost: nil,
Expand Down
17 changes: 7 additions & 10 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,25 @@
license 'Apache-2.0'
description 'Installs/Configures stackstorm'
long_description 'Installs/Configures stackstorm'
version '0.4.0'
version '0.5.0'

supports 'ubuntu', '= 14.04'
supports 'redhat', '~> 7.0'
supports 'centos', '~> 7.0'
supports 'redhat', '~> 7.5'
supports 'centos', '~> 7.5'
supports 'amazon'

chef_version '>= 12.4'
chef_version '>= 14.4'

depends 'apt'
depends 'chef_nginx', '~> 5.0.1'
depends 'database'
depends 'htpasswd'
depends 'mongodb3', '~> 5.3.0'
depends 'sc-mongodb', '~> 1.2.0'
depends 'openssl', '~> 6.0.0'
depends 'openstack-mistral', '>= 0.3.0'
depends 'packagecloud'
depends 'postgresql'
# For newer RabbitMQ cookbook versions, service fails to start in Dockerized environment under EL7
# See: https://github.com/StackStorm/chef-stackstorm/pull/62
depends 'rabbitmq', '<= 4.10.0'
depends 'sudo'
depends 'postgresql', '=6.1.1'
depends 'rabbitmq'
depends 'yum'
depends 'yum-epel'

Expand Down
16 changes: 0 additions & 16 deletions recipes/_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,6 @@
'deb'
end

# Read:
# http://blog.packagecloud.io/eng/2016/03/21/apt-hash-sum-mismatch/
# https://packagecloud.io/computology/apt-backport
package 'apt' do
version '1.2.10'
action :nothing
end

execute 'Ubuntu Precise and Trusty: APT hash sum mismatch workaround' do
command 'curl -s https://packagecloud.io/install/repositories/computology/apt-backport/script.deb.sh | bash'
only_if { node['platform'] == 'ubuntu' }
only_if { %w(trusty precise).include? node['lsb']['codename'] }
creates '/etc/apt/sources.list.d/computology_apt-backport.list'
notifies :install, 'package[apt]', :immediately
end

packagecloud_repo 'StackStorm/stable' do
type type
end
1 change: 1 addition & 0 deletions recipes/_services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
st2actionrunner st2api st2stream
st2auth st2garbagecollector st2notifier
st2resultstracker st2rulesengine st2sensorcontainer
st2timersengine st2workflowengine
).freeze

# Enable & Start st2 services
Expand Down
7 changes: 6 additions & 1 deletion recipes/bundle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@
node.default['stackstorm']['user']['ssh_pub'] = pubkey
node.default['stackstorm']['user']['ssh_key'] = prikey
node.default['stackstorm']['user']['authorized_keys'] = [pubkey]
node.default['mongodb']['package_version'] = '3.4.17'
node.default['postgresql']['pg_gem']['version'] = '0.21.0'
node.override['htpasswd']['install_method'] = 'ruby'
node.override['rabbitmq']['use_distro_version'] = true

include_recipe 'mongodb3::default'
include_recipe 'htpasswd::default'
include_recipe 'sc-mongodb::default'
include_recipe 'rabbitmq::default'
include_recipe 'stackstorm::default'
include_recipe 'stackstorm::mistral'
Expand Down
15 changes: 8 additions & 7 deletions recipes/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,26 @@
if conf['ssh_key'].nil?
# Ensure to generate ssh credentials if none is given.
execute "generating ssh key-pair for #{conf['user']}" do
command "ssh-keygen -f #{conf['home']}/.ssh/id_rsa -b #{conf['ssh_key_bits']} -P ''"
command "ssh-keygen -f #{conf['home']}/.ssh/stanley_rsa -b #{conf['ssh_key_bits']} -P ''"
user conf['user']
group conf['group']
not_if { ::File.exist? "#{conf['home']}/.ssh/id_rsa" }
not_if { ::File.exist? "#{conf['home']}/.ssh/stanley_rsa" }
only_if { conf['ssh_key'].nil? }
action :run
end
else
# Write supplied credentials
file "creating #{conf['home']}/.ssh/id_rsa key #{conf['user']}" do
path "#{conf['home']}/.ssh/id_rsa"
file "creating #{conf['home']}/.ssh/stanley_rsa key #{conf['user']}" do
path "#{conf['home']}/.ssh/stanley_rsa"
mode 0640
user conf['user']
group conf['group']
content(conf['ssh_key'])
action :create
end

file "creating #{conf['home']}/.ssh/id_rsa public key for #{conf['user']}" do
path "#{conf['home']}/.ssh/id_rsa.pub"
file "creating #{conf['home']}/.ssh/stanley_rsa public key for #{conf['user']}" do
path "#{conf['home']}/.ssh/stanley_rsa.pub"
user conf['user']
group conf['group']
content(conf['ssh_pub'])
Expand All @@ -70,7 +70,7 @@
content lazy {
# We make it lazy, because we want self ssh login.
# For example. It's usefull if we deloy a chef node and the clone it :)
mypub = ::IO.read("#{conf['home']}/.ssh/id_rsa.pub")
mypub = ::IO.read("#{conf['home']}/.ssh/stanley_rsa.pub")
pubkeys = conf['authorized_keys'].dup
pubkeys.unshift(mypub) unless pubkeys.include?(mypub)
"# Generated by Chef. Don't edit!\n" << pubkeys.join("\n")
Expand All @@ -83,4 +83,5 @@
user conf['user']
nopasswd true
only_if { conf['enable_sudo'] }
action :create
end
28 changes: 4 additions & 24 deletions spec/recipes/_repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
end

let(:chef_run_ubuntu_1404) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04').converge(described_recipe) }
let(:chef_run_centos_7) { ChefSpec::SoloRunner.new(platform: 'centos', version: '7.0').converge(described_recipe) }
let(:chef_run_centos_7) { ChefSpec::SoloRunner.new(platform: 'centos', version: '7.5.1804').converge(described_recipe) }

platforms = {
'ubuntu' => ['14.04'],
'centos' => ['7.0'],
'centos' => ['7.5.1804'],
}

platforms.each do |platform, versions|
Expand All @@ -22,47 +22,27 @@
allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('apt')
chef_run
end

it 'should not install pacakge "apt"' do
expect(chef_run).to_not install_package('apt').with(version: '1.2.10')
end
end
end
end

context 'Using ubuntu 14.04 with default node attributes' do
let(:execute) { chef_run_ubuntu_1404.execute('Ubuntu Precise and Trusty: APT hash sum mismatch workaround') }
let(:chef_run) { chef_run_ubuntu_1404 }

it 'should create packagecloud_repo "StackStorm/stable"' do
expect(chef_run_ubuntu_1404).to create_packagecloud_repo('StackStorm/stable').with(
type: 'deb'
)
end

it 'should run a execute "Ubuntu Precise and Trusty: APT hash sum mismatch workaround"' do
expect(chef_run_ubuntu_1404).to run_execute('curl -s https://packagecloud.io/install/repositories/computology/apt-backport/script.deb.sh | bash')
end

it 'sends the notification to the apt resource immediately' do
expect(execute).to notify('package[apt]').to(:install).immediately
end
end

context 'Using centos 7.0 with default node attributes' do
let(:execute) { chef_run_centos_7.execute('Ubuntu Precise and Trusty: APT hash sum mismatch workaround') }
let(:execute) { chef_run_centos_7 }

it 'should create packagecloud_repo "StackStorm/stable"' do
expect(chef_run_centos_7).to create_packagecloud_repo('StackStorm/stable').with(
type: 'rpm'
)
end

it 'should not run a execute "Ubuntu Precise and Trusty: APT hash sum mismatch workaround"' do
expect(chef_run_centos_7).to_not run_execute('curl -s https://packagecloud.io/install/repositories/computology/apt-backport/script.deb.sh | bash')
end

it 'sends the notification to the apt resource immediately (but does not get installed)' do
expect(execute).to notify('package[apt]').to(:install).immediately
end
end
end
3 changes: 2 additions & 1 deletion spec/recipes/_services_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
st2actionrunner st2api st2stream
st2auth st2garbagecollector st2notifier
st2resultstracker st2rulesengine st2sensorcontainer
st2timersengine st2workflowengine
).freeze

describe 'stackstorm::_services' do
Expand All @@ -15,7 +16,7 @@

platforms = {
'ubuntu' => ['14.04'],
'centos' => ['7.0'],
'centos' => ['7.5'],
}

platforms.each do |platform, versions|
Expand Down
6 changes: 3 additions & 3 deletions spec/recipes/bundle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

platforms = {
'ubuntu' => ['14.04'],
'centos' => ['7.0'],
'centos' => ['7.5'],
}

platforms.each do |platform, versions|
Expand All @@ -60,8 +60,8 @@
expect(chef_run.node['stackstorm']['user']['authorized_keys']).to eq([pubkey])
end

it 'should include recipe mongodb3::default' do
expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('mongodb3::default')
it 'should include recipe sc-mongodb::default' do
expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('sc-mongodb::default')
chef_run
end

Expand Down
22 changes: 14 additions & 8 deletions spec/recipes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

[api]
# Host and port to bind the API server.
host = 0.0.0.0
host = 127.0.0.1
port = 9101
logging = /etc/st2/logging.api.conf
mask_secrets = true
mask_secrets = True
# allow_origin is required for handling CORS in st2 web UI.
# allow_origin = http://myhost1.example.com:3000,http://myhost2.example.com:3000
allow_origin = *
Expand Down Expand Up @@ -43,8 +43,14 @@
[garbagecollector]
logging = /etc/st2/logging.garbagecollector.conf

[timersengine]
logging = /etc/st2/logging.timersengine.conf

[workflow_engine]
logging = /etc/st2/logging.workflowengine.conf

[auth]
host = 0.0.0.0
host = 127.0.0.1
port = 9100
use_ssl = False
debug = False
Expand Down Expand Up @@ -73,7 +79,7 @@

[system_user]
user = stanley
ssh_key_file = /home/stanley/.ssh/id_rsa
ssh_key_file = /home/stanley/.ssh/stanley_rsa

[messaging]
url = amqp://guest:guest@127.0.0.1:5672/
Expand All @@ -93,7 +99,7 @@

platforms = {
'ubuntu' => ['14.04'],
'centos' => ['7.0'],
'centos' => ['7.5'],
}

platforms.each do |platform, versions|
Expand Down Expand Up @@ -152,12 +158,12 @@
# https://github.com/StackStorm/st2/blob/master/conf/st2.package.conf
variables: {
'api_url' => 'http://127.0.0.1:9101',
'api_host' => '0.0.0.0',
'api_host' => '127.0.0.1',
'api_port' => 9101,
'api_mask_secrets' => true,
'api_allow_origin' => '*',

'auth_host' => '0.0.0.0',
'auth_host' => '127.0.0.1',
'auth_port' => 9100,
'auth_use_ssl' => false,
'auth_debug' => false,
Expand All @@ -173,7 +179,7 @@
'log_mask_secrets' => true,

'system_user' => 'stanley',
'ssh_key_file' => '/home/stanley/.ssh/id_rsa',
'ssh_key_file' => '/home/stanley/.ssh/stanley_rsa',

'rmq_host' => '127.0.0.1',
'rmq_vhost' => nil,
Expand Down
Loading