Skip to content

Instantly share code, notes, and snippets.

@bbaaxx
Last active October 21, 2018 11:12

Revisions

  1. bbaaxx revised this gist Dec 12, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    "--memory", ram,
    ]

    # Allow the creation of symlinks for nodejs
    # Allow the creation of symlinks for nvm
    # http://blog.liip.ch/archive/2012/07/25/vagrant-and-node-js-quick-tip.html
    vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant","1"]
    end
  2. bbaaxx created this gist Dec 11, 2014.
    66 changes: 66 additions & 0 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,66 @@
    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    box = 'ubuntu/trusty64'
    hostname = 'emberclibox'
    domain = 'example.com'
    ip = '192.168.42.42'
    ram = '512'

    $rootScript = <<SCRIPT
    echo "I am provisioning..."
    echo doing it as $USER
    cd /home/vagrant
    add-apt-repository ppa:git-core/ppa
    apt-get update
    apt-get install -y vim git-core curl
    SCRIPT

    $userScript = <<SCRIPT
    cd /home/vagrant
    wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh
    export NVM_DIR="/home/vagrant/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
    nvm install 0.10.33
    nvm alias default 0.10.33
    npm install -g bower ember-cli
    SCRIPT

    VAGRANTFILE_API_VERSION = "2"

    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    config.vm.box = box
    config.vm.hostname = hostname

    # Forwarding default ports for ember server and livereload
    config.vm.network :forwarded_port, guest: 4200, host: 4200, auto_correct: true
    config.vm.network :forwarded_port, guest: 35729, host: 35729, auto_correct: true

    config.vm.network "private_network", ip: "10.42.42.42"

    config.ssh.forward_agent = true

    config.vm.synced_folder ".", "/vagrant",
    owner: "vagrant", group: "vagrant"

    # Removes "stdin: is not a tty" annoyance as per
    # https://github.com/SocialGeeks/vagrant-openstack/commit/d3ea0695e64ea2e905a67c1b7e12d794a1a29b97
    config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"

    config.vm.provider "virtualbox" do |vb|
    vb.customize [
    "modifyvm", :id,
    "--memory", ram,
    ]

    # Allow the creation of symlinks for nodejs
    # http://blog.liip.ch/archive/2012/07/25/vagrant-and-node-js-quick-tip.html
    vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant","1"]
    end

    # Shell provisioning.
    config.vm.provision "shell", inline: $rootScript
    config.vm.provision "shell", inline: $userScript, privileged: false

    end