Skip to content

Instantly share code, notes, and snippets.

@jeremiahsnapp
jeremiahsnapp / gist:dcbcebf600a0a535491dc3ae4910a1e1
Last active March 22, 2017 19:37
Reconciling Chef Server database and Solr index inconsistencies

Sometimes a database object can get deleted but the Solr index entry will remain.

This can cause problems such as infinite Chef Search API request loops (for knife and I believe for Manage).

The following procedure identifies remaining index entries and provides a way to delete them.

# set the name of the organization you are interested in
export ORG_NAME=demo
@afiune
afiune / README.md
Last active February 21, 2018 19:36
Automate LDAP Bulking User Creation

LDAP Bulking User Creation Process

This is temporal automation to create multiple LDAP users in Chef Automate.

Prerequisites

The minimum prerequisites to be able to use this automation are:

@double-z
double-z / cleanup_bifrost.rb
Created December 22, 2015 17:28
Script For Cleaning Up invalid users and clients in Bifrost DB
require 'pg'
add_command_under_category "cleanup-bifrost", "cleanup", "Cleanup orphaned bifrost objects.", 2 do
erchef_db = setup_erchef_db
bifrost_db = setup_bifrost_db
puts "Populating hash of valid clients and users."
clients_and_users = erchef_db.exec_params("SELECT authz_id FROM clients UNION select authz_id FROM users")
real_actor_list = []
clients_and_users.each do |real_actor|
@alexpop
alexpop / kitchen_sink.rb
Last active March 16, 2017 10:04
Script to export Chef Server nodes and add them to Chef Compliance
# encoding: utf-8
### Sample script to export Chef Server nodes and import them to Chef Compliance
### Change the 'api_url', 'api_user', 'api_pass' and 'api_org' variables below
### Change the nodes_array json suit your environment
### Go to your chef-repo and check Chef Server access first
# cd chef-repo; knife environment list
### Save this Ruby script as kitchen_sink.rb and run it like this:
# cat kitchen_sink.rb | knife exec
### Chef Compliance API docs: https://docs.chef.io/api_compliance.html
@afiune
afiune / delivery_publish_cookbook_multiple_chef_server.md
Last active July 19, 2017 20:58
Delivery Publish Cookbook to Multiple Chef Server/Organizations

Publish Cookbook to Multiple Chef Servers in Delivery

Our delivery-sugar cookbook exposes some libraries and a LWRP that we can use to publish a cookbook (or multiple) to multiple Chef Servers or Organizations.

Prerequisites

The only prerequisite we have before start coding is the generation of the knife.rb and the client_key on the build-nodes that we will use in the build-cookbook. This can be done manually by loging in to the build-nodes and laying down the file, or in an

@kmacgugan
kmacgugan / gist:6f494716d0b5a35d2ff7
Last active November 13, 2015 19:05
postgres size analysis
--Questions for customer:
--- How many client nodes are you running?
--- Are they windows, linux or mixed?
-- Oldest data in activities
select min(recorded_at) from public.activities;
--how many rows over the past week per day
select count(*), date_part('day', recorded_at) from public.activities where recorded_at > now() - INTERVAL '7 days' group by 2;
@jeremiahsnapp
jeremiahsnapp / 01_setup_dev-lxc.md
Last active July 19, 2016 07:52
Quick Setup dev-lxc-platform
@sean-horn
sean-horn / erlang-redbug.md
Created February 23, 2015 21:34
erlang redbug debugging of ldap
@irvingpop
irvingpop / lvm-snapshot-perftest.rb
Last active November 19, 2018 03:23
LVM + Snapshot performance testing
#!/usr/bin/env ruby
LVM_LV = '/dev/opscode/drbd'
LVM_LV_MOUNT = '/var/opt/opscode/drbd/data'
LVM_SNAP_SIZE = '16G'
FILE_SIZE_MB = 1024
NUM_FILES = 15
def write_files(iterations)
aggregate_speed = 0
@mrflip
mrflip / 20130416-todo.md
Last active January 21, 2024 21:06
Elasticsearch Tuning Plan

Next Steps

  • Measure time spend on index, flush, refresh, merge, query, etc. (TD - done)
  • Take hot threads snapshots under read+write, read-only, write-only (TD - done)
  • Adjust refresh time to 10s (from 1s) and see how load changes (TD)
  • Measure time of a rolling restart doing disable_flush and disable_recovery (TD)
  • Specify routing on query -- make it choose same node for each shard each time (MD)
  • GC new generation size (TD)
  • Warmers
  • measure before/after of client query time with and without warmers (MD)