forked from devopsbookmarks/devopsbookmarks.com
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
43 lines (36 loc) · 1.31 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
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, privileged: true, inline: <<-SCRIPT
if [ -z `which node` ]; then
echo "Installing necessary packages..."
apt-get update
apt-get install nodejs npm git -y
npm install -g grunt-cli
ln -s /usr/bin/nodejs /usr/bin/node
fi;
SCRIPT
config.vm.provision :shell, privileged: false, inline: <<-SCRIPT
cd /vagrant
mkdir -p log
# piping output because express crashes when stdout/stderr is disconnected
killall node
nohup script/server > log/express.log 2>&1 &
echo 'Waiting for server to start...'
while true; do
lsof -i :3000 > /dev/null
if [[ $? == 0 ]]; then
break
fi;
done
SCRIPT
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network "forwarded_port", guest: 3000, host: 3000
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true
#
end