This repository has been archived by the owner on Feb 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Vagrantfile
79 lines (62 loc) · 2.39 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright 2018 Pax Automa Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
provision = <<EOF
set -x -e
cat >> /etc/pacman.conf <<PACMAN
[paxautoma]
SigLevel = Optional TrustAll
Server = https://arch-packages.paxautoma.com/
PACMAN
pacman --noconfirm --needed -Syu archiso docker rsync go git protobuf glide
# Go environment
mkdir -p /home/vagrant/go/{src,pkg,bin}
find /home/vagrant/go -xdev -type d -exec chown vagrant:vagrant {} \\;
cat > /home/vagrant/.bashrc <<BASHRC
export GOPATH=/home/vagrant/go
export PATH=/home/vagrant/go/bin:$PATH
# If not running interactively, skip the rest
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\\u@\\h \\W]\\$ '
BASHRC
echo 'export GOPATH=/home/vagrant/go' >> /home/vagrant/.bashrc
echo 'export PATH=/home/vagrant/go/bin:\$PATH' >> /home/vagrant/.bashrc
if [ ! -e /home/vagrant/operos ]; then
ln -s /home/vagrant/go/src/github.com/paxautoma/operos /home/vagrant/operos
fi
# Install Go generator for protobuf
sudo -u vagrant go get -v -u github.com/golang/protobuf/protoc-gen-go
# Enable docker
usermod -a -G docker vagrant
systemctl enable docker.service
EOF
Vagrant.configure("2") do |config|
# https://github.com/elasticdog/packer-arch
config.vm.box = "archlinux64"
config.vm.box_check_update = true
config.vm.network "private_network", ip: "192.168.72.5", auto_config: false
config.vm.define "isobuild" do |isovm|
isovm.vm.hostname = "isobuild"
isovm.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
vb.cpus = 4
end
isovm.vm.synced_folder ".", "/vagrant", disabled: true
isovm.vm.synced_folder File.dirname(__FILE__), "/home/vagrant/go/src/github.com/paxautoma/operos"
isovm.vm.provision "shell", inline: provision
# If the Linux kernel is updated during provisioning, Docker will fail to
# start until the machine is reloaded. So we do that here for good measure.
isovm.vm.provision :reload
end
end