-
Notifications
You must be signed in to change notification settings - Fork 0
Setting up your development environment
Here is a basic walkthrough on how to set up your development on an ubuntu precise (12.04) 32bit machine. The basic RVM info was taken from the Rails Tutorial Book.
$ sudo apt-get update && sudo apt-get upgrade -y
$ sudo apt-get install -y \
openjdk-7-jre ruby1.9.3 git-core curl nodejs postgresql-9.1 \
postgresql-server-dev-9.1 -y
It is recommended that we use the same database for development as we will use for production. Postgresql is well regarded, and is the current plan for our database. If using Mac, follow the instructions here but replace the username 'blog' with octopi. For ubuntu 12.04, follow the steps below (hints were modified from a StackOverflow post):
Set up a user for your ubuntu login
$ sudo su postgres -c psql
postgres=# CREATE ROLE <username> SUPERUSER LOGIN;
postgres=# \q
Log in to postgres and create an octopi
user and change some database encoding settings
You will have to enter the following commands, isolated here for copy/paste ease.
CREATE USER octopi CREATEDB;
update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8'
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
update pg_database set datistemplate=true where datname='template1';
$ psql
vagrant=# CREATE USER octopi CREATEDB;
CREATE ROLE
vagrant=# update pg_database set datistemplate=false where datname='template1';
UPDATE 1
vagrant=# drop database Template1;
DROP DATABASE
vagrant=# create database template1 with owner=postgres encoding='UTF-8'
vagrant-# lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
CREATE DATABASE
vagrant=#
vagrant=# update pg_database set datistemplate=true where datname='template1';
UPDATE 1
vagrant=# \q
I have the project configured to use ruby 2.0.0 and use rvm to manage a gemset. If you use a different gemset manager, you can ignore this and try to get it running with your own manager. Remember, do not run the RVM setup as root - it should be a user-level install.
$ curl -sSL https://get.rvm.io | bash -s stable
$ source ~/.bash_profile
Right now, you should go through and edit your ~/.bash* and ~/.zsh* files if you desire, since rvm appends stuff to them.
$ rvm requirements
$ rvm install 2.0.0
$ rvm use 2.0.0@octopi-webapp --create
Now you can go ahead and clone octopi-webapp
using whichever method you like best. When you cd into the octopi-webapp
folder, you should be greeted with:
You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to [.]ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /home/vagrant/octopi-webapp/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
********************************************************************************************************************
* NOTICE *
********************************************************************************************************************
* RVM has encountered a new or modified .rvmrc file in the current directory, this is a shell script and *
* therefore may contain any shell commands. *
* *
* Examine the contents of this file carefully to be sure the contents are safe before trusting it! *
* Do you wish to trust '/home/vagrant/octopi-webapp/.rvmrc'? *
* Choose v[iew] below to view the contents *
********************************************************************************************************************
y[es], n[o], v[iew], c[ancel]>
Go ahead and enter y
for yes. The reason we are using a .rvmrc rather than other rvm files is because RubyMine likes .rvmrc files.
You can verify things are going well by the following:
$ rvm gemset list
gemsets for ruby-2.0.0-p451 (found in /home/vagrant/.rvm/gems/ruby-2.0.0-p451)
(default)
global
=> octopi-webapp
From this point, you should be able to install RubyMine via the website, open the octopi-webapp
project, and have all the 'Tools | Bundler' options work just as if they were run in the command line.
$ bundle install
$ rake db:migrate
$ rails s
Now try and open localhost:3000
in your browser of choice.