Browse files

LOTS of changes getting vagrant to work. Restructured in significant …

…ways.
  • Loading branch information...
1 parent 3e9497c commit b4823a52e477d105f6f35b9b3d217faebced51e4 James Dennis committed Mar 31, 2012
View
7 .gitignore
@@ -1,9 +1,6 @@
.DS_Store
*.pyc
*.bak
-*.*~
-MANIFEST
-build
-dist
-local_settings.py
+*~
+.vagrant
View
65 README.md
@@ -1,10 +1,9 @@
-# Quickness 11.10
+![Quickness](https://github.com/j2labs/quickness/raw/master/etc/logo.png)
-This is a tool for deploying system configurations to Ubuntu systems easily.
-The "11.10" above maps the code here to Ubuntu 11.10. Things will be upgraded when new Ubuntu's come out.
+This is a tool for deploying system configurations to Ubuntu systems easily. It also has a `Vagrantfile` so you can build VirtualBox VM's with it too.
-## Just Launched A Box
+## Just Launched A Remote Box
After launching a fresh box, open a terminal on it and run the following steps.
@@ -17,7 +16,27 @@ After launching a fresh box, open a terminal on it and run the following steps.
Your prompt will change to something colorful with a newline before the command entry point. `ls` is colorful too, along with other aliases.
-Quickness is also ready to go.
+
+## Using Vagrant
+
+Create a vagrant instance like this.
+
+ $ git clone https://github.com/j2labs/quickness.git
+ $ cd quickness
+ $ vagrant up
+
+Then SSH to the machine and you will have a quickness prompt ready to go.
+
+ $ vagrant ssh
+ Linux lucid64 2.6.32-33-server #70-Ubuntu SMP Thu Jul 7 22:28:30 UTC 2011 x86_64 GNU/Linux
+ Ubuntu 10.04.3 LTS
+
+ Welcome to the Ubuntu Server!
+ * Documentation: http://www.ubuntu.com/server/doc
+ Last login: Sat Mar 31 09:32:49 2012 from 10.0.2.2
+
+ ubuntu@host : 02:52:16 : ~
+ Q:
## Building A System
@@ -33,24 +52,25 @@ Done.
## Commands
-After source'ing `quickness/etc/profile.sh` you will have a few commands available to you. Each of them begin with `quick_` as a prefix, so you can tab them out.
+After source'ing `quickness/etc/profile.sh` you will have a few commands available to you. Each of them begin with `quick_` and live in `quickness/bin/`, so you can tab them out.
-| **Command** | **Function** |
-|-----------------:|:------------------------------------------------------------------------------------------------------|
-| `quick_new` | Run this command first. It bootstraps the system with things every developer needs. |
-| `quick_apply` | This applies a system tweak. The word 'apply' is used to signal that these change a system's config. |
-| `quick_tweaks` | Lists all the available tweaks. |
-| `quick_install` | Installs a formula, which is to say it runs a script which installs 1 or more packages. |
-| `quick_formulas` | Lists all the concepts that have been captured as formulas. |
+| **Command** | **Function** |
+|-----------------:|:---------------------------------------------------------------------------------------------------------------------|
+| `quick_new` | Run this command first. It bootstraps the system with things every developer needs. |
+| `quick_apply` | This applies a system tweak. The word 'apply' is used to signal that these change a system's config. |
+| `quick_tweaks` | Lists all the available tweaks. |
+| `quick_install` | Installs a formula, which is to say it runs a script which installs 1 or more packages. |
+| `quick_formulas` | Lists all the concepts that have been captured as formulas. |
+| `quick` | Can be used to prefix commands to create the environment they need to run in. Generally used by other commands only. |
-These commands can be any kind of script, they just have to be in `quickness/bin`.
+These commands can be any kind of script, they just have to be in `quickness/bin`. Use your Fabric scripts, or whatever you already have.
## Environment Configs
-The `quickness/etc` directory is basically the basis for system configs.
+The `quickness/etc` directory is where vanilla system configs are stored. An install process might modify what's in here.
-For now these files still need editing in a deploy. They come with basic configs for typical use cases but the network addresses still need to be filled in.
+For now these files still need editing in a deploy. They come with basic configs for typical use cases but the network addresses still need to be filled in. They will eventually be based on templates.
## Formulas
@@ -66,20 +86,27 @@ Eventually, the formulas, and any other relevant scripts, will be sent to one or
The `quickness/tweaks` directory is commands you run to flip switches in your operating system, like disabling NUMA or configuring some huge number of open file descriptors.
-The tweaks each have comments documenting their purpose. It is my hopes that the tweaks can serve as teaching tools for interesting ways of configuring operating systems.
+The tweaks each have comments documenting their purpose. I hope that the tweaks that come with quickness can serve as teaching tools for interesting ways of configuring systems.
+
+
+## Sudo
+
+For now, `sudo` is used to install things. Quickness systems are assumed to be somewhat ad-hoc. I would like to remove the use of `sudo` and would like to hear what your thoughts are on how to do this best too.
+
+Perhaps `sudo` can be used, or a virtualenv, or something with rvm / rbenv, or kerl and rebar, or whatever...
# Background
I have built many systems in my life. AWS has exacerbated this problem considerably, too.
-It can be time consuming, but all hackers eventually automate their daily life, as redundant as their code might be to whatever is already out there. It starts as a few shell scripts. It grows into some shell functions and environment variables. And then you have a simple environment that installs things for you.
+It can be time consuming, but all hackers eventually automate their daily life, as redundant as their code might be to whatever is already out there. It starts as a few shell scripts. It grows into some shell functions and environment variables. And then you have a simple environment that has commands and installs things for you.
And then maybe you call it Quickness. And then you post it on your GitHub page. And it's really just a bunch of scripts that slap a system together.
*Why’d you write it in shell anyway? That’s weird.*
-Well. It *does* capture the way I like systems to behave if they're fresh. Maybe you'll like the way my systems usually behave too?
+It *does* capture the way I like systems to behave if they're fresh. Maybe you'll like the way my systems usually behave too?
# License
View
16 Vagrantfile
@@ -0,0 +1,16 @@
+Vagrant::Config.run do |config|
+ ### 64-bit Ubuntu
+ config.vm.box = "lucid64"
+
+ ### URL to get image if not cached
+ config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
+
+ ### Network config
+ config.vm.network "33.33.33.11"
+ #config.vm.forward_port "http", 80, 6767
+
+ ### Install and bootstrap Quickness
+ Vagrant::Config.run do |config|
+ config.vm.provision :shell, :inline => "echo \". /vagrant/etc/profile\" >> /home/vagrant/.profile"
+ end
+end
View
15 bin/quick
@@ -0,0 +1,15 @@
+### Import quickness/etc/quickness
+###
+### If you change this, change `quickness/etc/profile` too
+if [ -z $BASH_SOURCE ]; then
+ export QUICKNESS=$(cd $(dirname $(dirname $0)); pwd)
+else
+ export QUICKNESS=$(dirname $(dirname ${BASH_SOURCE[0]}))
+fi
+. $QUICKNESS/etc/quickness
+
+
+### Execute any provided commands in created environment
+if [ $# -gt 0 ]; then
+ $*
+fi
View
11 bin/quick_apply
@@ -1,12 +1,17 @@
+### Import quickness/etc/quickness
+export QUICKNESS=$(cd $(dirname $(dirname $0)); pwd)
+. $QUICKNESS/etc/quickness
+
+
+### Apply
tweak_name="$1"
if [ "$tweak_name" = "" ]
then
echo "Pass <tweak> argument to quick_apply"
else
- echo "Quick Tweaking \`$tweak_name\`"
- echo
+ echo "Tweaking with: $tweak_name"
echo
- sudo -E $QUICKNESS_TWEAKS/$tweak_name
+ sudo $QUICKNESS_BIN/quick $QUICKNESS_TWEAKS/$tweak_name
fi
View
8 bin/quick_formulas
@@ -1 +1,7 @@
-ls $QUICKNESS_TWEAKS
+### Import quickness/etc/quickness
+export QUICKNESS=$(cd $(dirname $(dirname $0)); pwd)
+. $QUICKNESS/etc/quickness
+
+
+### Formulas
+ls $QUICKNESS_FORMULAS
View
10 bin/quick_install
@@ -1,9 +1,15 @@
+### Import quickness/etc/quickness
+export QUICKNESS=$(cd $(dirname $(dirname $0)); pwd)
+. $QUICKNESS/etc/quickness
+
+
+### Install
formula_name="$1"
if [ "$formula_name" = "" ]
then
echo "Pass <formula> argument to quick_install"
else
- echo "Quick Installing \`$formula_name\`\n\n"
- sudo -E $QUICKNESS_FORMULAS/$formula_name
+ echo "Quick Installing: $formula_name"
+ sudo $QUICKNESS_BIN/quick $QUICKNESS_FORMULAS/$formula_name
fi
View
8 bin/quick_new
@@ -1 +1,7 @@
-sudo -E $QUICKNESS_TWEAKS/bootstrap
+### Import quickness/etc/quickness
+export QUICKNESS=$(cd $(dirname $(dirname $0)); pwd)
+. $QUICKNESS/etc/quickness
+
+
+### New
+sudo $QUICKNESS_BIN/quick $QUICKNESS_TWEAKS/bootstrap
View
6 bin/quick_tweaks
@@ -1 +1,7 @@
+### Import quickness/etc/quickness
+export QUICKNESS=$(cd $(dirname $(dirname $0)); pwd)
+. $QUICKNESS/etc/quickness
+
+
+### Tweaks
ls $QUICKNESS_TWEAKS
View
BIN etc/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
48 etc/profile
@@ -0,0 +1,48 @@
+###
+### Environment
+###
+
+
+### Import quickness/etc/quickness
+###
+### If you change this, change `quickness/bin/quick` too
+if [[ $BASH_SOURCE ]]; then
+ export QUICKNESS=$(dirname $(dirname ${BASH_SOURCE[0]}))
+else
+ export QUICKNESS=$(cd $(dirname $(dirname $0)); pwd)
+fi
+. $QUICKNESS/etc/quickness
+
+
+### Colorful prompt with special colors for root
+if [ $USER = "root" ]; then
+ PS_COLOR="31m"
+else
+ PS_COLOR="32m"
+ if [ ! -d "$HOME/.tmp" ]; then
+ mkdir $HOME/.tmp
+ fi
+ export TMPDIR="$HOME/.tmp"
+fi
+export PS1="\n[01;$PS_COLOR\u@\h : \t : \w\nQ: "
+
+
+### Default Arguments
+alias ls="ls -F --color"
+alias rm="rm -i"
+alias cp="cp -i"
+alias mv="mv -i"
+
+
+### Short Cuts
+alias l="ls"
+alias sl="ls"
+alias lss="ls --hide=*~"
+alias la="ls -a"
+alias ll="ls -l"
+alias lal="ls -al"
+alias lsd="ls -l | grep ^d"
+alias psg="ps ax | grep"
+alias clpy="rm -f *~ *pyc"
+alias pwdd="pwd -P"
+alias sudoo="sudo /bin/bash -l"
View
28 etc/quickness
@@ -0,0 +1,28 @@
+###
+### Quickness Settings
+###
+
+#export QUICKNESS_REPO=$(cd $(dirname $(dirname $0)); pwd)
+export QUICKNESS_REPO=$QUICKNESS
+export QUICKNESS_FORMULAS=$QUICKNESS_REPO/formulas
+export QUICKNESS_TWEAKS=$QUICKNESS_REPO/tweaks
+export QUICKNESS_BIN=$QUICKNESS_REPO/bin
+
+export QUICKNESS_HOME=$HOME/.quickness
+export QUICKNESS_SRC=$HOME/.quickness/src
+
+
+###
+### Quickness Workspaces
+###
+
+if [ ! -d $QUICKNESS_HOME ]; then
+ mkdir $QUICKNESS_HOME
+fi
+if [ ! -d $QUICKNESS_SRC ]; then
+ mkdir $QUICKNESS_SRC
+fi
+
+
+### Path
+export PATH=$QUICKNESS_BIN:$PATH
View
20 formulas/brubeck
@@ -9,23 +9,15 @@
PREV_DIR=$PWD
cd $QUICKNESS_SRC
-###
-### Formula Dependencies
-###
-
-sudo $QUICKNESS_BIN/quick_install zeromq
-sudo $QUICKNESS_BIN/quick_install mongrel2
-
###
-### System Depenencies
+### Formula Dependencies
###
-apt-get -y install \
- python-dev \
- python-pip \
- libevent-dev \
- libev4
+sudo $QUICKNESS_BIN/quick quick_install evented_libs
+sudo $QUICKNESS_BIN/quick quick_install python_dev
+sudo $QUICKNESS_BIN/quick quick_install zeromq
+sudo $QUICKNESS_BIN/quick quick_install mongrel2
###
@@ -62,4 +54,4 @@ pip install -I -r envs/brubeck.reqs
### Install Brubeck itself
python ./setup.py install
-cd ../..
+cd $PREV_DIR
View
2 formulas/erlang 100644 → 100755
@@ -21,7 +21,7 @@ apt-get -y install \
### Erlang
###
-wget http://erlang.org/download/$APP_VERSION.tar.gz"
+wget "http://erlang.org/download/$APP_VERSION.tar.gz"
tar zxvf $APP_VERSION.tar.gz
cd $APP_VERSION
./configure && make && sudo make install
View
16 formulas/evented_libs
@@ -0,0 +1,16 @@
+### Determine which libev
+if [ "$(apt-cache search libev3 | grep libev3)" ]; then
+ export LIBEV="libev3"
+else
+ export LIBEV="libev4"
+fi
+
+
+### Install libevent and libev
+apt-get -y install \
+ libevent-dev \
+ $LIBEV
+
+
+### Update library cache
+ldconfig
View
26 formulas/mongodb
@@ -1,7 +1,31 @@
### This script follows the instructions found on MongoDB's website.
### www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages
+
+###
+### OS Version Based Repo
+###
+
+### Get major and minor number for OS
+OS_VER=$(lsb_release -r | cut -d ":" -f 2 | sed 's/^[\t ]*//g')
+OS_MAJOR=$(echo $OS_VER | cut -d "." -f 1)
+OS_MINOR=$(echo $OS_VER | cut -d "." -f 2)
+
+### Less than 11.10 use a different repo URL
+if [ $OS_MAJOR -lt 11 ] && [ $OS_MINOR -lt 10 ]; then
+ echo "HI"
+ export APT_SOURCE="deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen"
+else
+ echo "NOOO"
+ export APT_SOURCE="http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen"
+fi
+
+
+### Update apt with Mongo info
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
-sudo echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/source.list
+sudo echo "$APT_SOURCE" >> /etc/apt/sources.list
sudo apt-get update
+
+
+### Install Mongo
sudo apt-get install mongodb-10gen
View
11 formulas/mongrel2
@@ -12,14 +12,19 @@ cd $QUICKNESS_SRC
###
+### Formula Dependencies
+###
+
+sudo $QUICK_BIN/quick quick_install evented_libs
+
+
+###
### System Depenencies
###
apt-get -y install \
libsqlite3-dev \
- sqlite3 \
- libevent-dev \
- libev4
+ sqlite3
###
View
11 formulas/nginx
@@ -1 +1,12 @@
+###
+### Formula Dependencies
+###
+
+sudo $QUICKNESS_BIN/quick quick_install evented_libs
+
+
+###
+### Formula Details
+###
+
apt-get -y install nginx
View
35 formulas/nodejs
@@ -1,6 +1,35 @@
+###
+### Settings
+###
+
+PREV_DIR=$PWD
+cd $QUICKNESS_SRC
+
+
+###
+### Formula Dependencies
+###
+
+sudo $QUICKNESS_BIN/quick quick_install evented_libs
+
+
+###
+### System Depenencies
+###
+
+sudo apt-get -y install python-software-properties
+sudo add-apt-repository ppa:chris-lea/node.js
+sudo apt-get update
+
+
+### Install Node
apt-get -y install \
- libev4 \
- nginx \
+ curl \
nodejs
-ldconfig
+
+###
+### Node Package Manager
+###
+
+sudo curl "http://npmjs.org/install.sh" | sudo sh # this is su ridiculous
View
14 formulas/python_dev
@@ -0,0 +1,14 @@
+###
+### Settings
+###
+
+PREV_DIR=$PWD
+cd $QUICKNESS_SRC
+
+
+apt-get -y install \
+ python-dev \
+ python-pip
+
+
+cd $PREV_DIR
View
18 formulas/tornado
@@ -1 +1,19 @@
+###
+### Settings
+###
+
+PREV_DIR=$PWD
+cd $QUICKNESS_SRC
+
+
+###
+### Formula Dependencies
+###
+
+sudo $QUICKNESS_BIN/quick quick_install python_dev
+sudo $QUICKNESS_BIN/quick quick_install evented_libs
+
+
pip install tornado
+
+cd $PREV_DIR
View
10 formulas/zeromq
@@ -6,16 +6,20 @@ ZMQ_VERSION="zeromq-2.1.11"
PREV_DIR=$PWD
cd $QUICKNESS_SRC
+###
+### Formula Dependencies
+###
+
+sudo $QUICKNESS_BIN/quick quick_install evented_libs
+
###
### System Depenencies
###
apt-get -y install \
libsqlite3-dev \
- sqlite3 \
- libevent-dev \
- libev4
+ sqlite3
###
View
4 tweaks/bootstrap
@@ -1,9 +1,11 @@
### Update package manager
apt-get update
+
### Update packages
apt-get -y upgrade
+
### Install universal needs
apt-get -y install \
build-essential \
@@ -14,4 +16,6 @@ apt-get -y install \
git-core \
mercurial
+
+### Update library cache
ldconfig
View
6 tweaks/max_files
@@ -1,7 +1,13 @@
### Set up open file descriptor limits
echo "fs.file-max = 1000000" >> /etc/sysctl.conf
+
+### Ubuntu
echo "ubuntu soft nofile 1000000" >> /etc/security/limits.conf
echo "ubuntu hard nofile 1000000" >> /etc/security/limits.conf
+### Vagrant
+echo "vagrant soft nofile 1000000" >> /etc/security/limits.conf
+echo "vagrant hard nofile 1000000" >> /etc/security/limits.conf
+
### Load new parameters into running system
sysctl -n -p

0 comments on commit b4823a5

Please sign in to comment.