Skip to content

Instantly share code, notes, and snippets.

@chrisvel
Forked from hopsor/Vagrantfile
Created November 18, 2020 10:28
Show Gist options
  • Select an option

  • Save chrisvel/30aefddb5d39310eaf17415b0d06d5db to your computer and use it in GitHub Desktop.

Select an option

Save chrisvel/30aefddb5d39310eaf17415b0d06d5db to your computer and use it in GitHub Desktop.

Revisions

  1. @hopsor hopsor revised this gist Oct 5, 2014. 2 changed files with 43 additions and 2 deletions.
    30 changes: 30 additions & 0 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
    VAGRANTFILE_API_VERSION = "2"

    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    # All Vagrant configuration is done here. The most common configuration
    # options are documented and commented below. For a complete reference,
    # please see the online documentation at vagrantup.com.

    # Every Vagrant virtual environment requires a box to build off of.
    config.vm.box = "ubuntu-14.04"

    config.vm.network :forwarded_port, guest: 3000, host: 3000
    config.vm.network :private_network, ip: "192.168.50.4"
    config.vm.synced_folder "./www", "/vagrant_data", nfs: true

    config.vm.provider :virtualbox do |vb|
    # Use VBoxManage to customize the VM. For example to change memory:
    vb.customize ["modifyvm", :id, "--memory", "4096"]
    end

    config.ssh.forward_agent = true

    # Shell provisioning
    config.vm.provision "shell" do |s|
    s.path = "vagrant-provision/setup.sh"
    end
    end
    15 changes: 13 additions & 2 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,10 @@ source /usr/local/rvm/scripts/rvm
    rvm use --install 1.9.3
    rvm use --install 2.1.3

    # Adding user vagrant to rvm group so that he can use rvm
    echo "Adding vagrant user to rvm group"
    usermod -a -G rvm vagrant

    # NodeJS
    echo "Installing nodejs"
    curl -sL https://deb.nodesource.com/setup | sudo bash -
    @@ -25,8 +29,8 @@ apt-get install -y postgresql postgresql-contrib libpq-dev
    # MySQL + Developer dependencies
    echo "Preparing MySQL"
    apt-get install debconf-utils -y > /dev/null
    debconf-set-selections <<< "mysql-server mysql-server/root_password password ***"
    debconf-set-selections <<< "mysql-server mysql-server/root_password_again password ***"
    debconf-set-selections <<< "mysql-server mysql-server/root_password password 1234"
    debconf-set-selections <<< "mysql-server mysql-server/root_password_again password 1234"

    echo "Installing MySQL + Developer dependencies"
    apt-get install -y mysql-server libmysqlclient-dev
    @@ -45,3 +49,10 @@ apt-get install -y imagemagick libmagick++-dev libmagickwand-dev

    echo "Installing nokogiri dependencies"
    apt-get install -y libxslt-dev libxml2-dev

    # Installing zsh setting as default shell for vagrant user
    echo "Installing zsh, oh-my-zsh and setting it as default shell for vagrant user"
    apt-get install -y zsh
    sudo su - vagrant -c 'wget --no-check-certificate http://install.ohmyz.sh -O - | sh'
    sudo su - vagrant -c "echo 'source /etc/profile.d/rvm.sh' >> ~/.zshrc"
    chsh -s $(which zsh) vagrant
  2. @hopsor hopsor renamed this gist Oct 5, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @hopsor hopsor created this gist Oct 5, 2014.
    47 changes: 47 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    #!/bin/bash

    echo "Provisioning virtual machine"

    # Git
    echo "Installing Git"
    apt-get install git -y

    # RVM + 1.9.3 + 2.1.3
    echo "Installing rvm + ruby 1.9.3 + ruby 2.1.3"
    curl -sSL https://get.rvm.io | bash -s $1
    source /usr/local/rvm/scripts/rvm
    rvm use --install 1.9.3
    rvm use --install 2.1.3

    # NodeJS
    echo "Installing nodejs"
    curl -sL https://deb.nodesource.com/setup | sudo bash -
    apt-get install -y nodejs

    # Postgresql + Contrib package + Developer dependencies
    echo "Installing postgresql + Contrib package + Developer dependencies"
    apt-get install -y postgresql postgresql-contrib libpq-dev

    # MySQL + Developer dependencies
    echo "Preparing MySQL"
    apt-get install debconf-utils -y > /dev/null
    debconf-set-selections <<< "mysql-server mysql-server/root_password password ***"
    debconf-set-selections <<< "mysql-server mysql-server/root_password_again password ***"

    echo "Installing MySQL + Developer dependencies"
    apt-get install -y mysql-server libmysqlclient-dev

    # MongoDB
    echo "Installing mongodb"
    apt-get install -y mongodb

    # Redis
    echo "Installing redis"
    apt-get install -y redis-server

    # Other dependencies such as imagemagick, libxslt, etc. Most of them needed by principal ruby gems
    echo "Installing imagemagick and rmagick related dependencies"
    apt-get install -y imagemagick libmagick++-dev libmagickwand-dev

    echo "Installing nokogiri dependencies"
    apt-get install -y libxslt-dev libxml2-dev