Skip to content

Instantly share code, notes, and snippets.

@timchunght
Forked from dommmel/Vagrantfile
Created September 25, 2015 20:35
Show Gist options
  • Save timchunght/5bfaf596e07436b39cdb to your computer and use it in GitHub Desktop.
Save timchunght/5bfaf596e07436b39cdb to your computer and use it in GitHub Desktop.

Revisions

  1. @dommmel dommmel revised this gist Jun 27, 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
    @@ -33,7 +33,7 @@ sudo apt-get install postgresql-common postgresql-9.3 libpq-dev -y 2> /dev/null
    sudo -u postgres createuser vagrant -s
    # Set super unsafe defaultz (dev only)
    sudo sh -c "echo -e 'local all all trust\nhost all all 127.0.0.1/32 trust\nhost all all ::1/128 trust' > /etc/postgresql/9.3/main/pg_hba.conf "
    sudo sh -c "echo 'local all all trust\nhost all all 127.0.0.1/32 trust\nhost all all ::1/128 trust' > /etc/postgresql/9.3/main/pg_hba.conf "
    sudo /etc/init.d/postgresql reload
    # install node (the rails asset pipeline need it)
  2. @dommmel dommmel revised this gist May 17, 2014. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,11 @@ sudo apt-get update -y
    sudo apt-get install postgresql-common postgresql-9.3 libpq-dev -y 2> /dev/null
    # create Postgres User
    sudo -u postgres createuser domi -s
    sudo -u postgres createuser vagrant -s
    # Set super unsafe defaultz (dev only)
    sudo sh -c "echo -e 'local all all trust\nhost all all 127.0.0.1/32 trust\nhost all all ::1/128 trust' > /etc/postgresql/9.3/main/pg_hba.conf "
    sudo /etc/init.d/postgresql reload
    # install node (the rails asset pipeline need it)
    sudo add-apt-repository ppa:chris-lea/node.js -y
  3. @dommmel dommmel created this gist May 17, 2014.
    82 changes: 82 additions & 0 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,82 @@
    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    $script = <<SCRIPT
    set -e
    set -x
    cd
    sudo apt-get update -y
    sudo apt-get 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 \
    -y 2> /dev/null
    # install Postgres
    sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
    wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
    sudo apt-get update -y
    sudo apt-get install postgresql-common postgresql-9.3 libpq-dev -y 2> /dev/null
    # create Postgres User
    sudo -u postgres createuser domi -s
    # install node (the rails asset pipeline need it)
    sudo add-apt-repository ppa:chris-lea/node.js -y
    sudo apt-get update -y
    sudo apt-get install nodejs -y
    # install rbenv
    git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
    git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
    # Setup rbenv paths
    pathstring='export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"'
    eval $pathstring
    echo $pathstring >> ~/.bashrc
    # Init rbenv
    initstring='eval "\$(rbenv init -)"'
    echo $initstring >> ~/.bashrc
    eval $initstring
    # install ruby
    rbenv install 2.1.2
    rbenv global 2.1.2
    ruby -v
    echo "gem: --no-ri --no-rdoc" > ~/.gemrc
    # install gems
    gem install bundler foreman rails
    rbenv rehash
    SCRIPT

    VAGRANTFILE_API_VERSION = "2"

    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    config.vm.box = "ubuntu/trusty64"
    #config.vm.provider "virtualbox" do |v|
    # v.gui = true
    # end

    config.vbguest.auto_update = false
    config.vm.network :forwarded_port, guest: 3000, host: 3000

    #if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id/*").empty?
    config.vm.provision :shell, inline: $script, privileged: false
    #end

    end