Skip to content

Commit 1eca4d7

Browse files
committed
version 0.1.0
1 parent 3ea9cda commit 1eca4d7

File tree

9 files changed

+266
-2
lines changed

9 files changed

+266
-2
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.vagrant
2+
Vagrantfile.rb
3+
Berksfile.lock
4+
5+
.idea
6+
7+
.kitchen/
8+
.kitchen.local.yml

.kitchen.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
driver:
3+
name: vagrant
4+
linked_clone: true
5+
6+
provisioner:
7+
name: chef_zero
8+
9+
verifier:
10+
name: inspec
11+
format: documentation
12+
13+
platforms:
14+
- name: ubuntu-16.04
15+
- name: ubuntu-14.04
16+
- name: ubuntu-12.04
17+
- name: debian-8.5
18+
- name: debian-7.10
19+
- name: debian-6.0.10
20+
- name: fedora-24
21+
- name: fedora-23
22+
- name: fedora-19
23+
driver:
24+
box: opscode-fedora-19
25+
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode-fedora-19_provisionerless.box
26+
- name: centos-7.2
27+
- name: centos-6.8
28+
- name: centos-5.9
29+
driver_config:
30+
box: opscode-centos-5.9
31+
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
32+
33+
suites:
34+
- name: default
35+
run_list:
36+
- recipe[stackify_agent::default]
37+
attributes:
38+
stackify:
39+
stackify_agent:
40+
agent_url: <%= ENV['STACKIFY_AGENT_URL'] %>
41+
environment: <%= ENV['STACKIFY_AGENT_ENVIRONMENT'] %>
42+
key: <%= ENV['STACKIFY_AGENT_KEY'] %>

Berksfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://supermarket.chef.io'
2+
3+
metadata

README.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,51 @@
1-
# stackify-cookbooks
2-
Stackify CHEF Cookbooks
1+
2+
# stackify_agent cookbook
3+
4+
## Description
5+
6+
Cookbook provides **Stackify Linux Agent** installation.
7+
8+
## Requirements
9+
10+
### Cookbooks
11+
12+
* tar
13+
14+
### Platforms
15+
16+
* Ubuntu 12.04 or higher
17+
* Debian 6 or higher
18+
* Fedora 19 or higher
19+
* CentOS 5 or higher
20+
* RedHat Enterprise Linux 5 or higher
21+
* Amazon Linux
22+
23+
## Attributes
24+
25+
### default.rb:
26+
27+
#### Required
28+
29+
* `node['stackify']['stackify_agent']['environment']` - Stackify environment name.
30+
* `node['stackify']['stackify_agent']['key']` - Stackify activation key.
31+
32+
#### Optional
33+
34+
##### HTTP Proxy Configuration
35+
* `node['stackify']['stackify_agent']['proxy']['host']` - Hostname/IP of HTTP proxy.
36+
* `node['stackify']['stackify_agent']['proxy']['port']` - Port of HTTP proxy.
37+
* `node['stackify']['stackify_agent']['proxy']['cert_filename']` - The certificates that are used by the proxy may not be trusted by the \ default trust manager in Java. By using this property, the Stackify agent will trust the certificates coming from the proxy. The property should be set to the full path of the proxy's certificate. This setting is optional, but may be required depending on your configuration.
38+
39+
##### Service Discovery Toggles
40+
* `node['stackify']['stackify_agent']['discovery']['apache']` - Discover Apache webapps, defaults to true.
41+
* `node['stackify']['stackify_agent']['discovery']['nginx']` - Discover NGINX webapps, defaults to true.
42+
* `node['stackify']['stackify_agent']['discovery']['jboss']` - Discover JBoss webapps, defaults to true.
43+
* `node['stackify']['stackify_agent']['discovery']['tomcat']` - Discover Tomcat webapps, defaults to true.
44+
* `node['stackify']['stackify_agent']['discovery']['nodejs']` - Discover Node.js webapps, defaults to true.
45+
46+
##### Additional Options
47+
* `node['stackify']['stackify_agent']['uid']` - Custom ID for stackify user.
48+
* `node['stackify']['stackify_agent']['gid']` - Custom ID for stackify group.
49+
* `node['stackify']['stackify_agent']['docker']` - Use when installing on a docker host. Adds `stackify` user to `docker` user group. Defaults to false.
50+
* `node['stackify']['stackify_agent']['disablesudo']` - Install with restricted permissions for `stackify` user, defaults to false.
51+
* `node['stackify']['stackify_agent']['agent_url']` - Override download URL for Stackify Agent.

attributes/default.rb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# Cookbook Name:: stackify_agent
3+
# Attributes:: default
4+
#
5+
# Copyright (c) 2016, Stackify
6+
#
7+
8+
######################
9+
# Basic Configuration
10+
######################
11+
12+
# Your Stackify environment name
13+
default['stackify']['stackify_agent']['environment'] = nil
14+
# Your Stackify activation key
15+
default['stackify']['stackify_agent']['key'] = nil
16+
17+
#########################
18+
# Advanced Configuration
19+
#########################
20+
21+
# HTTP Proxy settings
22+
default['stackify']['stackify_agent']['proxy']['host'] = nil
23+
default['stackify']['stackify_agent']['proxy']['port'] = nil
24+
default['stackify']['stackify_agent']['proxy']['cert_filename'] = nil
25+
26+
# Enable/Disable auto discovery services
27+
default['stackify']['stackify_agent']['discovery']['apache'] = true
28+
default['stackify']['stackify_agent']['discovery']['nginx'] = true
29+
default['stackify']['stackify_agent']['discovery']['jboss'] = true
30+
default['stackify']['stackify_agent']['discovery']['tomcat'] = true
31+
default['stackify']['stackify_agent']['discovery']['nodejs'] = true
32+
33+
# Custom ID for stackify user
34+
default['stackify']['stackify_agent']['uid'] = nil
35+
# Custom ID for stackify group
36+
default['stackify']['stackify_agent']['gid'] = nil
37+
# Add stackify user to docker group
38+
default['stackify']['stackify_agent']['docker'] = false
39+
# Disable sudo access for stackify user
40+
default['stackify']['stackify_agent']['disablesudo'] = false
41+
# Stackify Agent download URL
42+
default['stackify']['stackify_agent']['agent_url'] = 'https://s1.stackify.com/Account/AgentDownload/Linux'

metadata.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name 'stackify_agent'
2+
maintainer 'Stackify'
3+
maintainer_email 'support@stackify.com'
4+
description 'Installs/Configures Stackify Agent'
5+
long_description 'Installs/Configures Stackify Agent'
6+
version '0.1.0'
7+
8+
%w(debian ubuntu redhat centos fedora amazon).each do |os|
9+
supports os
10+
end
11+
12+
source_url 'https://github.com/stackify/stackify-agent-cookbook'
13+
issues_url 'https://github.com/stackify/stackify-agent-cookbook/issues'
14+
15+
depends 'tar'

recipes/default.rb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Cookbook Name:: stackify_agent
3+
# Recipe:: default
4+
#
5+
# Copyright (c) 2016, Stackify
6+
#
7+
8+
stackify_agent_jar_location = '/usr/local/stackify/stackify-agent/stackify-agent.jar'
9+
stackify_agent_install_relative_path = 'stackify-agent-install-32bit'
10+
stackify_agent_install_script_name = 'agent-install.sh'
11+
12+
# agent install script options
13+
stackify_agent_install_script_options = " --key #{node['stackify']['stackify_agent']['key']}"
14+
stackify_agent_install_script_options << " --environment #{node['stackify']['stackify_agent']['environment']}"
15+
16+
stackify_agent_install_script_options << " --uid #{node['stackify']['stackify_agent']['uid']}" unless node['stackify']['stackify_agent']['uid'] == nil?
17+
stackify_agent_install_script_options << " --gid #{node['stackify']['stackify_agent']['gid']}" unless node['stackify']['stackify_agent']['gid'] == nil?
18+
stackify_agent_install_script_options << " --docker " if node['stackify']['stackify_agent']['docker']
19+
stackify_agent_install_script_options << " --disablesudo " if node['stackify']['stackify_agent']['disablesudo']
20+
21+
# download and extract stackify agent
22+
tar_extract node['stackify']['stackify_agent']['agent_url'] do
23+
target_dir Chef::Config['file_cache_path']
24+
creates "#{Chef::Config['file_cache_path']}/#{stackify_agent_install_relative_path}/#{stackify_agent_install_script_name}"
25+
not_if { File.exist?(stackify_agent_jar_location) }
26+
end
27+
28+
template_file = "#{Chef::Config['file_cache_path']}/#{stackify_agent_install_relative_path}/stackify-agent.conf"
29+
template template_file do
30+
source "stackify-agent.conf.erb"
31+
end
32+
33+
# run stackify agent install script
34+
bash 'agent_install' do
35+
user 'root'
36+
cwd "#{Chef::Config['file_cache_path']}/#{stackify_agent_install_relative_path}"
37+
code <<-EOH
38+
./#{stackify_agent_install_script_name} #{stackify_agent_install_script_options}
39+
rm -rf #{Chef::Config['file_cache_path']}/Linux
40+
rm -rf #{Chef::Config['file_cache_path']}/#{stackify_agent_install_relative_path}
41+
EOH
42+
not_if { File.exist?(stackify_agent_jar_location) }
43+
end
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Stackify Configuration
2+
3+
sudoDisabled=<%= node['stackify']['stackify_agent']['disablesudo'] %>
4+
5+
# Discovery Configuration
6+
7+
discovery.apache=<%= node['stackify']['stackify_agent']['discovery']['apache'] %>
8+
discovery.nginx=<%= node['stackify']['stackify_agent']['discovery']['nginx'] %>
9+
discovery.jboss=<%= node['stackify']['stackify_agent']['discovery']['jboss'] %>
10+
discovery.tomcat=<%= node['stackify']['stackify_agent']['discovery']['tomcat'] %>
11+
discovery.nodejs=<%= node['stackify']['stackify_agent']['discovery']['nodejs'] %>
12+
13+
# HTTP Proxy Configuration
14+
15+
# The http.proxyHost and http.proxyPort properties define the proxy host
16+
# and port for all HTTP connections.
17+
<% if node['stackify']['stackify_agent']['proxy']['host'] != nil -%>
18+
http.proxyHost=<%= node['stackify']['stackify_agent']['proxy']['host'] %>
19+
<% else -%>
20+
#http.proxyHost=
21+
<% end -%>
22+
<% if node['stackify']['stackify_agent']['proxy']['port'] != nil -%>
23+
http.proxyPort=<%= node['stackify']['stackify_agent']['proxy']['port'] %>
24+
<% else -%>
25+
#http.proxyPort=
26+
<% end -%>
27+
28+
# The certificates that are used by the proxy may not be trusted by the
29+
# default trust manager in Java. By using the http.proxyCert property, the
30+
# Stackify agent will trust the certificates coming from the proxy. The
31+
# property should be set to the full path of the proxy's certificate. This
32+
# setting is optional, but may be required depending on your configuration.
33+
<% if node['stackify']['stackify_agent']['proxy']['cert_filename'] != nil -%>
34+
http.proxyCert=<%= node['stackify']['stackify_agent']['proxy']['cert_filename'] %>
35+
<% else -%>
36+
#http.proxyCert=
37+
<% end -%>
38+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
# test that agent service is installed and running
3+
describe service('stackify-agent') do
4+
it { should be_installed }
5+
it { should be_running }
6+
end
7+
8+
# test that agent jar file exists
9+
describe file('/usr/local/stackify/stackify-agent/stackify-agent.jar') do
10+
it { should be_file }
11+
its('owner') { should eq 'stackify' }
12+
end
13+
14+
# test that agent-apm jar file exists
15+
describe file('/usr/local/stackify/stackify-java-apm/stackify-java-apm.jar') do
16+
it { should be_file }
17+
its('owner') { should eq 'stackify' }
18+
end
19+
20+
# test that agent log file exists
21+
describe file('/usr/local/stackify/stackify-agent/log/stackify-agent.log') do
22+
it { should be_file }
23+
its('owner') { should eq 'stackify' }
24+
end

0 commit comments

Comments
 (0)