= Telomere Length Recording Application HowTo Install Tags: [[Telomere Length Recording Application]] [[HowTo]] [[Install]] [[Pain in the proverbial]] [[UoL LAMP Server]] == Requirements Before installation can start, the following packages will have to be installed by IT services: - libmysqlclient-dev - python-dev - libldap2-dev - libsasl2-dev == Difficulties This installations is made more difficult by 3 things: 1. Suse Linux does not have mod_wsgi in its repositories, so you're going to have to compile it. 2. mod_wsgi seems picky about where it picks python apps and libraries from 3. The LAMP servers don't put things where you'd expect them to be. 4. Some other stuff that I don't quite understand == Start Services Start the Apache and MySQL and make sure that they are restarted when the server is rebooted. {{{ sudo /sbin/chkconfig uol.apache2 on sudo /etc/init.d/uol.apache2 start sudo /sbin/chkconfig uol.mysql on sudo /etc/init.d/uol.mysql start }}} == Proceduce 1. [[HowTo Compile mod_wsgi for LAMP servers]] 2. Copy the Telomere application from the `git` repository into `/local/` directory. 3. Install virtualenv: {{{ easy_install --install-dir=/local/python virtualenv }}} ''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.'' 4. Create a virtual environment in the telomere application directory. {{{ cd /local/telomere /local/python/virtualenv --no-site-packages BASELINE }}} ''`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`.'' 5. Activate the environment, install the required packages, then deactivate: {{{ source BASELINE/bin/activate easy_install flask easy_install flask-sqlalchemy easy_install mysql-python easy_install flask-login easy_install python-ldap easy_install flask-wtf easy_install WTForms-Components easy_install openpyxl deactivate }}} 6. Load the WSGI module into Apache, by editing the file `/local/apache2/etc/loadmodule.conf` by adding this line at the end. {{{ LoadModule wsgi_module /local/apache2/etc/mod_wsgi.so }}} ''This presumes that you've copied the compiled `mod_wsgi.so` file into the `/local/apache2/etc/` directory.'' 7. Add the WSGI config to the Apache config file `/local/apache2/etc/httpd.conf`: {{{ WSGIProcessGroup telomere WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all 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/ WSGIScriptAlias / /local/telomere/app/telomere.wsgi }}} ''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.'' 8. Restart apache: {{{ sudo /etc/init.d/uol.apache2 restart }}} 9. Pray. == Other Possible Stuff 1. You may need to give `wwwrun` extra permissions to the `/local/telomere` directory. 2. You might need to pray a bit more. == Permission to Upload Directory 1. In order to upload spreadsheets, you need to create an upload directory, for example `/local/telomere/uploads`. 2. You then need to point to this in the settings.py file `SPREADSHEET_UPLOAD_DIRECTORY = '/local/telomere/uploads'` 3. Finally, you need to give `wwwrun` permission to read and write to the directory. {{{ setfacl -m u:wwwrun:rwx /local/telomere/uploads/ setfacl -m d:u:wwwrun:rwx /local/telomere/uploads/ }}} [[BackLinks]]