From 5ff027c877f5069a5b4c367ec7bdf262cf8451e7 Mon Sep 17 00:00:00 2001 From: Alan Peabody Date: Tue, 18 Mar 2014 23:10:53 -0400 Subject: [PATCH] Initial commit --- .gitignore | 1 + README.md | 3 +++ Vagrantfile.example | 22 ++++++++++++++++++++++ scripts/base.sh | 5 +++++ scripts/postgresql.sh | 15 +++++++++++++++ scripts/ruby-2.1.sh | 22 ++++++++++++++++++++++ 6 files changed, 68 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 Vagrantfile.example create mode 100644 scripts/base.sh create mode 100644 scripts/postgresql.sh create mode 100644 scripts/ruby-2.1.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8000dd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vagrant diff --git a/README.md b/README.md new file mode 100644 index 0000000..9a6af9d --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Agilion Development Environment (alpha) + +Super simple bash based Vagrant provisioning for Rails development environments. diff --git a/Vagrantfile.example b/Vagrantfile.example new file mode 100644 index 0000000..7116d0c --- /dev/null +++ b/Vagrantfile.example @@ -0,0 +1,22 @@ +# -*- 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| + config.vm.box = 'hashicorp/precise64' + + config.vm.network 'forwarded_port', guest: 3000, host: 3050 + + config.vm.synced_folder '.', '/vagrant', type: 'rsync', + rsync__exclude: '.git/' + + config.vm.provider 'virtualbox' do |vb| + vb.customize ['modifyvm', :id, '--memory', '512'] + end + + config.vm.provision 'shell', path: 'base.sh' + config.vm.provision 'shell', path: 'ruby-2.1.sh', privileged: false, keep_color: true + config.vm.provision 'shell', path: 'postgresql.sh' +end diff --git a/scripts/base.sh b/scripts/base.sh new file mode 100644 index 0000000..bf9f525 --- /dev/null +++ b/scripts/base.sh @@ -0,0 +1,5 @@ +apt-get update -y + +# Common Packages +# memcached and redis will be running on their standard ports. +apt-get install -y curl redis-server memcached libcurl3 libcurl3-gnutls libcurl4-openssl-dev diff --git a/scripts/postgresql.sh b/scripts/postgresql.sh new file mode 100644 index 0000000..6d97e22 --- /dev/null +++ b/scripts/postgresql.sh @@ -0,0 +1,15 @@ +# Install postgres +apt-get install -y postgresql libpq-dev postgresql-contrib + +# Create DB +if [ ! -d '/usr/local/pgsql/data' ]; then + mkdir -p /usr/local/pgsql/data + chown postgres:postgres /usr/local/pgsql/data + su - postgres -l -c '/usr/lib/postgresql/9.1/bin/initdb -D /usr/local/pgsql/data' + + # Setup hstor + su - postgres -l -c 'psql -d template1 -c "create extension hstore;"' +fi + +# Create vagrant user +su - postgres -l -c 'createuser vagrant -s' diff --git a/scripts/ruby-2.1.sh b/scripts/ruby-2.1.sh new file mode 100644 index 0000000..cc2e5fa --- /dev/null +++ b/scripts/ruby-2.1.sh @@ -0,0 +1,22 @@ +# Installs RVM & Ruby 2.1 on 12.04 LTS Ubuntu +# add to Vagrantfile: +# config.vm.provision 'shell', path: 'ruby-2.1.sh', privileged: false, keep_color: true + +if [[ -s "/home/vagrant/.rvm/scripts/rvm" ]] ; then + echo 'RVM installed, skipping RVM install' +else + curl -sSL https://get.rvm.io | bash -s stable +fi + +source '/home/vagrant/.rvm/scripts/rvm' + +if rvm list strings | grep -lq ruby-2.1.0 ; then + echo 'Ruby 2.1.0 installed. Skipping installed.' +else + rvm autolibs packages + rvm requirements + rvm mount https://rvm.io/binaries/ubuntu/12.04/x86_64/ruby-2.1.0.tar.bz2 + rvm use 2.1.0 --default +fi + +echo 'Setting Ruby 2.1 as default'