engineyard-visualvm 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +16 -0
  3. data/LICENSE.txt +23 -0
  4. data/README.md +102 -0
  5. data/Rakefile +76 -0
  6. data/Vagrantfile +94 -0
  7. data/bin/ey-visualvm +9 -0
  8. data/cookbooks/apt/README.md +122 -0
  9. data/cookbooks/apt/files/default/apt-cacher +9 -0
  10. data/cookbooks/apt/files/default/apt-cacher.conf +144 -0
  11. data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
  12. data/cookbooks/apt/metadata.json +34 -0
  13. data/cookbooks/apt/metadata.rb +13 -0
  14. data/cookbooks/apt/providers/repository.rb +73 -0
  15. data/cookbooks/apt/recipes/cacher-client.rb +44 -0
  16. data/cookbooks/apt/recipes/cacher.rb +45 -0
  17. data/cookbooks/apt/recipes/default.rb +50 -0
  18. data/cookbooks/apt/resources/repository.rb +30 -0
  19. data/cookbooks/gems/recipes/default.rb +16 -0
  20. data/cookbooks/java/README.md +102 -0
  21. data/cookbooks/java/attributes/default.rb +29 -0
  22. data/cookbooks/java/files/default/java.seed +11 -0
  23. data/cookbooks/java/metadata.json +50 -0
  24. data/cookbooks/java/metadata.rb +16 -0
  25. data/cookbooks/java/recipes/default.rb +21 -0
  26. data/cookbooks/java/recipes/openjdk.rb +39 -0
  27. data/cookbooks/java/recipes/sun.rb +93 -0
  28. data/cookbooks/jruby/attributes/default.rb +2 -0
  29. data/cookbooks/jruby/recipes/default.rb +24 -0
  30. data/cookbooks/server/recipes/default.rb +9 -0
  31. data/cookbooks/server/templates/default/server.sh.erb +27 -0
  32. data/cookbooks/vagrant_main/recipes/default.rb +4 -0
  33. data/engineyard-visualvm.gemspec +28 -0
  34. data/ext/org/jruby/ext/jmx/Agent.java +169 -0
  35. data/ext/org/jruby/ext/jmx/JavaHome.java +7 -0
  36. data/ext/org/jruby/ext/jmx/RMIServerSocketFactoryImpl.java +37 -0
  37. data/lib/engineyard-visualvm.rb +8 -0
  38. data/lib/engineyard-visualvm/agent.jar +0 -0
  39. data/lib/engineyard-visualvm/cli.rb +205 -0
  40. data/lib/engineyard-visualvm/version.rb +11 -0
  41. data/spec/engineyard-visualvm_spec.rb +164 -0
  42. data/spec/spec_helper.rb +30 -0
  43. metadata +154 -0
@@ -0,0 +1,30 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Resource:: repository
4
+ #
5
+ # Copyright 2010-2011, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ actions :add, :remove
21
+
22
+ #name of the repo, used for source.list filename
23
+ attribute :repo_name, :kind_of => String, :name_attribute => true
24
+ attribute :uri, :kind_of => String
25
+ attribute :distribution, :kind_of => String
26
+ attribute :components, :kind_of => Array, :default => []
27
+ #whether or not to add the repository as a source repo as well
28
+ attribute :deb_src, :default => false
29
+ attribute :keyserver, :kind_of => String, :default => nil
30
+ attribute :key, :kind_of => String, :default => nil
@@ -0,0 +1,16 @@
1
+ GEMS = %w(jruby-openssl)
2
+
3
+ GEMS.each do |gem|
4
+ gem_package gem do
5
+ gem_binary "jgem"
6
+ action :install
7
+ version ">= 0"
8
+ end
9
+ end
10
+
11
+ require '/vagrant/lib/engineyard-visualvm/version'
12
+ gem_package "/vagrant/pkg/engineyard-visualvm-#{EngineYard::VisualVM::VERSION}.gem" do
13
+ gem_binary "jgem"
14
+ action :install
15
+ version ">= 0"
16
+ end
@@ -0,0 +1,102 @@
1
+ Description
2
+ ===========
3
+
4
+ Installs a Java. Uses OpenJDK by default but supports installation of the Sun's Java.
5
+
6
+ ---
7
+ Requirements
8
+ ============
9
+
10
+ Platform
11
+ --------
12
+
13
+ * Debian, Ubuntu
14
+ * CentOS, Red Hat, Fedora
15
+
16
+ Cookbooks
17
+ ---------
18
+
19
+ * apt
20
+
21
+ ---
22
+ Attributes
23
+ ==========
24
+
25
+ * `node["java"]["install_flavor"]` - Flavor of JVM you would like installed (`sun` or `openjdk`), default `openjdk`.
26
+
27
+ ---
28
+ Recipes
29
+ =======
30
+
31
+ default
32
+ -------
33
+
34
+ Include the default recipe in a run list, to get `java`. By default the `openjdk` flavor of Java is installed, but this can be changed by using the `install_flavor` attribute.
35
+
36
+ openjdk
37
+ -------
38
+
39
+ This recipe installs the `openjdk` flavor of Java.
40
+
41
+ sun
42
+ ---
43
+
44
+ This recipe installs the `sun` flavor of Java.
45
+
46
+ On Debian and Ubuntu systems the recipe will add the correct apt repository (`non-free` on Debian or `partner` on Ubuntu), pre-seed the package and update java alternatives.
47
+
48
+ On Red Hat flavored Linux (RHEL, CentOS, Fedora), the installation of the Sun flavor of Java is slightly more complicated as the `rpm` package is not readily available in any public Yum repository. The Sun JDK `rpm` package can be downloaded directly from Sun but comes wrapped as a compressed bin file. After the file has been downloaded, decompressed and license accepted the `rpm` package (names something like `jdk-6u25-ea-linux-amd64.rpm`) can be retrieved by this recipe using the `remote_file` or `cookbook_file` resources. The recipe will choose the correct resource based on the existence (or non-existence) of the `node['sun']['rpm_url']` attribute. See below for an example role using this attribute in the proper way. If you would like to deliver the `rpm` package file as part of this cookbook place the `rpm` package file in the `files/default` directory and the cookbook will retrieve the file during installation.
49
+
50
+ ---
51
+ Usage
52
+ =====
53
+
54
+ Simply include the `java` recipe where ever you would like Java installed.
55
+
56
+ To install Sun flavored Java on Debian or Ubuntu override the `node['java']['install_flavor']` attribute with in role:
57
+
58
+ name "java"
59
+ description "Install Sun Java on Ubuntu"
60
+ override_attributes(
61
+ "java" => {
62
+ "install_flavor" => "sun"
63
+ }
64
+ )
65
+ run_list(
66
+ "recipe[java]"
67
+ )
68
+
69
+ On RedHat flavored Linux be sure to set the `rpm_url` and `rpm_checksum` attributes if you placed the `rpm` file on a remote server:
70
+
71
+ name "java"
72
+ description "Install Sun Java on CentOS"
73
+ override_attributes(
74
+ "java" => {
75
+ "install_flavor" => "sun",
76
+ "version" => "6u25",
77
+ "rpm_url" => "https://mycompany.s3.amazonaws.com/sun_jdk",
78
+ "rpm_checksum" => "c473e3026f991e617710bad98f926435959303fe084a5a31140ad5ad75d7bf13"
79
+ }
80
+ )
81
+ run_list(
82
+ "recipe[java]"
83
+ )
84
+
85
+ License and Author
86
+ ==================
87
+
88
+ Author:: Seth Chisamore (<schisamo@opscode.com>)
89
+
90
+ Copyright:: 2008-2011, Opscode, Inc
91
+
92
+ Licensed under the Apache License, Version 2.0 (the "License");
93
+ you may not use this file except in compliance with the License.
94
+ You may obtain a copy of the License at
95
+
96
+ http://www.apache.org/licenses/LICENSE-2.0
97
+
98
+ Unless required by applicable law or agreed to in writing, software
99
+ distributed under the License is distributed on an "AS IS" BASIS,
100
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
101
+ See the License for the specific language governing permissions and
102
+ limitations under the License.
@@ -0,0 +1,29 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Cookbook Name:: java
4
+ # Attributes:: default
5
+ #
6
+ # Copyright 2010, 2011, Opscode, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+
20
+ default['java']['install_flavor'] = "sun"
21
+
22
+ case platform
23
+ when "centos","redhat","fedora"
24
+ default['java']['version'] = "6u25"
25
+ default['java']['arch'] = kernel['machine'] =~ /x86_64/ ? "amd64" : "i586"
26
+ set['java']['java_home'] = "/usr/lib/jvm/java"
27
+ else
28
+ set['java']['java_home'] = "/usr/lib/jvm/default-java"
29
+ end
@@ -0,0 +1,11 @@
1
+ sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
2
+ sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true
3
+ sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true
4
+ sun-java6-jre sun-java6-jre/stopthread boolean true
5
+ sun-java6-jre sun-java6-jre/jcepolicy note
6
+ sun-java6-bin shared/error-sun-dlj-v1-1 error
7
+ sun-java6-jdk shared/error-sun-dlj-v1-1 error
8
+ sun-java6-jre shared/error-sun-dlj-v1-1 error
9
+ sun-java6-bin shared/present-sun-dlj-v1-1 note
10
+ sun-java6-jdk shared/present-sun-dlj-v1-1 note
11
+ sun-java6-jre shared/present-sun-dlj-v1-1 note
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "java",
3
+ "description": "Installs Java runtime.",
4
+ "long_description": "Description\n===========\n\nInstalls a Java. Uses OpenJDK by default but supports installation of the Sun's Java.\n\n---\nRequirements\n============\n\nPlatform\n--------\n\n* Debian, Ubuntu\n* CentOS, Red Hat, Fedora\n\nCookbooks\n---------\n\n* apt\n\n---\nAttributes\n==========\n\n* `node[\"java\"][\"install_flavor\"]` - Flavor of JVM you would like installed (`sun` or `openjdk`), default `openjdk`.\n\n---\nRecipes\n=======\n\ndefault\n-------\n\nInclude the default recipe in a run list, to get `java`. By default the `openjdk` flavor of Java is installed, but this can be changed by using the `install_flavor` attribute.\n\nopenjdk\n-------\n\nThis recipe installs the `openjdk` flavor of Java.\n\nsun\n---\n\nThis recipe installs the `sun` flavor of Java. \n\nOn Debian and Ubuntu systems the recipe will add the correct apt repository (`non-free` on Debian or `partner` on Ubuntu), pre-seed the package and update java alternatives.\n\nOn Red Hat flavored Linux (RHEL, CentOS, Fedora), the installation of the Sun flavor of Java is slightly more complicated as the `rpm` package is not readily available in any public Yum repository. The Sun JDK `rpm` package can be downloaded directly from Sun but comes wrapped as a compressed bin file. After the file has been downloaded, decompressed and license accepted the `rpm` package (names something like `jdk-6u25-ea-linux-amd64.rpm`) can be retrieved by this recipe using the `remote_file` or `cookbook_file` resources. The recipe will choose the correct resource based on the existence (or non-existence) of the `node['sun']['rpm_url']` attribute. See below for an example role using this attribute in the proper way. If you would like to deliver the `rpm` package file as part of this cookbook place the `rpm` package file in the `files/default` directory and the cookbook will retrieve the file during installation.\n\n---\nUsage\n=====\n\nSimply include the `java` recipe where ever you would like Java installed. \n\nTo install Sun flavored Java on Debian or Ubuntu override the `node['java']['install_flavor']` attribute with in role:\n\n name \"java\"\n description \"Install Sun Java on Ubuntu\"\n override_attributes(\n \"java\" => {\n \"install_flavor\" => \"sun\"\n }\n )\n run_list(\n \"recipe[java]\"\n )\n\nOn RedHat flavored Linux be sure to set the `rpm_url` and `rpm_checksum` attributes if you placed the `rpm` file on a remote server:\n\n name \"java\"\n description \"Install Sun Java on CentOS\"\n override_attributes(\n \"java\" => {\n \"install_flavor\" => \"sun\",\n \"version\" => \"6u25\",\n \"rpm_url\" => \"https://mycompany.s3.amazonaws.com/sun_jdk\",\n \"rpm_checksum\" => \"c473e3026f991e617710bad98f926435959303fe084a5a31140ad5ad75d7bf13\"\n }\n )\n run_list(\n \"recipe[java]\"\n )\n\nLicense and Author\n==================\n\nAuthor:: Seth Chisamore (<schisamo@opscode.com>)\n\nCopyright:: 2008-2011, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
5
+ "maintainer": "Opscode, Inc.",
6
+ "maintainer_email": "cookbooks@opscode.com",
7
+ "license": "Apache 2.0",
8
+ "platforms": {
9
+ "debian": [
10
+
11
+ ],
12
+ "ubuntu": [
13
+
14
+ ],
15
+ "centos": [
16
+
17
+ ],
18
+ "redhat": [
19
+
20
+ ],
21
+ "fedora": [
22
+
23
+ ]
24
+ },
25
+ "dependencies": {
26
+ "apt": [
27
+
28
+ ]
29
+ },
30
+ "recommendations": {
31
+ },
32
+ "suggestions": {
33
+ },
34
+ "conflicting": {
35
+ },
36
+ "providing": {
37
+ },
38
+ "replacing": {
39
+ },
40
+ "attributes": {
41
+ },
42
+ "groupings": {
43
+ },
44
+ "recipes": {
45
+ "java": "Installs Java runtime",
46
+ "java::openjdk": "Installs the OpenJDK flavor of Java",
47
+ "java::sun": "Installs the Sun flavor of Java"
48
+ },
49
+ "version": "1.1.0"
50
+ }
@@ -0,0 +1,16 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Installs Java runtime."
5
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6
+ version "1.1"
7
+
8
+ depends "apt"
9
+
10
+ recipe "java", "Installs Java runtime"
11
+ recipe "java::openjdk", "Installs the OpenJDK flavor of Java"
12
+ recipe "java::sun", "Installs the Sun flavor of Java"
13
+
14
+ %w{ debian ubuntu centos redhat fedora }.each do |os|
15
+ supports os
16
+ end
@@ -0,0 +1,21 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Cookbook Name:: java
4
+ # Recipe:: default
5
+ #
6
+ # Copyright 2008-2011, Opscode, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ include_recipe "java::#{node['java']['install_flavor']}"
@@ -0,0 +1,39 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Cookbook Name:: java
4
+ # Recipe:: openjdk
5
+ #
6
+ # Copyright 2010-2011, Opscode, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+
20
+ pkgs = value_for_platform(
21
+ ["centos","redhat","fedora"] => {
22
+ "default" => ["java-1.6.0-openjdk","java-1.6.0-openjdk-devel"]
23
+ },
24
+ "default" => ["openjdk-6-jdk","default-jdk"]
25
+ )
26
+
27
+ execute "update-java-alternatives" do
28
+ command "update-java-alternatives -s java-6-openjdk"
29
+ returns [0,2]
30
+ action :nothing
31
+ only_if { platform?("ubuntu", "debian") }
32
+ end
33
+
34
+ pkgs.each do |pkg|
35
+ package pkg do
36
+ action :install
37
+ notifies :run, "execute[update-java-alternatives]"
38
+ end
39
+ end
@@ -0,0 +1,93 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Cookbook Name:: java
4
+ # Recipe:: sun
5
+ #
6
+ # Copyright 2010-2011, Opscode, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+
20
+ pkgs = value_for_platform(
21
+ ["centos","redhat","fedora"] => {
22
+ "default" => ["jdk-#{node['java']['version']}-ea-linux-#{node['java']['arch']}.rpm"]
23
+ },
24
+ ["debian","ubuntu"] => {
25
+ "default" => ["sun-java6-jdk"]
26
+ }
27
+ )
28
+
29
+ case node['platform']
30
+ when "ubuntu"
31
+
32
+ apt_repository "ubuntu-partner" do
33
+ uri "http://archive.canonical.com/ubuntu"
34
+ distribution node['lsb']['codename']
35
+ components ['partner']
36
+ action :add
37
+ end
38
+ # update-java-alternatives doesn't work with only sun java installed
39
+ node.set['java']['java_home'] = "/usr/lib/jvm/java-6-sun"
40
+
41
+ when "debian"
42
+
43
+ apt_repository "debian-non-free" do
44
+ uri "http://http.us.debian.org/debian"
45
+ distribution "stable"
46
+ components ['main','contrib','non-free']
47
+ action :add
48
+ end
49
+ # update-java-alternatives doesn't work with only sun java installed
50
+ node.set['java']['java_home'] = "/usr/lib/jvm/java-6-sun"
51
+
52
+ when "centos", "redhat", "fedora"
53
+
54
+ pkgs.each do |pkg|
55
+ if node['java'].attribute?('rpm_url')
56
+ remote_file "#{Chef::Config[:file_cache_path]}/#{pkg}" do
57
+ source "#{node['java']['rpm_url']}/#{pkg}"
58
+ checksum node['java']['rpm_checksum']
59
+ mode "0644"
60
+ end
61
+ else
62
+ cookbook_file "#{Chef::Config[:file_cache_path]}/#{pkg}" do
63
+ source pkg
64
+ mode "0644"
65
+ action :create_if_missing
66
+ end
67
+ end
68
+ end
69
+
70
+ else
71
+ Chef::Log.error("Installation of Sun Java packages not supported on this platform.")
72
+ end
73
+
74
+ execute "update-java-alternatives" do
75
+ command "update-java-alternatives -s java-6-sun"
76
+ returns [0,2]
77
+ action :nothing
78
+ only_if { platform?("ubuntu", "debian") }
79
+ end
80
+
81
+ pkgs.each do |pkg|
82
+ package pkg do
83
+ case node['platform']
84
+ when "ubuntu", "debian"
85
+ response_file "java.seed"
86
+ when "centos", "redhat", "fedora"
87
+ source "#{Chef::Config[:file_cache_path]}/#{pkg}"
88
+ options "--nogpgcheck" # sun/oracle doesn't sign their RPMs o_O
89
+ end
90
+ action :install
91
+ notifies :run, "execute[update-java-alternatives]"
92
+ end
93
+ end
@@ -0,0 +1,2 @@
1
+ default[:jruby][:version] = "1.6.5"
2
+ default[:jruby][:checksum] = "e15a273b"
@@ -0,0 +1,24 @@
1
+ include_recipe "java"
2
+
3
+ version = node[:jruby][:version]
4
+
5
+ remote_file "/usr/src/jruby-bin-#{version}.tar.gz" do
6
+ source "http://jruby.org.s3.amazonaws.com/downloads/#{version}/jruby-bin-#{version}.tar.gz"
7
+ checksum node[:jruby][:checksum]
8
+ end
9
+
10
+ execute "untar jruby" do
11
+ command "tar xzf /usr/src/jruby-bin-#{version}.tar.gz "
12
+ cwd "/usr/local/lib"
13
+ creates "/usr/local/lib/jruby-#{version}"
14
+ end
15
+
16
+ link "/usr/local/jruby" do
17
+ to "/usr/local/lib/jruby-#{version}"
18
+ end
19
+
20
+ %w( jruby jirb jgem ).each do |b|
21
+ link "/usr/local/bin/#{b}" do
22
+ to "/usr/local/jruby/bin/#{b}"
23
+ end
24
+ end