Skip to content

Instantly share code, notes, and snippets.

@ashabhasa
Created July 19, 2016 07:27
Show Gist options
  • Save ashabhasa/b1d8203630cb4d6d6198933397cf534d to your computer and use it in GitHub Desktop.
Save ashabhasa/b1d8203630cb4d6d6198933397cf534d to your computer and use it in GitHub Desktop.
Vagrant file for rabbitmq and mongo
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.box_check_update = false
config.vm.hostname = "mobydick"
config.vm.network "forwarded_port", guest: 15672, host: 15672
config.vm.network :forwarded_port, guest: 4369, host: 4369
config.vm.network :forwarded_port, guest: 5672, host: 5672
config.vm.network "forwarded_port", guest: 27017, host: 27017
config.vm.provider "virtualbox" do |vb|
vb.name = "docker-box-yoox"
vb.memory = 2048
vb.cpus = 2
end
config.vm.provision "shell", inline: <<-SHELL.gsub(/^ +/, '')
echo "Install and update basic packeges"
sudo printf 'Acquire {http::User-Agent "Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0";};' >> /etc/apt/apt.conf
sudo apt-get update --fix-missing
sudo apt-get install -y -q git tree curl wget whois unzip vim
echo "Configure system settings"
sudo timedatectl set-timezone Europe/Rome
sudo update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
echo "Install Docker and tools"
sudo -i <<HEREDOC
if ! docker version &>/dev/null; then
wget -qO- https://get.docker.com/ | bash
sudo usermod -aG docker ubuntu
fi
if ! docker-compose --version &>/dev/null; then
curl -L https://github.com/docker/compose/releases/download/1.7.1/docker-compose-`uname -s`-`uname -m` \
> /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
fi
HEREDOC
echo "That's all, rock on!"
SHELL
end
#inside the host machine run the following command
#docker run -d -p 5672:5672 -p 15672:15672 --name local-rabbit rabbitmq:3-management
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment