Skip to content

Instantly share code, notes, and snippets.

View irvingpop's full-sized avatar

Irving Popovetsky irvingpop

View GitHub Profile
@irvingpop
irvingpop / Ubuntu-1404.md
Last active August 29, 2015 14:11
Chef Server HA & DRBD performance tuning

backend systems:

  • c3.2xlarge - EBS optimized and Enhanced Networking enabled
  • DRBD backing volume: 80 GB SSD (ec2 ephemeral storage /dev/xvdb)
  • Ubuntu Trusty official release from 11/26/2014
  • DRBD 8.4.3 (packaged in Ubuntu kernel extras package)
root@ip-ub-backend1:~# uname -a
Linux ip-ub-backend1.trusty.aws 3.13.0-40-generic #69-Ubuntu SMP Thu Nov 13 17:53:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
@irvingpop
irvingpop / tk-windows-guest-working.md
Last active August 29, 2015 14:17
test-kitchen Windows guest working

As of March 24, 2015 that the 'windows-guest-support' branch of test-kitchen has been merged to master, but not the equivalent kitchen-vagrant branch.

Using the Windows cookbook, Gemfile like so:

source "https://rubygems.org"

group :development do
  gem "test-kitchen", :git => 'https://github.com/test-kitchen/test-kitchen.git'
  gem 'kitchen-vagrant', git: 'https://github.com/test-kitchen/kitchen-vagrant.git', :branch => 'windows-guest-support'
  gem "berkshelf"
@irvingpop
irvingpop / opscode-analytics.rb
Created June 3, 2015 00:08
Analytics performance config
# NOTE: set all of the workers values to equal the number of CPU cores on the Analytics server
analytics_fqdn "analytics.trusty.aws"
topology "standalone"
alaska['max_task_parallelism'] = 130
alaska['action_queue'] = {}
alaska['action_queue']['workers'] = 8
alaska['action_queue']['max_spout_pending'] = 100
@irvingpop
irvingpop / erchef_bifrost_metrics.escript
Last active October 21, 2015 22:46
Chef server metrics with escript!
#!/opt/opscode/embedded/bin/escript
-define(SELF, 'monitor@127.0.0.1').
-define(BIFROST, 'oc_bifrost@127.0.0.1').
-define(BIFROST_COOKIE, 'oc_bifrost').
-define(ERCHEF, 'erchef@127.0.0.1').
-define(ERCHEF_COOKIE, 'erchef').
get_waiting(Node, Cookie) ->
erlang:set_cookie(node(), Cookie),
@irvingpop
irvingpop / 1upgrade_issue_for_purged_data.md
Last active January 20, 2016 21:05
Addendum for Reporting 1.5.6 release

Note to customers have used the data purging feature (—remove-partitions) introduced in Reporting 1.3.0

Due to a bug in the upgrade process, If you’ve removed any of the 2015 data partitions the upgrade will fail. To determine if this applies to you, as well as to resolve the issue, run the following steps on your Standalone or Primary Backend Chef Server:

  1. To see if you’ve removed them, query the list of reporting tables and verify that you have node_run_2015_* and node_run_detail_2015_* tables (12 of each):
# sudo -u opscode-pgsql /opt/opscode/embedded/bin/psql opscode_reporting -c "\dt"
could not change directory to "/root"
                    List of relations
@irvingpop
irvingpop / advanced-chef-server-admin.md
Last active July 16, 2016 18:11
Messing around with Chef Server admin functions beyond knife-opc

Connecting to your Chef server as an admin, via the API

# launch pry
/opt/opscode/embedded/bin/pry 
[1] pry(main)> require 'chef/rest'
=> true

# create a Chef::REST object pointed at localhost with the pivotal user and pivotal.pem (required for admin operations)
[2] pry(main)> chef_rest = Chef::REST.new('https://localhost/', 'pivotal', '/etc/opscode/pivotal.pem')
@irvingpop
irvingpop / tuning_chef_elasticsearch.sh
Last active December 16, 2016 17:51
Tuning Chef ElasticSearch Index
#!/bin/bash
# Tune the elasticsearch shard and replica count after chef-backend has been setup, but before any Frontends have been configured
# based on the following docs:
# https://www.elastic.co/guide/en/elasticsearch/guide/current/replica-shards.html
# https://www.elastic.co/guide/en/elasticsearch/guide/current/_scale_horizontally.html
# https://www.elastic.co/blog/clustering_across_multiple_data_centers
#
# This process will change once this Chef Server PR has been accepted:
# https://github.com/chef/chef-server/pull/988
@irvingpop
irvingpop / install-windows-build-node.sh
Last active December 22, 2016 23:54
Install a Windows build node
#!/bin/bash -ex
# All of this is to be run from the Automate server, assumes you have a ChefDK installed there
# Step 0, supply the right windows IP, username, password
WINDOWS_HOST='10.42.46.165'
WINDOWS_USER='Administrator'
WINDOWS_PASSWORD='VerySecurePassword'
@irvingpop
irvingpop / ecs_automate.yaml
Last active September 6, 2017 21:01
Automate on Habitat on ECS, phase 1
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
KeyName:
Type: AWS::EC2::KeyPair::KeyName
Description: Name of an existing EC2 KeyPair to enable SSH access to the ECS instances.
VPC:
Type: AWS::EC2::VPC::Id
Description: Select a VPC that allows instances access to the Internet.
SubnetIds:
Type: List<AWS::EC2::Subnet::Id>
From 4fb2f312c60cd10f57c08051d4243d3e62b1fbfb Mon Sep 17 00:00:00 2001
From: Irving Popovetsky <irving@chef.io>
Date: Fri, 18 Aug 2017 13:05:55 -0700
Subject: [PATCH] Fix notifications habitat binds so that they can be optional
and remove an unneeded one for database
---
diff --git a/notifications/habitat/config/env b/notifications/habitat/config/env
index faa23c642..19d70da22 100644
--- a/notifications/habitat/config/env