root/trunk/INSTALL

Revision 30, 12.7 kB (checked in by francois, 7 months ago)

updated Installation docs

Line 
1 = Installing Motilee =
2
3 Motilee is a regular symfony application. It requires only the files located under its own folder. Installing Motilee is quite straightforward if you already configured a symfony application before. If you don't know symfony, just follow this step-by-step tutorial and you should be done in a matter of minutes.
4
5 == Fast installation ==
6
7 Download the motilee tarball from [http://www.motilee.com/motilee.tgz]. Unpack it under your web root. Then browse to:
8
9 {{{
10 http://localhost/motilee/frontend_dev.php
11 }}}
12    
13 You can test the application by browsing and searching the forums (populated with test data), creating a new user, adding a new message in a topic or creating a new topic in a forum. Eventually, don't forget to take a look at the administration interface by logging in as admin/admin.
14
15 == Installation requirements ==
16
17 Motilee is a PHP5 forum relying on the symfony framework. The framework files are bundled with the application, so you don't need to install symfony before installing Motilee. However, you will definitely need a server capable of running PHP5 scripts, preferably Apache with `mod_php`. Recommended PHP version is 5.2.3.
18
19 As for the database, Motilee comes with a bundled SQLite databae, but can run on MySQL, SQLServer, PostgreSQL, and Oracle.
20
21 Eventually, Motilee is system agnostic, so it will run on *nix systems a well as on Windows systems.
22
23 == Reminder on symfony deployment ==
24
25 Motilee doesn't come with a graphical user interface for installation, because you should not let your server change files that are not under the public web root. Only the files located under the `motilee/web/` directory should be directly accessible from the web.
26
27 This means that an installation of Motilee requires in two steps:
28
29  - Unpack, configure and test Motilee on a local server, for instance on your very desktop computer. You should have access to a command line on this server, especially if you want to run the application on MySQL. The server configuration should be as similar as possible to the production one.
30
31  - When the application runs locally, transfer the files to production, either via (S)FTP, or via the preferred rsync-over-ftp method recommended by symfony.
32
33 This is the same as for all symfony applications. If you want to learn more about symfony, and good practices of web applications deployment, refer to the [http://www.symfony-project.org/book/1_0/03-Running-Symfony symfony book].
34
35 == Downloading the application ==
36
37 Motilee comes in two flavors:
38
39  - A preconfigured tarball, bundled with a SQLite database populated with test data. Download it at [http://www.motilee.com/motilee.tgz]. This version is completely customizable, ready to run out of the bix, but you may find it difficult to update it.
40  
41  - A checkout from the motilee SVN repository, located at [http://svn.motilee.com/trunk]. This version is easier to upgrade, but requires an extra installation step. Once you have all the files downloaded to a directory, open a terminal, browse to the motilee directory, then build the object model with the symfony command line, and load the test data. If you are not familiar with the symfony commands, you just need to copy the following commands:
42
43 {{{
44 $ cd /path/to/motilee
45 $ php symfony propel-build-all
46 $ php symfony clear-cache
47 $ php symfony propel-load-data frontend
48 }}}
49
50 == Web server configuration ==
51
52 The configuration of the web server may differ between the local server and the production server. Three methods are proposed here, choose the one that best fits your needs and constraints.
53
54 === Zero configuration ===
55
56 This method requires no change in web server or database configuration. It should work out of the box on all systems and is a good way to test the application and see if it fits your needs. However, you should not use this method in production, as it gives access to scripts and data files that should remain hidden to the end user.
57
58 The installation is really straightforward: Move the motilee files under the web root folder of your web server. Of course, you can directly unpack the tarball or do the repository checkout there.
59
60 You should end up with a file structure similar to:
61
62 {{{
63 Apache/
64   www/
65     motilee/
66       apps/
67       batch/
68       cache/
69       config/
70       data/
71       doc/
72       lib/
73       log/
74       plugins/
75       test/
76       web/
77         sf/
78         index.php
79         frontend_dev.php
80         ...
81 }}}
82
83 That's all. Now test motilee by browsing to:
84
85 {{{
86 http://localhost/motilee/web/frontend_dev.php
87 }}}
88
89 === Custom web root ===
90
91 A better way to install motilee is to put the content of the motilee/web/ folder under your web root, and the rest under another directory outside of the web root. Let's assume that your host offers you two directories for your applications:
92
93 {{{
94 my_site/
95   cgi-bin/
96   www/
97 }}}
98
99 Unpack (or transfer by ftp) all directories but the `web/` one under `cgi-bin`, and unpack (or transfer) the files of the `web/` directory under `www/`. You should end up with a file structure similar to:
100
101 {{{
102 my_site/
103   cgi-bin/
104     apps/
105     batch/
106     cache/
107     config/
108     data/
109     doc/
110     lib/
111     log/
112     plugins/
113     test/
114   www/
115     sf/
116     index.php
117     frontend_dev.php
118     ...
119 }}}
120
121 Edit both the `index.php` and the `frontend_dev.php` files and change the third line to:
122
123 {{{
124 define('SF_ROOT_DIR',    realpath(dirname(__FILE__).'/../cgi-bin'));
125 }}}
126
127 Then, you need to change the motilee web root configuration by editing the file called `cgi-bin/apps/frontend/config/config.php`. You should ad the following lines at the end of the file:
128
129 {{{
130 $sf_root_dir = sfConfig::get('sf_root_dir');
131 sfConfig::add(array(
132   'sf_web_dir_name' => $sf_web_dir_name = 'www',
133   'sf_web_dir'      => $sf_root_dir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$sf_web_dir_name,
134   'sf_upload_dir'   => $sf_root_dir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$sf_web_dir_name.DIRECTORY_SEPARATOR.sfConfig::get('sf_upload_dir_name'),
135 ));
136 }}}
137
138 Check that the installation went fine by browsing to:
139
140 {{{
141 http://www.mysite.com/frontend_dev.php
142 }}}
143
144 === Virtual Host ===
145
146 Create a new virtual host to be able to access the forum application. To do so, open your Apache configuration's `httpd.conf` and add the following lines at the end:
147
148 {{{
149 <VirtualHost *:80>
150   ServerName motilee.mysite.com
151   DocumentRoot "/path/to/motilee/web"
152   DirectoryIndex index.php
153   <Directory "/path/to/motilee/web" >
154     AllowOverride All
155     Allow from All
156   </Directory>
157 </VirtualHost>
158 }}}
159
160 Replace `motilee.mysite.com` by the URL you want to give to the forum application, and `/path/to/motilee/` by the absolute path to the `motilee` directory in your system. After saving the file, you should restard Apache and check that the installation went fine by browsing to:
161
162 {{{
163 http://motilee.mysite.com/frontend_dev.php
164 }}}
165
166 === Troubleshooting ===
167
168 If you can't see the welcome screen, start by clearing the cache. To do so, type the following command from the root of the motilee directory:
169
170 {{{
171 $ php symfony clear-cache
172 }}}
173
174 Try to reach the test page at `http://motilee.mysite.com/default/index`. If the problem persists, switch to the development environment to see explicit error messages by browsing to:
175
176 {{{
177 http://motilee.mysite.com/frontend_dev.php
178 }}}
179
180 Depending on your host, you may also have to edit the rewriting rules located in `web/.htaccess`. Here is the default file:
181
182 {{{
183 Options +FollowSymLinks +ExecCGI
184
185 <IfModule mod_rewrite.c>
186   RewriteEngine On
187
188   # uncomment the following line, if you are having trouble
189   # getting no_script_name to work
190   #RewriteBase /
191
192   # we skip all files with .something
193   RewriteCond %{REQUEST_URI} \..+$
194   RewriteCond %{REQUEST_URI} !\.html$
195   RewriteRule .* - [L]
196
197   # we check if the .html version is here (caching)
198   RewriteRule ^$ index.html [QSA]
199   RewriteRule ^([^.]+)$ $1.html [QSA]
200   RewriteCond %{REQUEST_FILENAME} !-f
201
202   # no, so we redirect to our front web controller
203   RewriteRule ^(.*)$ index.php [QSA,L]
204 </IfModule>
205
206 # big crash from our front web controller
207 ErrorDocument 500 "<h2>Application error</h2>symfony application failed to start properly"
208 }}}
209        
210 If you still can't manage to setup the application correctly, refer to the [http://www.symfony-project.org/book/1_0/03-Running-Symfony#Troubleshooting symfony documentation] or find help in the [http://www.symfony-project.org/forum/index.php/f/6/ symfony forum].
211
212 == Database configuration ==
213
214 By default, Motilee runs a SQLite database located under `motilee/data/sandbox.db`. If your forum has a relatively low activity or if you don't want to setup a database, you can just keep the configuration as it is and upload the `sandbox.db` with the rest of the files. The application will run smoothly without further configuration.
215
216 If you want tu use another database vendor, you will need to create the database first, then edit two files located in `motilee/config/`.
217
218 To create your database, use either your database command line or any client interface it comes with. For instance, if you want to use MySQL, you can type:
219
220 {{{
221 $ mysqladmin -uroot -p create motilee
222 }}}
223
224 Change `motilee` to whatever name you want to give to your database.
225
226 The first configuration file to change is `propel.ini`. Symfony uses this file to determine the database connection when called via the Command Lne Interface (CLI). It will help you define a database structure in a list of SQL statements adapted to your database vendor. For instance, if you want to use the MySQL database just created:
227
228 {{{
229 // In motilee/config/propel.ini
230 // Modify lines 5 to 7 as follows
231 propel.database            = mysql
232 propel.database.createUrl  = mysql://login:passwd@localhost/
233 propel.database.url        = mysql://login:passwd@localhost/motilee
234 }}}
235
236 The Database Source Name (DSN) shown here follows PEAR-style DSN string conventions, as explained in the [http://creole.phpdb.org/trac/wiki/Documentation/CreoleGuide Creole guide]. The database vendor can be any of `mysql`, `sqlserver`, `pgsql`, `sqlite` and `oracle`.
237
238 Use the symfony command line to generate the SQL code necessary to create the tables.
239
240 {{{
241 $ php symfony propel-build-sql
242 }}}
243
244 The generated SQL code lies under `motilee/data/sql/`. It consists of several `.sql` files that you can either open and execute one by one (through the database command line or via a PHPMyAdmin interface), or inject all at once to your database by using the symfony command line:
245
246 {{{
247 $ php symfony propel-insert-sql
248 }}}
249
250 This will create all the tables necessary to handle the forum topics, posts, views, etc.
251
252 The second file that must be edited if you don't use SQLite is the `databases.yml`. Symfony uses this file to determine the database connection at runtime. It must point to the same database DSN as the one defined in the `propel.ini`.
253
254 {{{
255 // In motilee/config/databases.yml
256 // Modify lines 11 and 12 as follows
257 all:
258   propel:
259     class:      sfPropelDatabase
260     param:
261       phptype:  mysql
262       database: mysql://login:passwd@localhost/motilee
263 }}}
264
265 To test this setting, you can load the test data into the database by calling the symfony command line:
266
267 {{{
268 $ php symfony propel-load-data frontend
269 }}}
270
271 For more information on database connection settings, you can refer to the [http://www.symfony-project.org/book/1_0/08-Inside-the-Model-Layer#Database%20Connections symfony model documentation].
272
273 == Managing users, forums and categories ==
274
275 To define categories and settings, go to the administration interface at the URL:
276
277 {{{
278 http://motilee.mysite.com/forumAdmin
279 }}}
280
281 You will be requested to log in. The default administrator login and password are admin/admin. You can use the administration interface to change the default administrator login (and you should).
282
283 == Forum configuration ==
284
285 To start configuring the forum, copy the sample application configuration file `motilee/apps/frontend/config/app.yml.sample` to `motilee/apps/frontend/config/app.yml`. You can then modify this new file at will. The default configuration is reproduced below:
286
287 {{{
288   all:
289     sfSimpleForumPlugin:
290       forum_name:             Motilee forums
291       display_categories:     true
292       use_feeds:              true  # requires sfFeed2Plugin
293       count_views:            true  # count each time a topic is viewed. Turn off to increase performance
294       max_per_block:          10    # maximum number of links displayed in a block
295       include_breadcrumb:     true  # include breadcrumb slot content. Turn off if you don't use the breadcrumb.
296       breadcrumb_separator:   ' ยป ' # separator for breadcrumb trail
297       max_per_page:           10    # maximum threads or messages per page
298       pages_displayed:        5     # maximum pages displayed by the pager navigation
299       feed_max:               10    # maximum messages served by feed
300       show_author_details:    false # display number of messages of post authors
301       allow_new_topic_outside_forum: true
302
303     sfModerationPlugin:
304       auto_register_behavior: false
305 }}}
Note: See TracBrowser for help on using the browser.