-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathVagrantfile
More file actions
84 lines (74 loc) · 3.26 KB
/
Vagrantfile
File metadata and controls
84 lines (74 loc) · 3.26 KB
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# 2 for backwards compatibility
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
# set up network ip and port forwarding
config.vm.network "forwarded_port", guest: 5000, host: 5000, 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 .gitconfig file so that git credentials are correct
if File.exists?(File.expand_path("~/.gitconfig"))
config.vm.provision "file", source: "~/.gitconfig", destination: "~/.gitconfig"
end
# Copying 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
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
# 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
# Make vi look nice
sudo -H -u ubuntu echo "colorscheme desert" > ~/.vimrc
# Install app dependencies
cd /vagrant
sudo pip install -r requirements.txt
SHELL
# Add PostgreSQL docker container
config.vm.provision "shell", inline: <<-SHELL
# Prepare PostgreSQL data share
sudo mkdir -p /var/lib/postgresql/data
sudo chown vagrant:vagrant /var/lib/postgresql/data
SHELL
# Add PostgreSQL docker container
config.vm.provision "docker" do |d|
d.pull_images "postgres"
d.run "postgres",
args: "-d --name postgres -p 5432:5432 -v /var/lib/postgresql/data:/var/lib/postgresql/data"
end
end