Project

General

Profile

Installing the Tapestry application » History » Version 26

Tom Clegg, 09/18/2012 11:11 AM

1 20 Tom Clegg
h1. Installing the Tapestry application
2 1 Tom Clegg
3 2 Tom Clegg
Install ruby .deb from http://www.rubyenterpriseedition.com/download.html
4 1 Tom Clegg
5 22 Tom Clegg
Install rails.
6 1 Tom Clegg
7 22 Tom Clegg
 sudo gem install rails
8 1 Tom Clegg
sudo gem install passenger
9
sudo /usr/local/bin/passenger-install-apache2-module
10
11
Add stuff (as provided by passenger-install) to your conf.d/passenger.conf
12
13
<pre>
14 23 Tom Clegg
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
15
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
16 1 Tom Clegg
PassengerRuby /usr/local/bin/ruby
17
RackEnv "development"
18
</pre>
19 22 Tom Clegg
20
Install some prerequisites for gems.
21
22
 sudo apt-get install libxslt-dev libxml2-dev
23 1 Tom Clegg
24 21 Tom Clegg
Check out git repo from git@git.clinicalfuture.com:tapestry.git to somewhere -- say, /var/www/tapestry.example.org
25 1 Tom Clegg
26 12 Ward Vandewege
Then execute:
27 1 Tom Clegg
28 12 Ward Vandewege
 sudo bundle install
29
30 3 Tom Clegg
Point a virtualhost to the @public@ dir in your git repo
31 2 Tom Clegg
32 1 Tom Clegg
<pre>
33
<VirtualHost *:80>
34 21 Tom Clegg
   ServerName tapestry.example.org
35
   DocumentRoot /var/www/tapestry.example.org/public
36
   <Directory /var/www/tapestry.example.org/public>
37 1 Tom Clegg
         AllowOverride all
38
         Options -MultiViews
39
   </Directory>
40 26 Tom Clegg
   Alias /warehouse /warehouse
41
   <Directory /warehouse>
42
         Options None
43
         AllowOverride None
44
         Order allow,deny
45
         allow from all
46
   </Directory>
47 1 Tom Clegg
</VirtualHost>
48
</pre>
49 4 Tom Clegg
50 14 Tom Clegg
Copy @config/database.example@ to @config/database.yml@ and edit to suit. Make sure to select mysql as the database server.  Generate a password using @pwgen 12 1@ or @head -c12345 /dev/urandom|md5sum|head -c12;echo@.  For example:
51 1 Tom Clegg
52 14 Tom Clegg
 development:
53
  adapter: mysql
54
  server: localhost
55 15 Tom Clegg
  database: mypg
56
  username: mypg
57 14 Tom Clegg
  password: c16fbe415d29
58
  timeout: 5000
59
60 18 Madeleine Ball
Copy @config/environments/development.rb.sample@ to @config/environments/development.rb@ and edit to suit.  In particular the ROOT_URL (you may skip the "http://" prefix):
61 16 Tom Clegg
62 18 Madeleine Ball
 ROOT_URL = 'your.vhost.name'
63 14 Tom Clegg
64
Set up the database:
65 1 Tom Clegg
66
 rake db:setup
67 19 Madeleine Ball
rake db:schema:load
68 18 Madeleine Ball
69 1 Tom Clegg
Set up data directory (replace USERNAME with the user who owns the GIT directory this code is in, and ROOT_URL matching the one above):
70 19 Madeleine Ball
71 18 Madeleine Ball
 sudo mkdir -p /data/ROOT_URL
72 19 Madeleine Ball
sudo chown -R USERNAME:USERNAME /data/ROOT_URL
73 1 Tom Clegg
74
After you do a git pull, you'll probably want to do
75 8 Tom Clegg
76 10 Ward Vandewege
  rake db:migrate
77
78
to bring your database up to the latest release.
79 12 Ward Vandewege
80
If the Gemfile has changed, you will also have to run
81
82
  sudo bundle install
83 25 Tom Clegg
84
Set up cron jobs -- for example, @/etc/cron.d/tapestry-get-blog-feed@
85
86
 PATH=/usr/local/bin:/usr/bin:/bin
87
0 * * * * www-data cd /var/www/my-dev.personalgenomes.org/current/script && ./get-blog-feed.rb development http://blog.personalgenomes.org/feed/
88 26 Tom Clegg
89
To enable large uploads with warehouse storage:
90
91
* @sudo apt-get install runit fuse-utils@
92
* @sudo mkdir -p /etc/service/whmount/log/main@
93
* Set up supervised whmount service:
94
95
<pre>
96
sudo tee /etc/service/whmount/run <<EOF >/dev/null
97
#!/bin/sh
98
modprobe fuse
99
mkdir -p /warehouse
100
chown www-data:www-data /warehouse
101
sudo -u www-data fusermount -u /warehouse
102
exec sudo -u www-data whmount --no-detach / /warehouse
103
EOF
104
sudo tee /etc/service/whmount/log/run <<EOF >/dev/null
105
#!/bin/sh
106
exec svlogd -tt main
107
EOF
108
</pre>
109
110
* Make sure config/environments/development.rb matches your Apache and filesystem mount points:
111
112
<pre>
113
  WAREHOUSE_WEB_ROOT = "/warehouse" # Apache alias pointing to whmount target
114
  WAREHOUSE_FS_ROOT = "/warehouse" # whmount target
115
</pre>