forked from Kitura/Kitura
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vagrantfile
59 lines (46 loc) · 1.93 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
BOX_URL = 'https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box'.freeze
SWIFT_PATH = 'https://swift.org/builds/swift-3.1-release/ubuntu1404/swift-3.1-RELEASE'.freeze
SWIFT_DIRECTORY = 'swift-3.1-RELEASE-ubuntu14.04'.freeze
SWIFT_FILE = "#{SWIFT_DIRECTORY}.tar.gz".freeze
SWIFT_HOME = "/home/vagrant/#{SWIFT_DIRECTORY}".freeze
KITURA_URL = 'https://github.com/IBM-Swift/Kitura.git'.freeze
KITURA_BRANCH = 'master'.freeze
Vagrant.configure(2) do |config|
config.vm.box = BOX_URL
config.vm.network 'forwarded_port', guest: 8080, host: 8080
# Prevents "stdin: is not a tty" on Ubuntu (https://github.com/mitchellh/vagrant/issues/1673)
config.vm.provision 'fix-no-tty', type: 'shell' do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
end
config.vm.provision 'shell', privileged: false, inline: <<-SHELL
### Install packages
# 1. Install compiler, autotools
sudo apt-get --assume-yes install clang libicu-dev uuid-dev git
# 2. Install dtrace (to generate provider.h)
sudo apt-get --assume-yes install systemtap-sdt-dev
# 3. Kitura packages
sudo apt-get --assume-yes install libcurl4-openssl-dev
### Download Swift binary if not found, install it, and add it to the path
if [ ! -f "#{SWIFT_FILE}" ]; then
curl -O "#{SWIFT_PATH}/#{SWIFT_FILE}"
fi
tar zxf #{SWIFT_FILE}
if [ $(grep -c "#{SWIFT_FILE}" .profile) -eq 0 ]; then
echo "export PATH=#{SWIFT_HOME}/usr/bin:\"${PATH}\"" >> .profile
source .profile
fi
### Download and install Kitura
git clone #{KITURA_URL} -b #{KITURA_BRANCH}
cd Kitura
swift build
cd ..
### Export LD_LIBRARY_PATH
if [ $(grep -c "LD_LIBRARY_PATH=/usr/local/lib" .profile) -eq 0 ]; then
echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> .profile
source .profile
fi
SHELL
end