Development Setup

Version 21 (Camdon Cady, 12/06/2014 02:34 pm)

1 1 Matthew Sears
h1. Development Setup
2 1 Matthew Sears
3 2 J. Simmons
The following instructions are meant to help get the ODE application up and running on your local workstation.  Note, these instructions assume you are setting up a development environment on Linux/OS X.
4 1 Matthew Sears
5 3 J. Simmons
h1. Prerequisites
6 3 J. Simmons
7 3 J. Simmons
* SVN
8 20 Camdon Cady
* MySQL (Currently tested with MySQL v5.1)
9 9 J. Simmons
* Ruby 1.8.7 (with Development Tools)
10 14 Jeremy Wright
* Bundler (may need to update gem to 1.4+)
11 14 Jeremy Wright
<pre>gem install bundler</pre>
12 19 Camdon Cady
** To update gem you may need to run (su to root):
13 14 Jeremy Wright
<pre>REALLY_GEM_UPDATE_SYSTEM=1 gem update --system</pre>
14 19 Camdon Cady
** After this update you'll need to reinstall bundler.
15 20 Camdon Cady
* Install Ruby on Rails (Currently tested with Rails v2.3.16)
16 20 Camdon Cady
<pre>gem install rails --include-dependencies -v 2.3.16</pre>
17 3 J. Simmons
18 1 Matthew Sears
h1.  Code checkout
19 1 Matthew Sears
20 1 Matthew Sears
To get started, create a local repository with svn checkout:
21 1 Matthew Sears
22 1 Matthew Sears
<pre>
23 1 Matthew Sears
svn checkout https://opendesignengine.net/svn/ode/trunk
24 1 Matthew Sears
</pre>
25 1 Matthew Sears
26 1 Matthew Sears
h1. Create Development Database
27 1 Matthew Sears
28 11 Jeremy Wright
You will need to setup a local development MySQL database and call it 'ode_development'.  Next we need to create a new database.yml so the application knows how to connect to the database.  To accomplish this, simple copy the database.yml.exampe file:
29 1 Matthew Sears
30 1 Matthew Sears
<pre>
31 5 J. Simmons
cd trunk
32 4 J. Simmons
cp config/database.yml.example config/database.yml
33 1 Matthew Sears
</pre>
34 1 Matthew Sears
35 12 Jeremy Wright
Under the production: section of the the config file, fill in the database name, username, and password.  Be sure to create the database in MySQL afterwards.
36 1 Matthew Sears
37 21 Camdon Cady
To create the database, run the following commands:
38 21 Camdon Cady
39 21 Camdon Cady
<pre>
40 21 Camdon Cady
create database ode_development character set utf8
41 21 Camdon Cady
create user 'ode_development'@'localhost' identified by 'my_password'
42 21 Camdon Cady
grant all privileges on ode_development.* to 'ode_development'@'localhost'
43 21 Camdon Cady
</pre>
44 21 Camdon Cady
45 1 Matthew Sears
h1. Bundler
46 1 Matthew Sears
47 1 Matthew Sears
To install the required third-party gems to run the ODE application, we run the following Bundler command:
48 1 Matthew Sears
49 1 Matthew Sears
<pre>
50 1 Matthew Sears
bundle install
51 1 Matthew Sears
</pre>
52 1 Matthew Sears
53 15 Jeremy Wright
Note: You may also need to install the libmysqlclient-dev package to get the MySQL gem to install.
54 1 Matthew Sears
55 1 Matthew Sears
h1. Database Preparation
56 1 Matthew Sears
57 1 Matthew Sears
To prepare the database, we first need to run migrations:
58 1 Matthew Sears
59 1 Matthew Sears
<pre>
60 1 Matthew Sears
RAILS_ENV=production rake db:migrate
61 1 Matthew Sears
</pre>
62 1 Matthew Sears
63 18 Jeremy Wright
and for the plugins:
64 18 Jeremy Wright
65 18 Jeremy Wright
<pre>
66 18 Jeremy Wright
RAILS_ENV=production rake db:migrate_plugins
67 18 Jeremy Wright
</pre>
68 18 Jeremy Wright
69 1 Matthew Sears
We now need some seed data to get started:
70 1 Matthew Sears
71 1 Matthew Sears
<pre>
72 1 Matthew Sears
RAILS_ENV=production rake db:seed
73 1 Matthew Sears
</pre>
74 1 Matthew Sears
75 1 Matthew Sears
h1. Running the Application
76 1 Matthew Sears
77 1 Matthew Sears
Now we should be ready to run the application locally:
78 1 Matthew Sears
79 1 Matthew Sears
<pre>
80 1 Matthew Sears
RAILS_ENV=production script/server
81 1 Matthew Sears
</pre>
82 1 Matthew Sears
83 1 Matthew Sears
If all goes well, you should be able to open the application at http://localhost:3000