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

Commit

Permalink
Merge pull request #104 from Alfresco/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Enzo Rivello committed Sep 1, 2016
2 parents 2ef8a38 + 785c2dd commit 7184f8e
Show file tree
Hide file tree
Showing 10 changed files with 322 additions and 26 deletions.
6 changes: 4 additions & 2 deletions .kitchen.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ suites:
"name": "chef-alfresco-community",
"hostname": "alfresco-allinone-test",
"alfresco" : {
"components" : ['haproxy','nginx','tomcat','transform','repo','share','solr','mysql','googledocs','yourkit'],
"version" : "5.1.g",
"ssl_enabled" : false
},
"nginx" : {
Expand All @@ -50,8 +52,8 @@ suites:
"name": "chef-alfresco-enterprise",
"hostname": "alfresco-allinone-test",
"alfresco" : {
"version" : "5.1",
"components" : ["haproxy","nginx","tomcat","transform","repo","share","solr","mysql","aos"],
"version" : "5.1.1.1",
"components" : ["haproxy","nginx","tomcat","transform","repo","share","solr","mysql","aos", "rm"],
"edition" : "enterprise",
"ssl_enabled" : false
},
Expand Down
6 changes: 4 additions & 2 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ suites:
"name": "chef-alfresco-community",
"hostname": "alfresco-allinone-test",
"alfresco" : {
"components" : ['haproxy','nginx','tomcat','transform','repo','share','solr','mysql','googledocs','yourkit'],
"version" : "5.1.g",
"ssl_enabled" : false
},
"nginx" : {
Expand All @@ -45,8 +47,8 @@ suites:
"name": "chef-alfresco-enterprise",
"hostname": "alfresco-allinone-test",
"alfresco" : {
"version" : "5.1",
"components" : ["haproxy","nginx","tomcat","transform","repo","share","solr","mysql","aos"],
"version" : "5.1.1.1",
"components" : ["haproxy","nginx","tomcat","transform","repo","share","solr","mysql","aos", "rm"],
"edition" : "enterprise",
"ssl_enabled" : false
},
Expand Down
6 changes: 3 additions & 3 deletions recipes/_aos-attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
node.default['artifacts']['_vti_bin']['artifactId'] = "alfresco-vti-bin"
node.default['artifacts']['_vti_bin']['version'] = "1.1"
node.default['artifacts']['_vti_bin']['type'] = 'war'
node.default['artifacts']['_vti_bin']['owner'] = node['alfresco']['user']
node.default['artifacts']['_vti_bin']['owner'] = 'root'

node.default['artifacts']['ROOT']['groupId'] = node['alfresco']['groupId']
node.default['artifacts']['ROOT']['artifactId'] = "alfresco-server-root"
node.default['artifacts']['ROOT']['version'] = node['alfresco']['version']
node.default['artifacts']['ROOT']['type'] = 'war'
node.default['artifacts']['ROOT']['owner'] = node['alfresco']['user']
node.default['artifacts']['ROOT']['owner'] = 'root'

node.default['artifacts']['aos-module']['groupId'] = "org.alfresco.aos-module"
node.default['artifacts']['aos-module']['artifactId'] = "alfresco-aos-module"
node.default['artifacts']['aos-module']['version'] = "1.1"
node.default['artifacts']['aos-module']['type'] = 'amp'
node.default['artifacts']['aos-module']['owner'] = node['alfresco']['user']
node.default['artifacts']['aos-module']['owner'] = 'root'
node.default['artifacts']['aos-module']['destination'] = "/usr/share/tomcat/amps"

if node['tomcat']['run_base_instance']
Expand Down
23 changes: 4 additions & 19 deletions recipes/_rm-attributes.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
if node['alfresco']['edition'] == 'enterprise'

node.default['artifacts']['alfresco-rm-core-repo']['groupId'] = "org.alfresco"
node.default['artifacts']['alfresco-rm-core-repo']['artifactId'] = "alfresco-rm-core-repo"
node.default['artifacts']['alfresco-rm-core-repo']['version'] = "2.4"
node.default['artifacts']['alfresco-rm-core-repo']['type'] = "amp"
node.default['artifacts']['alfresco-rm-core-repo']['owner'] = node['alfresco']['user']
node.default['artifacts']['alfresco-rm-core-repo']['destination'] = node['alfresco']['amps_folder']

node.default['artifacts']['alfresco-rm-core-share']['groupId'] = "org.alfresco"
node.default['artifacts']['alfresco-rm-core-share']['artifactId'] = "alfresco-rm-core-share"
node.default['artifacts']['alfresco-rm-core-share']['version'] = "2.4"
node.default['artifacts']['alfresco-rm-core-share']['type'] = "amp"
node.default['artifacts']['alfresco-rm-core-share']['owner'] = node['alfresco']['user']
node.default['artifacts']['alfresco-rm-core-share']['destination'] = node['alfresco']['amps_share_folder']

node.default['artifacts']['alfresco-rm-enterprise-repo']['groupId'] = "org.alfresco"
node.default['artifacts']['alfresco-rm-enterprise-repo']['artifactId'] = "alfresco-rm-enterprise-repo"
node.default['artifacts']['alfresco-rm-enterprise-repo']['version'] = "2.4"
node.default['artifacts']['alfresco-rm-enterprise-repo']['version'] = "2.5.0"
node.default['artifacts']['alfresco-rm-enterprise-repo']['type'] = "amp"
node.default['artifacts']['alfresco-rm-enterprise-repo']['owner'] = node['alfresco']['user']
node.default['artifacts']['alfresco-rm-enterprise-repo']['destination'] = node['alfresco']['amps_folder']

node.default['artifacts']['alfresco-rm-enterprise-share']['groupId'] = "org.alfresco"
node.default['artifacts']['alfresco-rm-enterprise-share']['artifactId'] = "alfresco-rm-enterprise-share"
node.default['artifacts']['alfresco-rm-enterprise-share']['version'] = "2.4"
node.default['artifacts']['alfresco-rm-enterprise-share']['version'] = "2.5.0"
node.default['artifacts']['alfresco-rm-enterprise-share']['type'] = "amp"
node.default['artifacts']['alfresco-rm-enterprise-share']['owner'] = node['alfresco']['user']
node.default['artifacts']['alfresco-rm-enterprise-share']['destination'] = node['alfresco']['amps_share_folder']
Expand All @@ -32,14 +17,14 @@

node.default['artifacts']['alfresco-rm-community-repo']['groupId'] = "org.alfresco"
node.default['artifacts']['alfresco-rm-community-repo']['artifactId'] = "alfresco-rm-community-repo"
node.default['artifacts']['alfresco-rm-community-repo']['version'] = "2.4.b"
node.default['artifacts']['alfresco-rm-community-repo']['version'] = "2.5.0"
node.default['artifacts']['alfresco-rm-community-repo']['type'] = "amp"
node.default['artifacts']['alfresco-rm-community-repo']['owner'] = node['alfresco']['user']
node.default['artifacts']['alfresco-rm-community-repo']['destination'] = node['alfresco']['amps_folder']

node.default['artifacts']['alfresco-rm-community-share']['groupId'] = "org.alfresco"
node.default['artifacts']['alfresco-rm-community-share']['artifactId'] = "alfresco-rm-community-share"
node.default['artifacts']['alfresco-rm-community-share']['version'] = "2.4.b"
node.default['artifacts']['alfresco-rm-community-share']['version'] = "2.5.0"
node.default['artifacts']['alfresco-rm-community-share']['type'] = "amp"
node.default['artifacts']['alfresco-rm-community-share']['owner'] = node['alfresco']['user']
node.default['artifacts']['alfresco-rm-community-share']['destination'] = node['alfresco']['amps_share_folder']
Expand Down
3 changes: 3 additions & 0 deletions test/integration/enterprise/serverspec/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'faraday'
13 changes: 13 additions & 0 deletions test/integration/enterprise/serverspec/components/rm_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper'

describe "RM components" do
describe file("/usr/share/tomcat/amps/alfresco-rm-enterprise-repo.amp") do
it { should exist }
it { should be_owned_by 'tomcat' }
end

describe file("/usr/share/tomcat/amps_share/alfresco-rm-enterprise-share.amp") do
it { should exist }
it { should be_owned_by 'tomcat' }
end
end
168 changes: 168 additions & 0 deletions test/integration/enterprise/serverspec/daemons_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
require 'spec_helper'


# TODO Checks
#
# Check (some) folder permissions (@toni?)
# Check iptables configuration (ports and IP blacklisting)
# Check Share login via webscripts
# Check Share search via webscripts
# Check Share transformation via webscripts
# Check JMX
# Check CMIS write/read
# Check Nginx endpoint with certificate (generate certs for alfresco.test domain)

# TODO CI
#
# Configure Bamboo build to run kitchen converge && kitchen verify || kitchen converge && kitchen verify, avoid folder purging, run on commit; also check with kitchen list if any box is running; every friday evening, run a kitchen destroy && kitchen converge || kitchen converge

services = ['tomcat-alfresco','tomcat-share','tomcat-solr','haproxy','nginx']
yumrepos = ['epel','nginx']

# TODO - should be the FQDN, but still need to configure /etc/hosts to get this to work
# alfresco_host = "chef-alfresco-testing.alfresco.test"
alfresco_host = "localhost"

yumrepos.each do |yumrepo|
describe yumrepo(yumrepo) do
it { should exist }
end
end

# TODO - this logic should be provided by another cookbook
#
# describe host(alfresco_host) do
# it { should be_resolvable.by('hosts') }
# end

describe "Alfresco daemons" do

# Removing all the let *Connection tests, as they are classified as Validation testing, thus they don't have space in an integration test suite
# Keeping them as memento to create future validation testing

# let(:repoConnection) { $repoConnection ||= getFaradayConnection "http://localhost:8070" }
# let(:shareConnection) { $shareConnection ||= getFaradayConnection "http://localhost:8081" }
# let(:solrConnection) { $solrConnection ||= getFaradayConnection "http://localhost:8090" }
# let(:activitiConnection) { $activitiConnection ||= getFaradayConnection "http://localhost:8060" }
# let(:haproxyConnection) { $haproxyConnection ||= getFaradayConnection "http://localhost:9001" }
# let(:haproxyIntConnection) { $haproxyIntConnection ||= getFaradayConnection "http://localhost:9000" }
# let(:httpNginxConnection) { $httpNginxConnection ||= getFaradayConnection "http://localhost" }
# let(:nginxConnection) { $nginxConnection ||= getFaradayConnection "http://#{alfresco_host}" }
# let(:authNginxConnection) { $authNginxConnection ||= getFaradayConnection "http://admin:admin@#{alfresco_host}" }

services.each do |service|
it "Has a running #{service} service" do
expect(service(service)).to be_running
end
end

# The following tests are all Validation testing, thus they don't have space in an integration test suite
# Keeping them as memento to create future validation testing

# it 'Has a running Alfresco Repository application' do
# expect(repoConnection.get('/alfresco/').body).to include('Welcome to Alfresco')
# end
#
# it 'Has a running Alfresco Share application' do
# expect(shareConnection.get('/share/page/').body).to include('Alfresco Software Inc. All rights reserved. Simple + Smart')
# end
#
# it 'Has a running Alfresco Solr application' do
# expect(solrConnection.get('/solr4/').body).to include('Apache SOLR')
# end

# it 'Has a running Activiti application' do
# expect(activitiConnection.get('/activiti/').body).to include('Activiti')
# end

# it 'Has a running Haproxy service wrapping all Alfresco public applications' do
# expect(haproxyConnection.get('/alfresco/').body).to include('Welcome to Alfresco')
# expect(haproxyConnection.get('/share/page/').body).to include('Alfresco Software Inc. All rights reserved. Simple + Smart')
# end
#
# it 'Has a running Haproxy service wrapping all Alfresco internal applications' do
# expect(haproxyIntConnection.get('/solr4/').body).to include('Apache SOLR')
# end
# # TODO - add vti and root here
#
# it 'Has a running Nginx service wrapping alfresco/share Haproxy endpoints' do
# expect(nginxConnection.get('/alfresco/').body).to include('Welcome to Alfresco')
# expect(nginxConnection.get('/share/page/').body).to include('Alfresco Software Inc. All rights reserved. Simple + Smart')
# end
#
# it 'Has a running Nginx service wrapping alfresco/share Haproxy endpoints' do
# expect(nginxConnection.get('/alfresco/').body).to include('Welcome to Alfresco')
# expect(nginxConnection.get('/share/page/').body).to include('Alfresco Software Inc. All rights reserved. Simple + Smart')
# end

# it 'Has a running Nginx service wrapping /activiti Haproxy endpoints' do
# expect(nginxConnection.get('/activiti/').body).to include('Activiti')
# end

# TODO - uncomment this!
# it 'Has an HTTP redirect' do
# expect(httpNginxConnection.get('/').status).to eq 302
# end

# it 'Can search booted docs' do
# expect(authNginxConnection.get('/alfresco/service/slingshot/node/search?q=%40name%3A%22Project%20Meeting%20Minutes%22&lang=lucene&store=workspace%3A%2F%2FSpacesStore').body).to include('cm:Project Meeting Minutes')
# end

# # These tests are Enterprise-specific, whereas CI runs on a public environment
#
# it 'Has an Enterprise license installed' do
# expect(authNginxConnection.get('/alfresco/s/enterprise/admin/admin-license').body).to include('<span class="value">ENTERPRISE</span>')
# end
#
# it 'Has an RM module installed' do
# expect(authNginxConnection.get('/alfresco/s/enterprise/admin/admin-systemsummary').body).to include('org_alfresco_module_rm')
# end
#
# it 'Has an Google Docs module installed' do
# expect(authNginxConnection.get('/alfresco/s/enterprise/admin/admin-systemsummary').body).to include('org.alfresco.integrations.google.docs')
# end
end

# TODO - Rsyslog files for haproxy
# describe file('/var/log/haproxy/haproxy.log') do
# it { should exist }
# end
# describe file('/var/log/haproxy/alfresco.log') do
# it { should exist }
# end
# describe file('/var/log/haproxy/share.log') do
# it { should exist }
# end
# describe file('/var/log/haproxy/solr.log') do
# it { should exist }
# end

# TODO - not working
#
# -A INPUT -p tcp --dport 80 -j ACCEPT
# -A INPUT -p tcp --dport 443 -j ACCEPT
# -A INPUT -p tcp --dport 5701 -j ACCEPT
# -A INPUT -p tcp --dport 40000 -j ACCEPT
# -A INPUT -p tcp --dport 40010 -j ACCEPT
# -A INPUT -p tcp --dport 40020 -j ACCEPT
#
# describe iptables do
# it { should have_rule("-A INPUT -p tcp --dport 80 -j ACCEPT") }
# end

# TODO - not working
#
# describe cron do
# it { should have_entry '*/30 * * * * root find #{node['tomcat']['cache_root_folder']}/tomcat-alfresco -mmin +30 -type f -exec rm -rf {} \;' }
# it { should have_entry '*/30 * * * * root find #{node['tomcat']['cache_root_folder']}/tomcat-share -mmin +30 -type f -exec rm -rf {} \;' }
# it { should have_entry '*/30 * * * * root find #{node['tomcat']['cache_root_folder']}/tomcat-solr -mmin +30 -type f -exec rm -rf {} \;' }
# end

# TODO - Check that new location is correct (https); none of the approaches work!
#
# describe http_get(80, 'img-alfresco-test.alfresco.me', '/') do
# its(:headers) { should include('Location' => /img-alfresco-test/) }
# end
# it 'Has an HTTP redirect to HTTPS' do
# expect(httpNginxConnection.get('/').headers).include('Location' => "https://img-alfresco-test.alfresco.me/share/")
# end
11 changes: 11 additions & 0 deletions test/integration/enterprise/serverspec/helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Helpers
#Establishes a connection at the give url with faraday
#return faradayConnection
def getFaradayConnection (url)
newConnection= Faraday.new(:url => url,
:headers => {'Host' => host_inventory['hostname']}) do |faraday|
faraday.adapter Faraday.default_adapter
end
return newConnection
end
end
Loading

0 comments on commit 7184f8e

Please sign in to comment.