Skip to content

Instantly share code, notes, and snippets.

@dreamcat4
Created October 28, 2009 13:42
Show Gist options
  • Save dreamcat4/220489 to your computer and use it in GitHub Desktop.
Save dreamcat4/220489 to your computer and use it in GitHub Desktop.
# chef-server as ssh tunnel (reverse-proxy) for Mac OS X 10.6 SL
# Based loosely on Readme.rdoc - http://github.com/opscode/chef/
# port install CouchDB (may be broken on Snow Leopard)
sudo port install couchdb-devel
sudo launchctl load -w /Library/LaunchDaemons/org.apache.couchdb.plist
sudo launchctl unload -w /Library/LaunchDaemons/org.apache.couchdb.plist
# check for Trace/BPT trap error
couchdb
CTRL ^C
# patch broken seamonkey
http://www.ilyasterin.com/blog/2009/09/installing-couchdb-on-snow-leopard.html
# check couchdb is working
couchdb
open http://127.0.0.1:5984/
CTRL ^C
# create the _couchdb user.
export CDB_UID=213
sudo dscl . create /Users/_couchdb UniqueID $CDB_UID
sudo dscl . create /Users/_couchdb PrimaryGroupID $CDB_UID
sudo dscl . create /Users/_couchdb RealName "CouchDB Server"
sudo dscl . create /Users/_couchdb NFSHomeDirectory /usr/local/pgsql/
sudo dscl . create /Users/_couchdb Password "*"
sudo dscl . append /Users/_couchdb RecordName couchdb
# Then, create the _couchdb group.
sudo dscl . create /Groups/_couchdb
sudo dscl . create /Groups/_couchdb PrimaryGroupID $CDB_UID
sudo dscl . create /Groups/_couchdb RealName "CouchDB Users"
sudo dscl . append /Groups/_couchdb RecordName couchdb
# set permissions
sudo chown -R couchdb:couchdb /opt/local/lib/couchdb/ /opt/local/var/log/couchdb/
# start via launchctl
sudo launchctl load /Library/LaunchDaemons/org.apache.couchdb.plist
# see couchdb logs
open http://127.0.0.1:5984/_utils/index.html
# stop via launchctl
sudo launchctl unload /Library/LaunchDaemons/org.apache.couchdb.plist
# git clone Chef
git clone git://github.com/opscode/chef.git
# install gems
gem install ohai rake rspec cucumber webrat merb-core roman-merb_cucumber
# build chef gem, install chef
# (the rake task will use sudo gem install)
sudo rake dev:features
# log into web UI
open http://localhost.localdomain:4000
username: http://dreamcat4.myopenid.com/
# fork the config dir
open http://github.com/opscode/chef-repo
# click 'fork'
git clone git://github.com/dreamcat4/chef-repo.git
cd chef-repo
rm -rf cookbooks
git commit -a -m "remove empty cookbooks dir for subrepo"
# use official opscode cookbooks
gitnest add git://github.com/opscode/cookbooks.git
git push
# read chef cookbook documentation
open http://github.com/opscode/chef-repo/blob/master/config/server.rb.example
mate cookbooks/chef/README.rdoc
open http://github.com/opscode/cookbooks/blob/master/chef/README.rdoc
# or use else's cookbooks
gitnest remove cookbooks
gitnest add git://github.com/fujin/cookbooks.git
git push
# edit site settings
mate chef-repo/config/rake.rb
# edit the authorized_openid_providers list
# add localhost fqdn to /etc/hosts file
sudo sh -c "echo 127.0.0.1 chef.server >> /etc/hosts"
# rake install
cd chef
rake
# Install nginx + passenger via macports / gems
# http://blog.ntrippy.net/2009/07/home-made-nginx-phusion-passenger-dep_01.html
gem install nginx
gem install -V -r passenger
PASS_VER=`gem list -r passenger | grep 'passenger ' | sed 's/^.*\(//;s/\).*$//'`
cd $GEM_HOME/gems/passenger-${PASS_VER}/ext/
rake nginx
PASS_PORT_FRAG=`cat<<-CAT
variant passenger description {Enable Phusion Passenger (mod_rails) support} {
configure.args-append --add-module=$GEM_HOME/gems/passenger-${PASS_VER}/ext/nginx
}
CAT`
sudo sh -c "printf \"$PASS_PORT_FRAG\" >> /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/nginx/Portfile"
sudo port uninstall nginx && sudo port clean nginx
sudo port -vvvvv install nginx +passenger
sudo cp /opt/local/etc/nginx/mime.types.example /opt/local/etc/nginx/mime.types
sudo cp /opt/local/etc/nginx/fastcgi_params.example /opt/local/etc/nginx/fastcgi_params
sudo cp /opt/local/etc/nginx/nginx.conf.example /opt/local/etc/nginx/nginx.conf
# set server root root /opt/local/lib/ruby/gems/1.8/gems/chef-server-0.7.15/public;
sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.nginx.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment