From 3b680248235a081525d4be1662fa637dce19d737 Mon Sep 17 00:00:00 2001 From: Christopher Frost Date: Wed, 9 Sep 2015 15:22:37 +0100 Subject: [PATCH] Changes required for Spring Insight on PCF 1.5.x This commit makes a number of changes which are required for compatibility with Spring Insight on PCF 1.5.x. Close #222 [#102664842] --- .../framework/spring_insight.rb | 100 +++++++++--------- spec/fixtures/stub-insight-agent.jar | Bin 1724 -> 7109 bytes .../framework/spring_insight_spec.rb | 65 ++++++++---- 3 files changed, 94 insertions(+), 71 deletions(-) diff --git a/lib/java_buildpack/framework/spring_insight.rb b/lib/java_buildpack/framework/spring_insight.rb index 1d841c380a..2db96ddd5f 100644 --- a/lib/java_buildpack/framework/spring_insight.rb +++ b/lib/java_buildpack/framework/spring_insight.rb @@ -33,7 +33,7 @@ class SpringInsight < JavaBuildpack::Component::BaseComponent # @param [Hash] context a collection of utilities used the component def initialize(context) super(context) - @version, @uri, @agent_id, @agent_pass = supports? ? find_insight_agent : [nil, nil, nil, nil] + @version, @uri, @agent_transport = find_insight_agent if supports? end # (see JavaBuildpack::Component::BaseComponent#detect) @@ -45,8 +45,7 @@ def detect def compile JavaBuildpack::Util::Cache::InternetAvailability.instance.available( true, 'The Spring Insight download location is always accessible') do - # TODO: AGENT_DOWNLOAD_URI_SUFFIX To be removed once the full path is included in VCAP_SERVICES see #58873498 - download(@version, @uri.chomp('/') + AGENT_DOWNLOAD_URI_SUFFIX) { |file| expand file } + download(@version, @uri) { |file| expand file } end end @@ -58,15 +57,11 @@ def release .add_system_property('insight.logs', logs_directory) .add_system_property('aspectj.overweaving', true) .add_system_property('org.aspectj.tracing.factory', 'default') - .add_system_property('insight.transport.type', 'HTTP') - - add_agent_configuration end protected - # The unique identifier of the component, incorporating the version of the dependency (e.g. - # +spring-insight=1.9.3+) + # The unique identifier of the component, incorporating the version of the dependency) # # @param [String] version the version of the dependency # @return [String] the unique identifier of the component @@ -76,24 +71,9 @@ def id(version) private - # TODO: To be removed once the full path is included in VCAP_SERVICES see issue 58873498 - AGENT_DOWNLOAD_URI_SUFFIX = '/services/config/agent-download'.freeze - - FILTER = /insight/.freeze + FILTER = /p-insight/.freeze - private_constant :AGENT_DOWNLOAD_URI_SUFFIX, :FILTER - - def add_agent_configuration - @droplet.java_opts - .add_system_property('agent.http.protocol', 'http') - .add_system_property('agent.http.host', URI(@uri).host) - .add_system_property('agent.http.port', 80) - .add_system_property('agent.http.context.path', 'insight') - .add_system_property('agent.http.username', @agent_id) - .add_system_property('agent.http.password', @agent_pass) - .add_system_property('agent.http.send.json', false) - .add_system_property('agent.http.use.proxy', false) - end + private_constant :FILTER def expand(file) with_timing "Expanding Spring Insight to #{@droplet.sandbox.relative_path_from(@droplet.root)}" do @@ -112,6 +92,9 @@ def unpack_agent_installer(root, file) FileUtils.mkdir_p(agent_dir) shell "unzip -qq #{file.path} -d #{installer_dir} 2>&1" shell "unzip -qq #{uber_agent_zip(installer_dir)} -d #{agent_dir} 2>&1" + move agent_dir, + installer_dir + 'answers.properties', + installer_dir + 'agent.override.properties' agent_dir end @@ -119,35 +102,34 @@ def unpack_agent_installer(root, file) def install_insight(agent_dir) root = Pathname.glob(agent_dir + 'springsource-insight-uber-agent-*')[0] - init_container_libs root - init_insight_cloudfoundry_agent_plugin root init_insight root + init_insight_properties agent_dir init_insight_agent_plugins root init_weaver root end - def init_container_libs(root) - move container_libs_directory, - root + 'agents/common/insight-bootstrap-generic-*.jar', - root + 'agents/tomcat/7/lib/insight-bootstrap-tomcat-common-*.jar', - root + 'agents/tomcat/7/lib/insight-agent-*.jar' - end - def init_insight(root) move insight_directory, root + 'insight/collection-plugins', - root + 'insight/conf' + root + 'insight/conf', + root + 'insight/bootstrap', + root + 'insight/extras' end - def init_insight_agent_plugins(root) - move insight_directory + 'agent-plugins', - root + 'transport/http/insight-agent-http-*.jar', - root + 'cloudfoundry/insight-agent-cloudfoundry-*.jar' + def init_insight_properties(root) + move insight_directory, + root + 'agent.override.properties' + + answers_properties = root + 'answers.properties' + insight_properties = insight_directory + 'conf/insight.properties' + system "cat #{answers_properties} >> #{insight_properties}" end - def init_insight_cloudfoundry_agent_plugin(root) - move container_libs_directory, - root + 'cloudfoundry/cloudfoundry-runtime-*.jar' + def init_insight_agent_plugins(root) + move insight_directory + 'agent-plugins', + root + 'agents/tomcat/7/lib/insight-agent-*.jar' + transport_jar = transport_plugin root + move insight_directory + 'agent-plugins', transport_jar end def init_weaver(root) @@ -155,18 +137,13 @@ def init_weaver(root) root + 'cloudfoundry/insight-weaver-*.jar' end - def container_libs_directory - @droplet.root + '.spring-insight/container-libs' - end - def find_insight_agent service = @application.services.find_service FILTER - version = service['label'].match(/(.*)-(.*)/)[2] credentials = service['credentials'] - uri = credentials['dashboard_url'] - id = credentials['agent_username'] - pass = credentials['agent_password'] - [version, uri, id, pass] + version = credentials['version'] || '1.0.0' + uri = credentials['agent_download_url'] + transport = credentials['agent_transport'] || 'rabbitmq' + [version, uri, transport] end def insight_directory @@ -186,7 +163,7 @@ def move(destination, *globs) end def supports? - @application.services.one_service? FILTER, 'dashboard_url', 'agent_username', 'agent_password' + @application.services.one_service? FILTER, 'agent_download_url', 'service_instance_id' end def uber_agent_zip(location) @@ -203,6 +180,25 @@ def weaver_jar (weaver_directory + 'insight-weaver-*.jar').glob[0] end + def transport_plugin(root) + return root + 'transport/http/insight-agent-http-*.jar' if http_transport? + return root + 'transport/rabbitmq/insight-agent-rabbitmq-*.jar' if rabbit_transport? + (root + 'transport/activemq/insight-agent-activemq-*.jar') if active_transport? + end + + def http_transport? + @agent_transport.eql? 'http' + end + + def rabbit_transport? + @agent_transport.eql? 'rabbitmq' + end + + def active_transport? + @agent_transport.eql? 'activemq' + end + end + end end diff --git a/spec/fixtures/stub-insight-agent.jar b/spec/fixtures/stub-insight-agent.jar index 6148c8743f898785d0a97cbd7ddcea25947301a2..c5ecfa11d067287c072702830c3e9e55dda4641a 100644 GIT binary patch literal 7109 zcmbW6Wl&sE+O2^AfuMm#f;$B04(<+(ThQPMG#0#ZcX#)Y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t}pctJV?C7dcj((d5tu($T!06>? zr)1d^^lSOzfvE|fq4|jh?rW=2KWzF+H6+9K<10dPMnLbL(&eE;Hsot-mtS|hxnKQp z)Lo$CpFRiCUKE`6?4uQEXA|o*b!b^8a2$iW>dMBZF`%%1OIG17ZP75ejs4l2tC!9K^tT!-K8rd0zbUu%vu4%vL&NzA4zCpJvc|WH-y9s!X($$ zn&~uZzg*uP9QMb+A-EGkP?0vxIwT=lPFN~x zUg%o5__xbZ;?NEilG%0M9npBV7lti#^Ifj5lMKY~Uke$k)vtuxiJ6}&_YDw7a>nxF z=)d$}lKEywcTR6jAWJ4jn!A_3p!Tbt{DDecZR&#Y2V#SEEa%#BnfifT;ZEh{PjSd3 zW}OSw*TKjp0#u`a-0@NC{K84&**5$(xs19ulk-AED0zaU;*b-{1X?RDcBN>E!`q0e8YFBRL?CcpB1EKQ}uy?Hz14P}cu>mrP=dH-x+t z1&&TN+Ktx0z3;GyzL0@Y&KTd6uz^VYx$T#{bMNJGoHOxRo?9$$E1Pmq=s;HrHYvm)T$#iM#u)8f3B49_GaXzA zIY(^xv0I4;W8OiBLC z;XYV1Xzw7UA=}EZ@omq1j68)83oB}d6fLC8%yy*Ig8d)2)~;x6uopj?5^_%p0AOnZ z))|xlf&rV={FlTHH8cxFWj6jL*U#|!{k!zW>n~z;nos}$ diff --git a/spec/java_buildpack/framework/spring_insight_spec.rb b/spec/java_buildpack/framework/spring_insight_spec.rb index 721a4fa541..ab0139b3d3 100644 --- a/spec/java_buildpack/framework/spring_insight_spec.rb +++ b/spec/java_buildpack/framework/spring_insight_spec.rb @@ -31,39 +31,41 @@ context do before do - allow(services).to receive(:one_service?).with(/insight/, 'dashboard_url', 'agent_username', 'agent_password') - .and_return(true) - allow(services).to receive(:find_service).and_return('label' => 'insight-1.0', - 'credentials' => { 'dashboard_url' => 'test-uri', - 'agent_password' => 'foo', - 'agent_username' => 'bar' }) - allow(application_cache).to receive(:get).with('test-uri/services/config/agent-download') + allow(services).to receive(:one_service?) + .with(/p-insight/, 'agent_download_url', 'service_instance_id').and_return(true) + allow(services).to receive(:find_service) + .and_return('label' => 'p-insight', + 'credentials' => { + 'version' => '2.0.0', + 'agent_download_url' => 'test-uri/services/config/agent-download', + 'agent_password' => 'foo', + 'agent_username' => 'bar', + 'service_instance_id' => '12345' }) + allow(application_cache).to receive(:get) + .with('test-uri/services/config/agent-download') .and_yield(Pathname.new('spec/fixtures/stub-insight-agent.jar').open, false) end - it 'detects with spring-insight-n/a service' do - expect(component.detect).to eq('spring-insight=1.0') + it 'does detect with spring-insight-n/a service' do + expect(component.detect).to eq('spring-insight=2.0.0') end - it 'extracts Spring Insight from the Uber Agent zip file inside the Agent Installer jar' do + it 'does extract Spring Insight from the Uber Agent zip file inside the Agent Installer jar' do component.compile - container_libs_dir = app_dir + '.spring-insight/container-libs' - - expect(sandbox + 'weaver/insight-weaver-cf-2.0.0-CI-SNAPSHOT.jar').to exist - expect(container_libs_dir + 'insight-bootstrap-generic-2.0.0-CI-SNAPSHOT.jar').to exist - expect(container_libs_dir + 'insight-bootstrap-tomcat-common-2.0.0-CI-SNAPSHOT.jar').to exist + expect(sandbox + 'weaver/insight-weaver-2.0.0-CI-SNAPSHOT.jar').to exist expect(sandbox + 'insight/conf/insight.properties').to exist + expect(sandbox + 'insight/agent-plugins/insight-agent-rabbitmq-core-2.0.0-CI-SNAPSHOT.jar').to exist end - it 'guarantees that internet access is available when downloading' do + it 'does guarantee that internet access is available when downloading' do expect_any_instance_of(JavaBuildpack::Util::Cache::InternetAvailability) .to receive(:available).with(true, 'The Spring Insight download location is always accessible') component.compile end - it 'updates JAVA_OPTS', + it 'does update JAVA_OPTS', app_fixture: 'framework_spring_insight' do component.release @@ -74,9 +76,34 @@ expect(java_opts).to include('-Dinsight.logs=$PWD/.java-buildpack/spring_insight/insight/logs') expect(java_opts).to include('-Daspectj.overweaving=true') expect(java_opts).to include('-Dorg.aspectj.tracing.factory=default') - expect(java_opts).to include('-Dagent.http.username=bar') - expect(java_opts).to include('-Dagent.http.password=foo') end end + context do + + it 'does extract Spring Insight from the Uber Agent zip file and copy the ActiveMQ plugin' do + allow(services).to receive(:one_service?) + .with(/p-insight/, 'agent_download_url', 'service_instance_id').and_return(true) + allow(services).to receive(:find_service) + .and_return('label' => 'p-insight', + 'credentials' => { + 'version' => '2.0.0', + 'agent_download_url' => 'test-uri/services/config/agent-download', + 'agent_password' => 'foo', + 'agent_username' => 'bar', + 'service_instance_id' => '12345', + 'agent_transport' => 'activemq' }) + allow(application_cache).to receive(:get) + .with('test-uri/services/config/agent-download') + .and_yield(Pathname.new('spec/fixtures/stub-insight-agent.jar').open, false) + + component.compile + + expect(sandbox + 'weaver/insight-weaver-2.0.0-CI-SNAPSHOT.jar').to exist + expect(sandbox + 'insight/conf/insight.properties').to exist + expect(sandbox + 'insight/agent-plugins/insight-agent-activemq-2.0.0-CI-SNAPSHOT.jar').to exist + end + + end + end