Inlined provisioning script and removed deb gen+install

This commit is contained in:
Shaun Duncan 2014-02-24 08:41:24 -05:00
parent f1b3c2a1a3
commit f9f2e0205e
2 changed files with 60 additions and 66 deletions

62
Vagrantfile vendored
View file

@ -18,12 +18,70 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
# Drone by default runs on port 80. Forward from host to guest
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.network :forwarded_port, guest: 8080, host: 8080
config.vm.network :private_network, ip: "192.168.10.101"
# 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"
config.vm.provision "shell", inline: <<-EOF
set -e
# System packages
echo "Installing Base Packages"
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -qq
sudo apt-get install -qqy --force-yes build-essential bzr git mercurial vim
# Install 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 $GOVERSION"
if [ ! $(which go) ]; then
echo " Downloading $GOTARBALL"
wget --quiet --directory-prefix=/tmp https://go.googlecode.com/files/$GOTARBALL
echo " Extracting $GOTARBALL to $GOROOT"
sudo tar -C /usr/local -xzf /tmp/$GOTARBALL
echo " Configuring GOPATH"
sudo mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg
sudo chown -R vagrant $GOPATH
echo " Configuring env vars"
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
# Auto cd to drone install dir
echo "cd $GOPATH/src/github.com/drone/drone" >> /home/vagrant/.bashrc
# Cleanup
sudo apt-get autoremove
echo <<DONE
PROVISIONING COMPLETE:
vagrant ssh
make run
Visit http://localhost:8080/install
DONE
EOF
end

View file

@ -1,64 +0,0 @@
#!/bin/sh
set -e
# Ensure that agent forwarding is set up properly.
if [ "$SSH_AUTH_SOCK" ]; then
echo "SSH_AUTH_SOCK is set; you are successfully agent-forwarding. These keys are loaded:"
if [ -z "$1" ]; then
ssh-add -l
else
echo "Not attempting to list keys because windows ssh-agent communication is broken..."
fi
else
echo "No SSH_AUTH_SOCK was found in the environment!"
exit 3
fi
# System packages
echo "Installing Base Packages"
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -qq
sudo apt-get install -qqy --force-yes build-essential bzr git mercurial vim
# Install 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 $GOVERSION"
if [ ! $(which go) ]; then
echo " Downloading $GOTARBALL"
wget --quiet --directory-prefix=/tmp https://go.googlecode.com/files/$GOTARBALL
echo " Extracting $GOTARBALL to $GOROOT"
sudo tar -C /usr/local -xzf /tmp/$GOTARBALL
echo " Configuring GOPATH"
sudo mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg
sudo chown -R vagrant $GOPATH
echo " Configuring env vars"
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