Last active
May 10, 2017 13:02
-
-
Save foscomputerservices/acb85e32a01292b079dc to your computer and use it in GitHub Desktop.
Vagrantfile for Running RubyMine under Vagrant/VirtualBox/Ubuntu on Mac or Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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/trusty64" | |
# Create a forwarded port mapping which allows access to a specific port | |
# within the machine from a port on the host machine. In the example below, | |
# accessing "localhost:8080" will access port 80 on the guest machine. | |
config.vm.network "forwarded_port", guest: 3030, host: 3000 | |
# Create a private network, which allows host-only access to the machine | |
# using a specific IP. | |
# config.vm.network "private_network", ip: "192.168.33.10" | |
# Create a public network, which generally matched to bridged network. | |
# Bridged networks make the machine appear as another physical device on | |
# your network. | |
# config.vm.network "public_network" | |
# Share an additional folder to the guest VM. The first argument is | |
# the path on the host to the actual folder. The second argument is | |
# the path on the guest to mount the folder. And the optional third | |
# argument is a set of non-required options. | |
# config.vm.synced_folder "../data", "/vagrant_data" | |
mount_point="/home/vagrant/Repository" | |
if Gem.win_platform? | |
config.vm.synced_folder "c:\\Repository", mount_point | |
else | |
config.vm.synced_folder "~/Repository", mount_point | |
end | |
# Provider-specific configuration so you can fine-tune various | |
# backing providers for Vagrant. These expose provider-specific options. | |
# Example for VirtualBox: | |
# | |
config.vm.provider "virtualbox" do |vb| | |
# Display the VirtualBox GUI when booting the machine | |
vb.gui = true | |
# Customize the amount of memory on the VM: | |
vb.memory = "2048" | |
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 | |
sudo apt-get -y update | |
sudo apt-get -y install zip # No zip by default...really?? Ugh... | |
sudo apt-get -y install ubuntu-desktop # Allows RubyMine to display | |
### Setup Mysql | |
sudo -u root sh -c "export DEBIAN_FRONTEND=noninteractive ; apt-get -y -q install mysql-server mysql-client mysql-common libmysqlclient-dev" | |
mysql -uroot -e 'CREATE USER "vbmappapp_dev"@"localhost" IDENTIFIED BY "abc123"; CREATE USER "vbmappapp_test"@"localhost" IDENTIFIED BY "test123"; GRANT ALL PRIVILEGES ON *.* TO "vbmappapp_dev"@"localhost"; GRANT ALL PRIVILEGES ON *.* TO "vbmappapp_test"@"localhost"; FLUSH PRIVILEGES;' | |
mysql -uroot -e 'CREATE USER "vbmserver_dev"@"localhost" IDENTIFIED BY "abc123"; CREATE USER "vbmserver_test"@"localhost" IDENTIFIED BY "test123"; GRANT ALL PRIVILEGES ON *.* TO "vbmserver_dev"@"localhost"; GRANT ALL PRIVILEGES ON *.* TO "vbmserver_test"@"localhost"; FLUSH PRIVILEGES;' | |
mysql -uroot -e 'CREATE USER "dmtd_dev"@"localhost" IDENTIFIED BY "abc123"; CREATE USER "dmtd_test"@"localhost" IDENTIFIED BY "test123"; GRANT ALL PRIVILEGES ON *.* TO "dmtd_dev"@"localhost"; GRANT ALL PRIVILEGES ON *.* TO "dmtd_test"@"localhost"; FLUSH PRIVILEGES;' | |
mysql -uroot -e 'CREATE USER "efl_dev"@"localhost" IDENTIFIED BY "abc123"; CREATE USER "efl_test"@"localhost" IDENTIFIED BY "test123"; GRANT ALL PRIVILEGES ON *.* TO "efl_dev"@"localhost"; GRANT ALL PRIVILEGES ON *.* TO "efl_test"@"localhost"; FLUSH PRIVILEGES;' | |
### Setup redis | |
sudo add-apt-repository -y ppa:chris-lea/redis-server | |
sudo apt-get update | |
sudo apt-get -y install redis-server | |
### Setup Ruby on Rails | |
sudo apt-get -y install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev | |
# Manually configure RBENV | |
sudo -i -u vagrant sh -c "git clone git://github.com/sstephenson/rbenv.git /home/vagrant/.rbenv" | |
sudo -i -u vagrant sh -c "git clone git://github.com/sstephenson/ruby-build.git /home/vagrant/.rbenv/plugins/ruby-build" | |
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> /home/vagrant/.profile | |
echo 'eval "$(rbenv init -)"' >> /home/vagrant/.profile | |
# Manually install Ruby | |
sudo -i -u vagrant sh -c "rbenv install 2.2.2" | |
sudo -i -u vagrant sh -c "rbenv global 2.2.2" | |
sudo -i -u vagrant sh -c "echo 'gem: --no-document' > /home/vagrant/.gemrc" | |
sudo -i -u vagrant sh -c "gem install rails -v 4.2.0" # Ruby on Rails | |
echo 'export bamboo_VBMAPAPP_MYSQL_SOCKET="/var/run/mysqld/mysqld.sock"' >> /home/vagrant/.profile | |
### Download RubyMine | |
sudo apt-get -y install default-jdk | |
sudo -i -u vagrant sh -c "cd /home/vagrant ; wget http://download.jetbrains.com/ruby/RubyMine-7.1.3.tar.gz" | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment