Skip to content

Instantly share code, notes, and snippets.

View irvingpop's full-sized avatar

Irving Popovetsky irvingpop

View GitHub Profile
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
@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>
@irvingpop
irvingpop / chef-client-cleanup.rb
Created August 6, 2017 17:25
Bit of systemd chef code to have clients automatically remove themselves on shutdown
# Create a systemd service that runs at shutdown to remove one's node and client from the chef server,
# useful in AutoScale and Terraform-managed scenarios
# not useful in cases where you may want to shutdown (but not terminate) a node
systemd_unit 'chef-cleanup.service' do
content('Unit' => {
'Description' => 'Delete my own Chef node and client objects at shutdown/termination',
'DefaultDependencies' => 'no',
'Before' => 'shutdown.target halt.target',
},
@irvingpop
irvingpop / dna.json.tpl
Last active September 7, 2020 11:49
chef-solo like solution for Terraform
{
"mycookbook": {
"attribute1": "${attribute1}",
"attribute2": "${attribute2}"
},
"run_list": [
"recipe[${recipe}]"
]
}
@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 / 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 / 1important_links.md
Last active September 26, 2017 12:56
Operating the Chef Server at Scale - ChefConf Workshop 2016
@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 / ha_drbd.md
Last active July 16, 2021 10:18
Cloning a Chef Server 12 installation

Customer Scenario

A customer has a Chef Server 12 (HA - DRBD) in Production. They want to test an in-place upgrade (or maintenance) using their current OPC Production data and config. This gives us a good chance to make corrections if we find that their data is too broken for the migrations to handle, and gives the customer experience in managing the upgrade in Production.

The sequence of events will broadly be these:

  • Install the same version of Chef Server on the target HA Test cluster
  • Restore data from Production instance backup (LVM snapshot or full-stop backup)
  • Test
@irvingpop
irvingpop / sane_defaults.rb
Created October 31, 2015 17:59
Vagrant: Irving's sane defaults for Virtualbox with better performance
# replaces this file /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/providers/virtualbox/action/sane_defaults.rb
# NOTE: if using a different Vagrant version, adjust the version field accordingly
# NOTE2: only the sections with the IRVING comment have been changed from the default
require "log4r"
module VagrantPlugins
module ProviderVirtualBox
module Action
class SaneDefaults