5 | | == Requirements |
6 | | |
7 | | Before installation can start, the following packages will have to be installed by IT services: |
8 | | |
9 | | - libmysqlclient-dev |
10 | | - python-dev |
11 | | |
12 | | == Difficulties |
13 | | |
14 | | This installations is made more difficult by 3 things: |
15 | | |
16 | | 1. Suse Linux does not have mod_wsgi in its repositories, so you're going to have to compile it. |
17 | | 2. mod_wsgi seems picky about where it picks python apps and libraries from |
18 | | 3. The LAMP servers don't put things where you'd expect them to be. |
19 | | 4. Some other stuff that I don't quite understand |
| 5 | Follow the instructions in [[UoL LAMP HowTo Install Python Flask Applications]]. |
22 | | == Start Services |
23 | | |
24 | | Start the Apache and MySQL and make sure that they are restarted when the server is rebooted. |
25 | | |
26 | | {{{ |
27 | | sudo /sbin/chkconfig uol.apache2 on |
28 | | sudo /etc/init.d/uol.apache2 start |
29 | | sudo /sbin/chkconfig uol.mysql on |
30 | | sudo /etc/init.d/uol.mysql start |
31 | | }}} |
32 | | |
33 | | == Proceduce |
34 | | |
35 | | 1. [[HowTo Compile mod_wsgi for LAMP servers]] |
36 | | - For this install I actually just copied the mod_wsgi.so from the [[Telomere Length Recording Application Instance Live]] |
37 | | 2. Copy the Telomere application from the `git` repository into `/local/` directory. |
38 | | 3. Install virtualenv: |
39 | | |
40 | | {{{ |
41 | | easy_install --install-dir=/local/python virtualenv |
42 | | }}} |
43 | | |
44 | | ''For some reason that I can't work out (point 4. above), it would only pick up some of the python libraries from a virtual env and not when they were installed in `/local/python/`. Maybe this was because of the order that I installed things, but I couldn't get it to work without the virtual environment.'' |
45 | | 4. Create a virtual environment in the application directory. |
46 | | |
47 | | {{{ |
48 | | cd /local/lcbru-events |
49 | | /local/python/virtualenv --no-site-packages BASELINE |
50 | | }}} |
51 | | |
52 | | ''`BASELINE` is the name of the virtual environment. It could be called anything, but it's called that! Also note that you need to use the full path to the `virtualenv` utility, since `/local/python` isn't in `$PATH`.'' |
53 | | |
54 | | 5. Activate the environment, install the required packages, then deactivate: |
55 | | |
56 | | {{{ |
57 | | source BASELINE/bin/activate |
58 | | easy_install flask |
59 | | easy_install flask-sqlalchemy |
60 | | easy_install mysql-python |
61 | | easy_install flask-wtf |
62 | | easy_install WTForms-Components |
63 | | deactivate |
64 | | }}} |
65 | | |
66 | | 6. Load the WSGI module into Apache, by editing the file `/local/apache2/etc/loadmodule.conf` by adding this line at the end. |
67 | | |
68 | | {{{ |
69 | | LoadModule wsgi_module /local/apache2/etc/mod_wsgi.so |
70 | | }}} |
71 | | |
72 | | ''This presumes that you've copied the compiled `mod_wsgi.so` file into the `/local/apache2/etc/` directory.'' |
73 | | |
74 | | 7. Add the WSGI config to the Apache config file `/local/apache2/etc/httpd.conf`: |
75 | | |
76 | | {{{ |
77 | | <Directory /local/lcbru-events> |
78 | | WSGIProcessGroup lcbru-events |
79 | | WSGIApplicationGroup %{GLOBAL} |
80 | | Order deny,allow |
81 | | Allow from all |
82 | | </Directory> |
83 | | |
84 | | WSGIDaemonProcess lcbru-events user=wwwrun threads=5 python-path=/local/lcbru-events/BASELINE/lib/python2.6/site-packages:/local/python:/usr/lib64/python2.6/site-packages:/usr/share/doc/packages/ home=/local/lcbru-events/ |
85 | | WSGIScriptAlias / /local/lcbru-events/lcbru_events/app.wsgi |
86 | | }}} |
87 | | |
88 | | ''The two hard won things here are the values for the `python-path` and `home` arguments. The `python-path` must contain every directory where python libraries are installed, including a sub-directory of the virtualenv directory you created earlier. The `home` must point to your application directory, or you won't be able to pick up your own modules.'' |
89 | | |
90 | | 8. Restart apache: |
91 | | |
92 | | {{{ |
93 | | sudo /etc/init.d/uol.apache2 restart |
94 | | }}} |
95 | | |
96 | | 9. Pray. |
97 | | |
98 | | == Other Possible Stuff (Not done Yet) |
99 | | |
100 | | 1. You may need to give `wwwrun` extra permissions to the `/local/lcbru-events` directory. |
101 | | 2. You might need to pray a bit more. |
102 | | |
103 | | {{{ |
104 | | setfacl -m u:wwwrun:rwx /local/lcbru-events/ |
105 | | setfacl -m d:u:wwwrun:rwx /local/lcbru-events/ |
106 | | }}} |
107 | | |