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