-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update vagrantfile and bootstrap to work with ubuntu trusty
- Loading branch information
1 parent
4258304
commit ef227e9
Showing
5 changed files
with
103 additions
and
68 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,41 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
VAGRANTFILE_API_VERSION = "2" | ||
|
||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
config.vm.box = "ubuntu-1310" | ||
config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-1310-x64-virtualbox-nocm.box" | ||
|
||
# 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: 3000, host: 3000, auto_correct: true | ||
config.vm.network :forwarded_port, guest: 3500, host: 3500, auto_correct: true | ||
config.vm.network :forwarded_port, guest: 9292, host: 9292, auto_correct: true | ||
|
||
# Create a private network, which allows host-only access to the machine | ||
# using a specific IP. | ||
config.vm.network :private_network, ip: "192.168.56.101" | ||
|
||
# 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| | ||
# # Don't boot with headless mode | ||
# vb.gui = true | ||
# | ||
# # Use VBoxManage to customize the VM. For example to change memory: | ||
# vb.customize ["modifyvm", :id, "--memory", "1024"] | ||
# end | ||
# | ||
# View the documentation for the provider you're using for more | ||
# information on available options. | ||
Vagrant.configure(2) do |config| | ||
|
||
config.vm.provider :virtualbox do |vb| | ||
vb.customize ["modifyvm", :id, "--memory", "1024"] | ||
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | ||
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] | ||
vb.customize ["modifyvm", :id, "--memory", 2048] | ||
vb.customize ["modifyvm", :id, "--cpus", 2] | ||
end | ||
|
||
config.vm.provision :shell, :path => "bootstrap.sh" | ||
config.vm.box = "ubuntu/trusty64" | ||
|
||
config.vm.provision :shell, inline: <<-SHELL | ||
if [ ! -f ~/.runonce ] | ||
then | ||
sudo apt-get install --reinstall -y language-pack-en | ||
sudo locale-gen "en_US.UTF-8" | ||
sudo dpkg-reconfigure locales | ||
echo 'LC_ALL="en_US.UTF-8"' | sudo tee -a /etc/default/locale | ||
echo 'LANG="en_US.UTF-8"' | sudo tee -a /etc/default/locale | ||
# Link the repo | ||
cd /home/vagrant/ | ||
ln -s /vagrant /home/vagrant/meppit | ||
touch ~/.runonce | ||
fi | ||
SHELL | ||
|
||
# config.vm.provision :shell, :path => "bootstrap.sh" | ||
|
||
|
||
#-----------------Network | ||
# config.vm.network :private_network, ip: "192.168.56.101" | ||
|
||
# App server | ||
config.vm.network :forwarded_port, guest: 3000, host: 3000, auto_correct: true | ||
config.vm.network :forwarded_port, guest: 3500, host: 3500, auto_correct: true | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,80 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ ! -f ~/runonce ] | ||
if [ ! -f ~/.runonce ] | ||
then | ||
# Update | ||
apt-get update | ||
apt-get upgrade -y | ||
# ============================ | ||
echo "-- UPDATE" | ||
sudo apt-get -y update | ||
sudo apt-get -y upgrade | ||
|
||
# ============================ | ||
# Install dependencies | ||
apt-get install -y git ruby2.0 ruby2.0-dev redis-server libpq-dev nodejs libxslt1.1 imagemagick build-essential libtool checkinstall libjson0-dev libxml2-dev libproj-dev python2.7-dev swig libgeos-3.3.3 libgeos-dev gdal-bin libgdal1-1.9.0-grass libgdal1-dev | ||
apt-get install --reinstall -y language-pack-en language-pack-pt | ||
echo "-- SETUP DEPS" | ||
sudo apt-get install -y curl vim build-essential libtool checkinstall python-pip python-dev gcc make sqlite3 libcurl4-openssl-dev ruby-dev libssl-dev openssl libreadline-dev git | ||
sudo apt-get install -y redis-server libpq-dev nodejs libxslt1.1 imagemagick libjson0-dev libxml2-dev libproj-dev python2.7-dev swig libgeos-3.4.2 libgeos-dev gdal-bin libgdal1-1.10.1-grass libgdal1-dev | ||
sudo apt-get install --reinstall -y language-pack-en language-pack-pt | ||
git config --global color.ui true | ||
|
||
# ============================ | ||
# setup rbenv | ||
echo "-- SETUP RBENV" | ||
git clone git://github.com/sstephenson/rbenv.git /home/vagrant/.rbenv | ||
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> /home/vagrant/.bashrc | ||
echo 'eval "$(rbenv init -)"' >> /home/vagrant/.bashrc | ||
export PATH="$HOME/.rbenv/bin:$PATH" | ||
eval "$(rbenv init -)" | ||
|
||
# setup ruby-build | ||
echo "-- SETUP RUBY-BUILD" | ||
git clone git://github.com/sstephenson/ruby-build.git /home/vagrant/.rbenv/plugins/ruby-build | ||
|
||
# postgresql 9.3 | ||
echo "deb http://apt.postgresql.org/pub/repos/apt/ saucy-pgdg main" >> /etc/apt/sources.list.d/pgdg.list | ||
apt-get install -y wget ca-certificates | ||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - | ||
apt-get update | ||
apt-get upgrade -y | ||
apt-get install -y postgresql-9.3 postgresql-contrib-9.3 postgresql-client-9.3 postgresql-server-dev-9.3 postgresql-9.3-postgis-2.1 postgresql-9.3-postgis-2.1-scripts | ||
# setup ruby | ||
echo "-- SETUP RUBY" | ||
source /home/vagrant/.bashrc | ||
rbenv install 2.0.0-p648 | ||
rbenv global 2.0.0-p648 | ||
rbenv rehash | ||
gem install bundler | ||
|
||
# ============================ | ||
# setup postgresql 9.4 and postgis 2.1 | ||
echo "-- SETUP POSTGRES" | ||
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | sudo tee -a /etc/apt/sources.list.d/pgdg.list | ||
wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | ||
sudo apt-get update | ||
|
||
sudo apt-get install -y postgresql-9.4 postgresql-server-dev-9.4 postgresql-contrib-9.4 postgresql-client-9.4 postgresql-9.4-postgis-2.1 postgresql-9.4-postgis-2.1-scripts | ||
|
||
# Create postgres user | ||
sudo -u postgres createuser -r -s -d vagrant | ||
sudo -u postgres createdb vagrant -O vagrant | ||
sudo -u postgres psql -c "ALTER USER vagrant WITH PASSWORD 'vagrant';" | ||
sudo -u postgres psql -c "ALTER USER vagrant SUPERUSER;" | ||
|
||
# Configure Meppit | ||
# ============================ | ||
echo "-- LINK PROJECT" | ||
cd /home/vagrant/ | ||
sudo -u vagrant ln -s /vagrant /home/vagrant/meppit | ||
ln -s /vagrant /home/vagrant/meppit | ||
|
||
cd meppit | ||
if [ ! -f config/application.yml ] | ||
then | ||
sudo -u vagrant cp config/application.yml.sample config/application.yml | ||
cp config/application.yml.sample config/application.yml | ||
fi | ||
|
||
if [ ! -f config/database.yml ] | ||
then | ||
sudo -u vagrant cp config/database.yml.sample config/database.yml | ||
sudo -u vagrant sed -i -e 's/username: postgres/username: vagrant/g' config/database.yml | ||
cp config/database.yml.sample config/database.yml | ||
sed -i '' -e 's/username: postgres/username: vagrant/g' config/database.yml | ||
fi | ||
source /home/vagrant/.bashrc | ||
|
||
# ============================ | ||
# Ruby dependencies | ||
gem install bundler | ||
|
||
# Setup | ||
sudo su - vagrant -c "cd ~/meppit && bundle" | ||
sudo su - vagrant -c "cd ~/meppit && bundle exec rake db:create db:migrate" | ||
sudo su - vagrant -c "cd ~/meppit && bundle exec rake db:create db:migrate RAILS_ENV=test" | ||
sudo su - vagrant -c "cd ~/meppit && bundle exec rspec" | ||
echo "-- RUBY DEPS" | ||
cd ~/meppit | ||
bundle | ||
bundle exec rake db:create db:migrate | ||
bundle exec rake db:create db:migrate RAILS_ENV=test | ||
bundle exec rspec | ||
|
||
touch ~/runonce | ||
touch ~/.runonce | ||
fi |
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