mirror of
https://github.com/harness/drone.git
synced 2025-05-19 02:20:03 +08:00
Working vagrant setup
This commit is contained in:
parent
7bef94881b
commit
f1b3c2a1a3
5
Vagrantfile
vendored
5
Vagrantfile
vendored
@ -19,9 +19,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|||||||
|
|
||||||
# Drone by default runs on port 80. Forward from host to guest
|
# 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: 80, host: 8080
|
||||||
|
config.vm.network :private_network, ip: "192.168.10.101"
|
||||||
|
|
||||||
# Sync this repo
|
# Sync this repo into what will be $GOPATH
|
||||||
config.vm.synced_folder ".", "/opt/drone"
|
config.vm.synced_folder ".", "/opt/go/src/github.com/drone/drone"
|
||||||
|
|
||||||
# system-level initial setup
|
# system-level initial setup
|
||||||
config.vm.provision "shell", path: "scripts/provision.sh"
|
config.vm.provision "shell", path: "scripts/provision.sh"
|
||||||
|
@ -14,70 +14,51 @@ else
|
|||||||
exit 3
|
exit 3
|
||||||
fi
|
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"
|
echo "Installing Base Packages"
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
( sed -e 's/#.*$//' | xargs sudo apt-get install -qqy --force-yes ) <<-EOF
|
sudo apt-get update -qq
|
||||||
build-essential
|
sudo apt-get install -qqy --force-yes build-essential bzr git mercurial vim
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
# Install Go
|
# Install Go
|
||||||
go_version="1.2"
|
GOVERSION="1.2"
|
||||||
go_tarball="go${go_version}.linux-amd64.tar.gz"
|
GOTARBALL="go${GOVERSION}.linux-amd64.tar.gz"
|
||||||
go_root=/usr/local/go
|
export GOROOT=/usr/local/go
|
||||||
go_path=/opt/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
|
if [ ! $(which go) ]; then
|
||||||
echo " Downloading $go_tarball"
|
echo " Downloading $GOTARBALL"
|
||||||
wget --quiet --directory-prefix=/tmp https://go.googlecode.com/files/$go_tarball
|
wget --quiet --directory-prefix=/tmp https://go.googlecode.com/files/$GOTARBALL
|
||||||
|
|
||||||
echo " Extracting $go_tarball to $go_root"
|
echo " Extracting $GOTARBALL to $GOROOT"
|
||||||
sudo tar -C /usr/local -xzf /tmp/$go_tarball
|
sudo tar -C /usr/local -xzf /tmp/$GOTARBALL
|
||||||
|
|
||||||
echo " Configuring GOPATH"
|
echo " Configuring GOPATH"
|
||||||
sudo mkdir -p $go_path/src $go_path/bin $go_path/pkg
|
sudo mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg
|
||||||
sudo chown -R vagrant $go_path
|
sudo chown -R vagrant $GOPATH
|
||||||
|
|
||||||
echo " Configuring env vars"
|
echo " Configuring env vars"
|
||||||
echo "export PATH=\$PATH:$go_root/bin" | sudo tee /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=$go_root" | sudo tee --append /etc/profile.d/golang.sh > /dev/null
|
echo "export GOROOT=$GOROOT" | 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 GOPATH=$GOPATH" | sudo tee --append /etc/profile.d/golang.sh > /dev/null
|
||||||
fi
|
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
|
# Cleanup
|
||||||
sudo apt-get autoremove
|
sudo apt-get autoremove
|
||||||
|
Loading…
Reference in New Issue
Block a user