-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathVagrantfile
97 lines (85 loc) · 3.72 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# -*- 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.
Vagrant.configure(2) do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/xenial64"
# set up network ip and port forwarding
config.vm.network "forwarded_port", guest: 8888, host: 8888, host_ip: "127.0.0.1"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provider "virtualbox" do |vb|
# Customize the amount of memory on the VM:
vb.memory = "512"
vb.cpus = 1
# Fixes some DNS issues on some networks
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
# Copy your .gitconfig file so that your git credentials are correct
if File.exists?(File.expand_path("~/.gitconfig"))
config.vm.provision "file", source: "~/.gitconfig", destination: "~/.gitconfig"
end
# Copy your ssh keys for github so that your git credentials work
if File.exists?(File.expand_path("~/.ssh/id_rsa"))
config.vm.provision "file", source: "~/.ssh/id_rsa", destination: "~/.ssh/id_rsa"
end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y git python-pip python-dev build-essential
pip install --upgrade pip
apt-get -y autoremove
# Install Bluemix_CLI
echo "\n******************************"
echo " Installing Bluemix CLI"
echo "******************************\n"
wget -q -O - https://clis.ng.bluemix.net/download/bluemix-cli/latest/linux64 | tar xzv
cd Bluemix_CLI/
./install_bluemix_cli
cd ..
rm -fr Bluemix_CLI/
bluemix config --usage-stats-collect false
# Make vi look nice
sudo -H -u vagrant echo "colorscheme desert" > ~/.vimrc
# Install PhantomJS for Selenium browser support
echo "\n***********************************"
echo " Installing PhantomJS for Selenium"
echo "***********************************\n"
sudo apt-get install -y chrpath libssl-dev libxft-dev
# PhantomJS https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
cd ~
export PHANTOM_JS="phantomjs-1.9.7-linux-x86_64"
#export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
rm -f $PHANTOM_JS.tar.bz2
# Install app dependencies
echo "\n******************************"
echo " Installing App Dependencies"
echo "******************************\n"
cd /vagrant
sudo pip install -r requirements.txt
SHELL
######################################################################
# Add Redis docker container
######################################################################
config.vm.provision "shell", inline: <<-SHELL
# Prepare Redis data share
sudo mkdir -p /var/lib/redis/data
sudo chown vagrant:vagrant /var/lib/redis/data
SHELL
# Add Redis docker container
config.vm.provision "docker" do |d|
d.pull_images "redis:alpine"
d.run "redis:alpine",
args: "--restart=always -d --name redis -h redis -p 6379:6379 -v /var/lib/redis/data:/data"
end
end