Project

General

Profile

Installing the Tapestry application » History » Version 28

Tom Clegg, 09/25/2012 10:12 AM

1 20 Tom Clegg
h1. Installing the Tapestry application
2 1 Tom Clegg
3 27 Ward Vandewege
The recommended ruby stack for Tapestry is Ruby Enterprise Edition (1.8.7), installed via rvm.
4
5
Install rvm:
6
7
  curl -L https://get.rvm.io | sudo bash -s stable
8
9
Install ree 1.8.7
10
11
  sudo rvm install ree
12 1 Tom Clegg
13 22 Tom Clegg
Install rails.
14 1 Tom Clegg
15 22 Tom Clegg
 sudo gem install rails
16 1 Tom Clegg
sudo gem install passenger
17
sudo /usr/local/bin/passenger-install-apache2-module
18
19
Add stuff (as provided by passenger-install) to your conf.d/passenger.conf
20
21
<pre>
22 23 Tom Clegg
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
23
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
24 1 Tom Clegg
PassengerRuby /usr/local/bin/ruby
25
RackEnv "development"
26
</pre>
27 22 Tom Clegg
28
Install some prerequisites for gems.
29
30
 sudo apt-get install libxslt-dev libxml2-dev
31 1 Tom Clegg
32 28 Tom Clegg
Get a copy of the source tree -- e.g., in /var/www/tapestry
33 1 Tom Clegg
34 28 Tom Clegg
<pre>
35
cd /var/www
36
sudo chmod a+w,+t .
37
git clone git://git.clinicalfuture.com/tapestry.git
38
sudo chmod go-w,-t .
39
cd tapestry && git submodule init && git submodule update
40
</pre>
41
42 12 Ward Vandewege
Then execute:
43
44 3 Tom Clegg
 sudo bundle install
45 2 Tom Clegg
46 1 Tom Clegg
Point a virtualhost to the @public@ dir in your git repo
47
48
<pre>
49
<VirtualHost *:80>
50 21 Tom Clegg
   ServerName tapestry.example.org
51 28 Tom Clegg
   DocumentRoot /var/www/tapestry/public
52
   <Directory /var/www/tapestry/public>
53 1 Tom Clegg
         AllowOverride all
54
         Options -MultiViews
55
   </Directory>
56 26 Tom Clegg
   Alias /warehouse /warehouse
57
   <Directory /warehouse>
58
         Options None
59
         AllowOverride None
60
         Order allow,deny
61
         allow from all
62
   </Directory>
63 1 Tom Clegg
</VirtualHost>
64
</pre>
65 4 Tom Clegg
66 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:
67 1 Tom Clegg
68 14 Tom Clegg
 development:
69
  adapter: mysql
70
  server: localhost
71 15 Tom Clegg
  database: mypg
72
  username: mypg
73 14 Tom Clegg
  password: c16fbe415d29
74
  timeout: 5000
75
76 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):
77 16 Tom Clegg
78 18 Madeleine Ball
 ROOT_URL = 'your.vhost.name'
79 14 Tom Clegg
80
Set up the database:
81 1 Tom Clegg
82
 rake db:setup
83 19 Madeleine Ball
rake db:schema:load
84 18 Madeleine Ball
85 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):
86 19 Madeleine Ball
87 18 Madeleine Ball
 sudo mkdir -p /data/ROOT_URL
88 19 Madeleine Ball
sudo chown -R USERNAME:USERNAME /data/ROOT_URL
89 1 Tom Clegg
90
After you do a git pull, you'll probably want to do
91 8 Tom Clegg
92 10 Ward Vandewege
  rake db:migrate
93
94 12 Ward Vandewege
to bring your database up to the latest release.
95
96
If the Gemfile has changed, you will also have to run
97
98 25 Tom Clegg
  sudo bundle install
99 1 Tom Clegg
100 25 Tom Clegg
Set up cron jobs -- for example, @/etc/cron.d/tapestry-get-blog-feed@
101
102
 PATH=/usr/local/bin:/usr/bin:/bin
103 28 Tom Clegg
0 * * * * www-data cd /var/www/tapestry/current/script && ./get-blog-feed.rb development http://blog.personalgenomes.org/feed/
104 26 Tom Clegg
105
To enable large uploads with warehouse storage:
106
107
* @sudo apt-get install runit fuse-utils@
108
* @sudo mkdir -p /etc/service/whmount/log/main@
109
* Set up supervised whmount service:
110
111
<pre>
112
sudo tee /etc/service/whmount/run <<EOF >/dev/null
113
#!/bin/sh
114
modprobe fuse
115
mkdir -p /warehouse
116
chown www-data:www-data /warehouse
117
sudo -u www-data fusermount -u /warehouse
118
exec sudo -u www-data whmount --no-detach / /warehouse
119
EOF
120
sudo tee /etc/service/whmount/log/run <<EOF >/dev/null
121
#!/bin/sh
122
exec svlogd -tt main
123
EOF
124
</pre>
125
126
* Make sure config/environments/development.rb matches your Apache and filesystem mount points:
127
128
<pre>
129
  WAREHOUSE_WEB_ROOT = "/warehouse" # Apache alias pointing to whmount target
130
  WAREHOUSE_FS_ROOT = "/warehouse" # whmount target
131
</pre>