On Github bithound / 2015-JSConf
Presented by Gord Tannerwww.bithound.io / @bithoundio
git clone git@github.com:yourteam/project.git
Vagrant.configure(2) do |config|
config.vm.define "app" do |app|
app.vm.box = "trusty64"
app.vm.provision "shell", path: "scripts/provision_app.sh"
app.vm.network "private_network", ip: "10.10.11.11"
end
config.vm.define "worker1" do |worker|
worker.vm.box = "trusty64"
worker.vm.provision "shell", path: "scripts/provision_worker.sh"
worker.vm.network "private_network", ip: "10.10.11.12"
end
config.vm.define "worker2" do |worker|
worker.vm.box = "trusty64"
worker.vm.provision "shell", path: "scripts/provision_worker.sh"
worker.vm.network "private_network", ip: "10.10.11.13"
end
end
So if you are building a distributed system, develop on a distributed system! Almost all virtualization environments
right now allow you define multiple VMs and private networks.
#!/bin/bash vagrant ssh --command "cd /vagrant && ./cmd.js $*"Utility / proxy scripts to interact with your project inside the VM. You could call this a trampoline or a thunk, uh, if you lived through the win16 to win32 transition. (I didn't, but I was just after that and still had to deal with old developer documentation. $* is just the parameter list that this program has been called with itself.
apt-get install -y mongodb
perl 's/^bind_ip/#bind_ip/g' /etc/mongodb.conf
sudo service mongodb restart
# Make sure we've got NFS handy. if [ $(uname) == 'Linux' ]; then apt-get install -y nfs-common apt-get install -y nfs-kernel-server apt-get install -y rpcbind fi
git config --global http.postBuffer 524288000
# Fix the clock.
/etc/init.d/ntp stop
set +e
ntpdate pool.ntp.org
set -e
/etc/init.d/ntp start
## Up our per-user file limit.
if [[ -d /etc/limits.d ]]; then
cp bh.conf /etc/limits.d/bh.conf
fi