15 | | |
16 | | == Difficulties |
17 | | |
18 | | This installations is made more difficult by 3 things: |
19 | | |
20 | | 1. Suse Linux does not have mod_wsgi in its repositories, so you're going to have to compile it. |
21 | | 2. mod_wsgi seems picky about where it picks python apps and libraries from |
22 | | 3. The LAMP servers don't put things where you'd expect them to be. |
23 | | 4. Some other stuff that I don't quite understand |
24 | | |
25 | | == Start Services |
26 | | |
27 | | Start the Apache and MySQL and make sure that they are restarted when the server is rebooted. |
28 | | |
29 | | {{{ |
30 | | sudo /sbin/chkconfig uol.apache2 on |
31 | | sudo /etc/init.d/uol.apache2 start |
32 | | sudo /sbin/chkconfig uol.mysql on |
33 | | sudo /etc/init.d/uol.mysql start |
34 | | }}} |
35 | | |
36 | | == Proceduce |
37 | | |
38 | | 1. [[HowTo Compile mod_wsgi for LAMP servers]] |
39 | | 2. Copy the Telomere application from the `git` repository into `/local/` directory. |
40 | | 3. Install virtualenv: |
41 | | |
42 | | {{{ |
43 | | easy_install --install-dir=/local/python virtualenv |
44 | | }}} |
45 | | |
46 | | ''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.'' |
47 | | 4. Create a virtual environment in the telomere application directory. |
48 | | |
49 | | {{{ |
50 | | cd /local/telomere |
51 | | /local/python/virtualenv --no-site-packages BASELINE |
52 | | }}} |
53 | | |
54 | | ''`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`.'' |
55 | | |
56 | | 5. Activate the environment, install the required packages, then deactivate: |
57 | | |
58 | | {{{ |
59 | | source BASELINE/bin/activate |
60 | | easy_install flask |
61 | | easy_install flask-sqlalchemy |
62 | | easy_install mysql-python |
63 | | easy_install flask-login |
64 | | easy_install python-ldap |
65 | | easy_install flask-wtf |
66 | | easy_install WTForms-Components |
67 | | easy_install openpyxl |
68 | | deactivate |
69 | | }}} |
70 | | |
71 | | 6. Load the WSGI module into Apache, by editing the file `/local/apache2/etc/loadmodule.conf` by adding this line at the end. |
72 | | |
73 | | {{{ |
74 | | LoadModule wsgi_module /local/apache2/etc/mod_wsgi.so |
75 | | }}} |
76 | | |
77 | | ''This presumes that you've copied the compiled `mod_wsgi.so` file into the `/local/apache2/etc/` directory.'' |
78 | | |
79 | | 7. Add the WSGI config to the Apache config file `/local/apache2/etc/httpd.conf`: |
80 | | |
81 | | {{{ |
82 | | <Directory /local/telomere> |
83 | | WSGIProcessGroup telomere |
84 | | WSGIApplicationGroup %{GLOBAL} |
85 | | Order deny,allow |
86 | | Allow from all |
87 | | </Directory> |
88 | | |
89 | | WSGIDaemonProcess telomere user=wwwrun threads=5 python-path=/local/telomere/BASELINE/lib/python2.6/site-packages:/local/python:/usr/lib64/python2.6/site-packages:/usr/share/doc/packages/ home=/local/telomere/ |
90 | | WSGIScriptAlias / /local/telomere/app/telomere.wsgi |
91 | | }}} |
92 | | |
93 | | ''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.'' |
94 | | |
95 | | 8. Restart apache: |
96 | | |
97 | | {{{ |
98 | | sudo /etc/init.d/uol.apache2 restart |
99 | | }}} |
100 | | |
101 | | 9. Pray. |
102 | | |
103 | | == Other Possible Stuff |
104 | | |
105 | | 1. You may need to give `wwwrun` extra permissions to the `/local/telomere` directory. |
106 | | 2. You might need to pray a bit more. |