Skip to content
tsujigiri edited this page May 5, 2011 · 14 revisions

Setup your development environment

Install needed Packages

sudo apt-get install libsqlite3-dev libpq-dev libxslt-dev libxml2-dev curl git libreadline-dev libssl-dev zlib1g-dev

Get the sourcecode

git clone https://github.com/geigercrowd/geigercrowd_on_rails.git

Install Ruby Version Manager (your user only)

bash <(curl -B http://rvm.beginrescueend.com/install/rvm)
echo [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc

Restart your teminal to reread your bashrc.

Now we create a gemset and install ruby

cd geigercrowd_on_rails

Confirm that you trust the .rvmrc file.

rvm install ruby-1.9.2-p180 --with-zlib-dir=/usr/lib --with-readline-dir=/usr/lib --with-openssl-dir=/usr/lib

get a coffee ... :)

rvm  ruby-1.9.2-p180
rvm gemset create geigercrowd
gem install bundler
bundle install

get a new coffee ... :)

cp config/database.yml.sample config/database.yml
rake db:create
rake db:migrate

Workaround for silent-postgres, comment out this line in "Gemfile"

#gem 'silent-postgres', '~> 0.0.7'

now, rake db:migrate should work.

Lets start WEBrick-Server with

 rails server

Now you should be able to access http://127.0.0.1:3000 If you see a login-form everything is fine. Press CTRL-C to stop WEBrick again, restart it with rails server -d to run it as a deamon.

Let's create a user.

Open http://127.0.0.1:3000 in your Browser and Klick an Sign up.

Fill the form and Submit.

Next is to confirm your new Account. Since your email-setup is not working yet, lets do it by hand :)

rails console
> User.first.confirm!

Press -D to leave this console yey ... thats it ... lets login :)

oh deam ... there is no value for SI-Unit. Ok, lets get Admin rights to add some :)

 rails console
 > User.first.update_attribute :admin, true

Yey ... we hacked 127.0.0.1 :)

A new menu "Data types" appeared. Lets create one.

Install Redis:

cd ~
wget http://redis.googlecode.com/files/redis-2.2.4.tar.gz
tar xpvfz redis-2.2.4.tar.gz
cd redis-2.2.4
./configure && make && sudo make install

Start redis

 redis-server

Now - everything is finished ... have fun :)

Initial Deployment (or additional setup for development)

Seed the database with DataSources to scrape, import the scrape the data sources and set the goordinates for the imported data

 rake db:seed
 rake utilities:scrape
 rake utilities:import_bousai_locations 

Run resque (used for asynchronous reverse geocoding)

 QUEUE=* VERBOSE=true rake environment resque:work

Run resque-sheduler (used for resheduling failed jobs)

 rake resque:scheduler INITIALIZER_PATH=config/initializers/resque.rb
Clone this wiki locally