Browse Source

initial rails-dev-box vagrant implementation

vagrant^2
noi narisak 10 years ago
parent
commit
0f15901151
  1. 59
      NOTES.txt
  2. 11
      README.md
  3. 28
      README.rdoc
  4. 6
      Vagrantfile
  5. 16
      etc/postgres/enable_utf8_template.sql

59
NOTES.txt

@ -0,0 +1,59 @@
* Road blocks and fixes:
##- When trying to do 'vagrant plugin install vagrant-vbguest' got the follownig nokogiri error. Vagrant v1.6.3 on OSX 10.8.5.
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Building nokogiri using packaged libraries.
Building libxml2-2.8.0 for nokogiri with the following patches applied:
- 0001-Fix-parser-local-buffers-size-problems.patch
...
...
...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
An error occurred while installing nokogiri (1.6.3.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.3.1'` succeeds before bundling.
...
...
- Workaround
$ export NOKOGIRI_USE_SYSTEM_LIBRARIES=true
$ vagrant plugin install vagrant vagrant-vbguest
$ vagrant plugin list (validate install)
##- Executing "rake db:create" you get the following errors
PG::Error: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "db/bikedb_development" ENCODING = 'utf8'
- Solution: follow the instructions here
http://journal.tianhao.info/2010/12/postgresql-change-default-encoding-of-new-databases-to-utf-8-optional/
## UPDATE - 2014.09.03
Implemented a simple psql script that does the exactly as the url above. Do the following inside guest-OS
$ vagrant ssh
$ psql -d postgres -f /vagrant/etc/postgres/enable_utf8_template.sql
$ sudo -u postgres psql postgres
postgres=# \l
(The ENCODING should be UTF8 for 'template1' database)
Original resources for the Vagrantfile.
http://gorails.com/guides/using-vagrant-for-rails-development
=========================================
## TODOs ##
- Add the etc/enable_utf8_template.sql into Vagrant provision routine. One less task to for developer to execute.
- Create developement instructions (README.rdoc?), outlining the commands get the Vagrant/Bike-DB up and running.

11
README.md

@ -0,0 +1,11 @@
#bike-db
=============
Bike-db is an open source project that aims to helpcommunity bicycle projects track bikes, clients, and volunteers.
Bike-db is a Ruby on Rails project. The database used is PostGres.
An instance can be seen running at http://secret-earth-4230.herokuapp.com/
The storyboard / feature list is at https://trello.com/b/ZCZ9sThH/bike-db-app
Feel free to request feature additions!

28
README.rdoc

@ -0,0 +1,28 @@
== README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.

6
Vagrantfile

@ -20,9 +20,11 @@ Vagrant.configure('2') do |config|
v.customize ['set', :id, '--on-window-close', 'keep-running'] v.customize ['set', :id, '--on-window-close', 'keep-running']
end end
# Enable, if you are NOT OSX.
# config.vm.synced_folder '.', '/vagrant', type: 'rsync' # config.vm.synced_folder '.', '/vagrant', type: 'rsync'
# Enable if you are on OSX
config.vm.synced_folder '/src', '/vagrant', type: 'nfs' # Enable ,if you are on OSX for increase performance. NOTE: May require Admin password
config.vm.synced_folder '.', '/vagrant', type: 'nfs'
config.vm.network :private_network, ip: '33.33.33.33' config.vm.network :private_network, ip: '33.33.33.33'
config.vm.network :forwarded_port, guest: 3000, host: 3000 config.vm.network :forwarded_port, guest: 3000, host: 3000

16
etc/postgres/enable_utf8_template.sql

@ -0,0 +1,16 @@
/*
* Updates the default 'template1' database into UTF-8 instead of SQL_ASCII.
*/
UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
DROP DATABASE template1;
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
\c template1
VACUUM FREEZE;
UPDATE pg_database SET datallowconn = FALSE WHERE datname = 'template1';
Loading…
Cancel
Save