forked from nyu-devops/lab-bluemix-cf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
74 lines (65 loc) · 2.6 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
# -*- 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|
config.vm.box = "ubuntu/xenial64"
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"
# Provider-specific configuration
config.vm.provider "virtualbox" do |vb|
# Customize the amount of memory on the VM:
vb.memory = "512"
vb.cpus = 1
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 private ssh keys to use with github
if File.exists?(File.expand_path("~/.ssh/id_rsa"))
config.vm.provision "file", source: "~/.ssh/id_rsa", destination: "~/.ssh/id_rsa"
end
######################################################################
# Setup a Python development environment
######################################################################
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y git zip tree python-pip python-dev
apt-get -y autoremove
pip install --upgrade pip
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 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 ubuntu:ubuntu /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 -p 6379:6379 -v /var/lib/redis/data:/data"
end
end