Working vagrant setup

This commit is contained in:
Shaun Duncan 2014-02-20 19:22:03 -05:00
parent 7bef94881b
commit f1b3c2a1a3
2 changed files with 33 additions and 51 deletions

5
Vagrantfile vendored
View file

@ -19,9 +19,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Drone by default runs on port 80. Forward from host to guest
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.network :private_network, ip: "192.168.10.101"
# Sync this repo
config.vm.synced_folder ".", "/opt/drone"
# Sync this repo into what will be $GOPATH
config.vm.synced_folder ".", "/opt/go/src/github.com/drone/drone"
# system-level initial setup
config.vm.provision "shell", path: "scripts/provision.sh"

View file

@ -14,70 +14,51 @@ else
exit 3
fi
# apt-get update.
#if [ -e /root/package-list-updated ]; then
# echo "Skipping package cache update. To force, remove /root/package-list-updated and re-provision."
#else
# echo "Updating package cache."
# sudo apt-get update -qq
# touch /root/package-list-updated
#fi
# FIXME: Don't run this every time?
sudo apt-get update -qq
# System packages
echo "Installing Base Packages"
export DEBIAN_FRONTEND=noninteractive
( sed -e 's/#.*$//' | xargs sudo apt-get install -qqy --force-yes ) <<-EOF
build-essential
# These are needed for go get
bzr
git
mercurial
# Other
vim
# Stuff required by medley
#python-software-properties # TODO why do we need this?
#curl # many scripts expect this to fetch urls.
#python-dev # for compiling python modules
#python-setuptools # for installing/making packages
#python-unittest2 # standard unit testing library
#python-virtualenv # for partioning python projects
#python-lxml # TODO why do we need this?
#libxml2 # TODO why do we need this?
#libxml2-dev # TODO why do we need this?
#libxslt1-dev # TODO why do we need this?
EOF
sudo apt-get update -qq
sudo apt-get install -qqy --force-yes build-essential bzr git mercurial vim
# Install Go
go_version="1.2"
go_tarball="go${go_version}.linux-amd64.tar.gz"
go_root=/usr/local/go
go_path=/opt/go
GOVERSION="1.2"
GOTARBALL="go${GOVERSION}.linux-amd64.tar.gz"
export GOROOT=/usr/local/go
export GOPATH=/opt/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
echo "Installing Go $go_version"
echo "Installing Go $GOVERSION"
if [ ! $(which go) ]; then
echo " Downloading $go_tarball"
wget --quiet --directory-prefix=/tmp https://go.googlecode.com/files/$go_tarball
echo " Downloading $GOTARBALL"
wget --quiet --directory-prefix=/tmp https://go.googlecode.com/files/$GOTARBALL
echo " Extracting $go_tarball to $go_root"
sudo tar -C /usr/local -xzf /tmp/$go_tarball
echo " Extracting $GOTARBALL to $GOROOT"
sudo tar -C /usr/local -xzf /tmp/$GOTARBALL
echo " Configuring GOPATH"
sudo mkdir -p $go_path/src $go_path/bin $go_path/pkg
sudo chown -R vagrant $go_path
sudo mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg
sudo chown -R vagrant $GOPATH
echo " Configuring env vars"
echo "export PATH=\$PATH:$go_root/bin" | sudo tee /etc/profile.d/golang.sh > /dev/null
echo "export GOROOT=$go_root" | sudo tee --append /etc/profile.d/golang.sh > /dev/null
echo "export GOPATH=$go_path" | sudo tee --append /etc/profile.d/golang.sh > /dev/null
echo "export PATH=\$PATH:$GOROOT/bin:$GOPATH/bin" | sudo tee /etc/profile.d/golang.sh > /dev/null
echo "export GOROOT=$GOROOT" | sudo tee --append /etc/profile.d/golang.sh > /dev/null
echo "export GOPATH=$GOPATH" | sudo tee --append /etc/profile.d/golang.sh > /dev/null
fi
# Install drone
echo "Building Drone"
cd $GOPATH/src/github.com/drone/drone
make deps
make embed
make build
make dpkg
echo "Installing Drone"
sudo dpkg -i deb/drone.deb
# Cleanup
sudo apt-get autoremove