Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
export http_proxy=#{ENV['http_proxy']}
export https_proxy=#{ENV['https_proxy']}
export HTTP_PROXY=#{ENV['http_proxy']}
export HTTPS_PROXY=#{ENV['https_proxy']}
echo "export http_proxy=#{ENV['http_proxy']}" > /etc/profile.d/proxy.sh
echo "export https_proxy=#{ENV['https_proxy']}" >> /etc/profile.d/proxy.sh
echo "export HTTP_PROXY=#{ENV['http_proxy']}" >> /etc/profile.d/proxy.sh
echo "export HTTPS_PROXY=#{ENV['https_proxy']}" >> /etc/profile.d/proxy.sh
echo "export NO_PROXY='localhost,10.20.1.15,127.0.0.1'" >> /etc/profile.d/proxy.sh
echo "http_proxy=#{ENV['http_proxy']}" > /etc/environment
echo "https_proxy=#{ENV['https_proxy']}" >> /etc/environment
echo "HTTP_PROXY=#{ENV['http_proxy']}" > /etc/environment
echo "HTTPS_PROXY=#{ENV['https_proxy']}" > /etc/environment
echo "NO_PROXY='localhost,10.20.1.15,127.0.0.1'" >> /etc/environment
echo "vm.swappiness=0" >> /etc/sysctl.conf
echo "kernel.randomize_va_space=1" >> /etc/sysctl.conf
echo "vm.dirty_ratio=3" >> /etc/sysctl.conf
echo "vm.dirty_background_ratio=2" >> /etc/sysctl.conf
echo "vm.overcommit_memory=1" >> /etc/sysctl.conf
echo "vm.mmap_min_addr=4096" >> /etc/sysctl.conf
echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
sysctl -p
echo '* hard nofile 999999' >> /etc/security/limits.conf
echo '* soft nofile 999999' >> /etc/security/limits.conf
echo 'nameserver 8.8.8.8' > /etc/resolvconf/resolv.conf.d/base
resolvconf -u
apt-get update -y
apt-get upgrade -y
apt-get install -y python-dev python-setuptools curl
easy_install pip
# INSTALL DOCKER ENGINE
curl -sSL --proxy '#{ENV['http_proxy']}' https://get.docker.com/ | sh
systemctl enable docker
mkdir -p /etc/systemd/system/docker.service.d
touch /etc/systemd/system/docker.service.d/proxy.conf
echo '[Service]' > /etc/systemd/system/docker.service.d/proxy.conf
echo 'Environment=HTTP_PROXY=#{ENV['http_proxy']}' >> /etc/systemd/system/docker.service.d/proxy.conf
echo 'Environment=HTTPS_PROXY=#{ENV['https_proxy']}' >> /etc/systemd/system/docker.service.d/proxy.conf
systemctl daemon-reload
systemctl restart docker
pip install docker-compose
# INSTALL GO 1.6
curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
tar -zxvf go1.6.linux-amd64.tar.gz
mv go /usr/local
ln -s /usr/local/go/bin/go /usr/bin/go
rm -rf go1.6.linux-amd64.tar.gz go
SCRIPT
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/wily64"
config.vm.hostname = "vagrant01"
config.vm.network :private_network, ip: "10.20.1.15"
config.vm.network "forwarded_port", guest: 80, host: 8888, auto_correct: true
config.vm.network "forwarded_port", guest: 5432, host: 5432, auto_correct: true
config.vm.network "forwarded_port", guest: 5000, host: 5000, auto_correct: true
config.vm.network "forwarded_port", guest: 5601, host: 5601, auto_correct: true
config.vm.network "forwarded_port", guest: 8000, host: 8000, auto_correct: true
config.vm.network "forwarded_port", guest: 8080, host: 8080, auto_correct: true
config.vm.network "forwarded_port", guest: 9000, host: 9000, auto_correct: true
config.vm.network "forwarded_port", guest: 9200, host: 9200, auto_correct: true
config.vm.network "forwarded_port", guest: 6379, host: 6379, auto_correct: true
vagrantdir = File.dirname(__FILE__)
stackdir = "#{ENV['HOME']}"
link = File.expand_path('.files', vagrantdir)
Dir.mkdir(stackdir, 0755) unless File.exists?(stackdir)
File.symlink(stackdir, link) unless File.symlink?(link)
config.vm.synced_folder ".files", "/vagrant"
config.vm.provider "virtualbox" do |v|
v.name = "vagrant01"
v.memory = 4096
v.cpus = 4
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
config.vm.provision "shell", inline: $script, privileged: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment