Skip to content

Instantly share code, notes, and snippets.

View sax's full-sized avatar

Eric Saxby sax

View GitHub Profile
@sax
sax / smartos.erb
Last active December 16, 2015 15:39
SmartOS Chef bootstrap template
# Wanelo Universal Bootstrap Script (W.U.B.S.)
bash -c '
# Linux Distros:
if [ $(uname -s | grep Linux) ]; then
true && curl -s -L https://www.opscode.com/chef/install.sh | bash
# Illumos Distros:
elif [ $(uname -s | grep SunOS) ]; then
@sax
sax / build steps
Last active December 19, 2015 08:09
compile ruby 2.0.0-p247 with dtrace SUN D 1.11
pkgin -y in build-essential gcc47 gcc47-libs libyaml
wget -N http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar xvf ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247
export LDFLAGS='-R/opt/local -L/opt/local/lib'
CXXFLAGS="-m64 -O3 -g -Wall" bash ./configure --prefix=$HOME/ruby-2.0.0 --with-opt-dir=/opt/local --enable-shared ac_cv_func_dl_iterate_phdr=no CFLAGS="-R -fPIC" rb_cv_have_signbit=no
make
@sax
sax / bashrc
Created October 25, 2013 19:11
Nokogiri on Mavericks
export NOKOGIRI_USE_SYSTEM_LIBRARIES=1
#!/bin/bash
# Simple Ad Hoc Carbon Cache Service
#
# put in /opt/custom/share/svc/carbon-cache.sh
set -o xtrace
. /lib/svc/share/smf_include.sh
cd /
PATH=/usr/sbin:/usr/bin:/opt/custom/bin:/opt/custom/sbin; export PATH
@sax
sax / omnibus-chef-stderr.txt
Last active August 29, 2015 13:56
omnibus-chef fails on SmartOS 13.3.1
[health_check] *** Health Check Failed, Summary follows:
[health_check] *** The following Omnibus-built libraries have unsafe or unmet dependencies:
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/readline.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/psych.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/openssl.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/iconv.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/digest/sha2.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/digest/sha1.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/digest/rmd160.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/digest/md5.so
@sax
sax / 00_README.md
Last active August 29, 2015 13:56
Download latest SmartOS platform image and turn it into a VirtualBox VM

UPDATE: this has been made slightly more official by way of turning it into a repo: https://github.com/sax/vagrant-smartos-packager

Notes:

  • This will create files on the local disk
  • You'll probably want to create and cd into a working directory before doing any of this
  • This is very much a work in progress. This gist is to capture lots of tiny changes in code, without managing the horrible git history that would ensue in a real git repo. Once this works to completion, it's going into a github repo.

On local machine, download the latest SmartOS platform image and turn it into a virtualbox image:

@sax
sax / omnifuss.sh
Last active January 11, 2017 20:47
Create omnibus chef on SmartOS
pkgin -y install ruby193 gmake build-essential ;
gem install bundler --no-ri --no-rdoc
pushd /root
git clone https://github.com/opscode/omnibus-ruby
git clone https://github.com/opscode/omnibus-software
git clone https://github.com/opscode/omnibus-chef
pushd omnibus-chef
bundle install --binstubs
/root/omnibus-chef/bin/omnibus build project chef
@sax
sax / smartos_vagrant.md
Last active February 23, 2016 20:53
Smartos / Vagrant
  1. Install Vagrant

  2. Install SmartOS guest detection

vagrant plugin install vagrant-smartos-guest
  1. Install zones support
@sax
sax / forking_off_cpu.d
Last active August 29, 2015 14:03
Slow forking analysis
#!/usr/bin/dtrace
syscall::forksys:entry
/pid == $target/
{
self->tracing = 1;
}
syscall::forksys:return
/pid == $target/
@sax
sax / gist:061f95d3c159b1a7a315
Created July 19, 2014 01:35
Add nictag to SmartOS global zone and use it to add interface to local zone#
# global zone
MAC_ADDRESS=$(dladm show-phys -m e1000g1 | tail +2 | awk '{ print $3 }')
ZONENAME=$(zoneadm list | grep -v global)
nictagadm add external "${MAC_ADDRESS}"
echo '{"add_nics":[{"nic_tag":"external","ip":"dhcp"}]}' | vmadm update ${ZONENAME}