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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubygems/rubygems-chef
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 987b1f333d79
Choose a base ref
...
head repository: rubygems/rubygems-chef
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cfaef463d144
Choose a head ref
  • 6 commits
  • 8 files changed
  • 1 contributor

Commits on May 12, 2015

  1. Copy the full SHA
    d8601d6 View commit details
  2. Copy the full SHA
    98d145f View commit details
  3. Copy the full SHA
    bf846ba View commit details
  4. add missing vaults

    dwradcliffe committed May 12, 2015
    Copy the full SHA
    5602573 View commit details
  5. fix ruby syntax

    dwradcliffe committed May 12, 2015
    Copy the full SHA
    48287f1 View commit details
  6. add missing dependency

    dwradcliffe committed May 12, 2015
    Copy the full SHA
    cfaef46 View commit details
9 changes: 0 additions & 9 deletions .chef/bootstrap/rubygems-trusty.erb
Original file line number Diff line number Diff line change
@@ -5,15 +5,6 @@ hostname -F /etc/hostname

echo "`ip addr | grep eth0 | grep "inet " | cut -d " " -f 6 | cut -d \/ -f 1` `cat /etc/hostname`" >> /etc/hosts

# fetch the rubygems package signing public key and add it to the apt keyring
curl http://repo01.common.rubygems.org/packages.key | sudo apt-key add -

# remove the AWS repos
rm -f /etc/apt/sources.list

# add the internal apt repo
sh -c "echo \"deb http://repo01.common.rubygems.org trusty main\" > /etc/apt/sources.list.d/rubygems_main.list"

apt-get update
apt-get upgrade -y

2 changes: 1 addition & 1 deletion Berksfile.lock
Original file line number Diff line number Diff line change
@@ -299,7 +299,7 @@ GRAPH
rsyslog (>= 0.0.0)
rubygems-ruby (>= 0.0.0)
runit (>= 0.0.0)
rubygems-logging (0.0.68)
rubygems-logging (0.0.69)
chef-vault (>= 0.0.0)
elasticsearch (>= 0.0.0)
kibana_lwrp (>= 0.0.0)
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -23,9 +23,11 @@ end
desc 'Refresh all chef vaults'
task :refresh_vaults do
[
'apps/kibana',
'aws/credentials',
'certs/production',
'certs/staging',
'certs/logstash',
'datadog/credentials',
'dnsimple/credentials',
'duo/credentials',
3 changes: 2 additions & 1 deletion cookbooks/rubygems-logging/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name 'rubygems-logging'
maintainer 'RubyGems.org ops team'

version '0.0.68'
version '0.0.69'

depends 'chef-vault'
depends 'elasticsearch'
depends 'java'
depends 'kibana_lwrp'
depends 'logstash'
depends 'nginx'
2 changes: 1 addition & 1 deletion cookbooks/rubygems-logging/recipes/client.rb
Original file line number Diff line number Diff line change
@@ -89,6 +89,6 @@
end

service 'logstash-forwarder' do
supports :status => true, :restart => true, :reload => true
supports status: true, restart: true, reload: true
action config['files'].empty? ? [:disable, :stop] : [:enable, :start]
end
9 changes: 9 additions & 0 deletions cookbooks/rubygems-logging/recipes/server_nginx.rb
Original file line number Diff line number Diff line change
@@ -32,6 +32,15 @@
notifies :reload, 'service[nginx]'
end

auth_bag = chef_vault_item('apps', 'kibana')

file "#{node['nginx']['dir']}/htpasswd" do
owner 'root'
group 'root'
mode '0644'
content "#{auth_bag['user']}:#{auth_bag['htpasswd']}"
end

template "#{node['nginx']['dir']}/sites-available/kibana" do
source 'nginx.conf.erb'
owner 'root'
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ filter {
rename => [ 'logsource', 'host' ]
}
}

if [type] == 'rails' {
grok {
match => [
@@ -12,6 +13,7 @@ filter {
]
}
}

if [type] == 'nginx_json' {
json {
source => 'message'
@@ -20,4 +22,60 @@ filter {
source => 'client_ip'
}
}

if [type] == 'nginx_error' {
grok {
match => {
"message" => [
"%{DATESTAMP:mydate} \[%{DATA:severity_label}\] (%{DATA:pid}#%{NUMBER}: \*%{NUMBER}|\*%{NUMBER}) %{GREEDYDATA:mymessage}",
"%{DATESTAMP:mydate} \[%{DATA:severity_label}\] %{GREEDYDATA:mymessage}",
"%{DATESTAMP:mydate} %{GREEDYDATA:mymessage}"
]
}
}
date {
match => [ "mydate", "yy/MM/dd HH:mm:ss" ]
remove_field => ["mydate"]
}
grok {
match => {
"mymessage" => [
"host: \"%{IPORHOST:[dest_host]}\""
]
}
add_tag => ["add_nginx_error_dest_host"]
}
grok {
match => {
"mymessage" => [
"request: \"%{WORD:[method]} %{DATA:[uri]} HTTP/%{NUMBER:[http_version]:float}\""
]
}
add_tag => ["add_nginx_error_request"]
}
grok {
match => {
"mymessage" => [
"client: %{IPORHOST:[client_ip]}",
"client %{IP:[client_ip]} "
]
}
add_tag => ["add_nginx_error_client_ip"]
}
grok {
match => {
"mymessage" => [
"referrer: \"%{DATA:[request_referrer]}\""
]
}
add_tag => ["add_nginx_error_referrer"]
}
geoip {
source => 'client_ip'
}
mutate {
rename => [ "message", "original_message"]
rename => [ "mymessage", "message" ]
}
}
}
3 changes: 3 additions & 0 deletions cookbooks/rubygems-logging/templates/default/nginx.conf.erb
Original file line number Diff line number Diff line change
@@ -18,6 +18,9 @@ server {
proxy_set_header Host $host;
proxy_redirect off;

auth_basic "logs.rubygems.org";
auth_basic_user_file /etc/nginx/htpasswd;

location / {
proxy_pass http://localhost:5601;
}