Skip to content

Commit

Permalink
Add vagrant support for pouch (#2168)
Browse files Browse the repository at this point in the history
* Add vagrant support for pouch

* Move Vagrantfile to top dir.

Signed-off-by: Mark Liu <[email protected]>
  • Loading branch information
manlge authored and Wei Fu committed Aug 30, 2018
1 parent 009dff8 commit 3c11ba1
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 112 deletions.
39 changes: 39 additions & 0 deletions VAGRANT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Vagrant support for pouch

You can using Vagrant to quickly experience pouch or cross compile on non-linux.

## Requirements

* Vagrant 1.9.x or newer
* VirtuaBox

## Get started

```bash
vagrant up
vagrant ssh -c "sudo -i"

# Start a nginx container with 80
pouch run -d --name nginx -p 80:80 nginx
curl http://localhost
```

## Build pouch with vagrant

```bash

# On MacOS or Linux
export POUCH_BUILD=true
vagrant up

# On Windows
set POUCH_BUILD=true
vagrant up

# Install compiled pouch binarys for pouch service.
vagrant ssh -c "sudo -i"
cd ~/go/src/github.com/alibaba/pouch
make DEST_DIR=/usr install
systemctl restart pouch
pouch version
```
47 changes: 47 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.

VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.7.4"

Vagrant.configure("2") do |config|
config.vm.define :pouch do |pouch|
pouch.vm.hostname = "pouch"
pouch.vm.box = "ubuntu/xenial64"
pouch.vm.provision "shell", inline: <<-SHELL
until apt-get update &> /dev/null; do echo "Waiting apt-get for 3 seconds..."; sleep 3; done
apt-get --no-install-recommends install lxcfs
apt-get --no-install-recommends install curl apt-transport-https ca-certificates software-properties-common
curl -fsSL http://mirrors.aliyun.com/opsx/pouch/linux/debian/[email protected] | apt-key add -
add-apt-repository "deb http://mirrors.aliyun.com/opsx/pouch/linux/debian/ pouch stable"
apt-get update
apt-get --no-install-recommends install pouch
systemctl enable pouch
systemctl start pouch
echo "alias docker='pouch'" >> ~/.bashrc
SHELL

if ENV["POUCH_BUILD"] == "true"
pouch.vm.provision "shell", inline: <<-SHELL
# configring environments for pouch
GO_VERSION=1.9.1
GOPATH=/root/go
apt-get install -y --no-install-recommends build-essential
wget --progress=bar:force:noscroll https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz -O /tmp/go$GO_VERSION.linux-amd64.tar.gz
tar xf /tmp/go$GO_VERSION.linux-amd64.tar.gz -C /opt/
echo "export GOROOT=/opt/go" >> ~/.bashrc
echo "export GOPATH=$GOPATH" >> ~/.bashrc
cd /usr/bin && find /opt/go/bin -type f | xargs -n1 ln -f -s
mkdir -p $GOPATH/src/github.com/alibaba
ln -s /vagrant $GOPATH/src/github.com/alibaba/pouch
cd $GOPATH/src/github.com/alibaba/pouch && make install
SHELL
end
end
end
5 changes: 0 additions & 5 deletions hack/vagrant/.gitignore

This file was deleted.

29 changes: 0 additions & 29 deletions hack/vagrant/README.md

This file was deleted.

20 changes: 0 additions & 20 deletions hack/vagrant/Vagrantfile

This file was deleted.

58 changes: 0 additions & 58 deletions hack/vagrant/bootstrap.sh

This file was deleted.

0 comments on commit 3c11ba1

Please sign in to comment.