Deploying Mayan-EDMS in a Sub-URI

234 views
Skip to first unread message

Christoph H. Larsen

unread,
Sep 29, 2014, 1:32:59 PM9/29/14
to mayan...@googlegroups.com
Dear Crowd,

Due to some pesky restrictions out of my control, I have to make do with a domain [f.q.d.n] that does not allow any sub-domain to be added, nor managed.
I have an up-to-date FreeBSD setup, with Mayan-EDMS running happily in my python web applications jail, inside virtualenv, married it with gunicorn, set up Nginx in a different jail, as well as OpenLDAP and PostgreSQL, all in different jail shoe boxes.
I have, in order to get the sub-URI trick going, added the following into my local.settings.py:
---------------------------------------%< -----------------------------------
# Define the SCRIPT_NAME header variable for WSGI deployment
#FORCE_SCRIPT_NAME=''
FORCE_SCRIPT_NAME
= '/[instance_name]'

# Set the base path
#BASE_PATH = ''
BASE_PATH
= '/[instance_name]/'

# URL prefix for static files
#STATIC_URL = '/static'
STATIC_URL
= BASE_PATH + 'static/'

# URL prefix for media files
MEDIA_URL
= STATIC_URL + 'media/'

# The numeric mode to set newly-uploaded files to
#FILE_UPLOAD_PERMISSIONS = 0644
FILE_UPLOAD_PERMISSIONS
= 0640
--------------------------------------->% -----------------------------------
I have configured Nginx accordingly, basically prefixed all locations with /[instance_name].

All seemed well, except an (unrelated?) issue with GraphicsMagick, see here: https://groups.google.com/forum/#!topic/mayan-edms/FdFAL2pnCt4.

However, I run into troubles as soon as I get into page details: The document details page, e.g. https://[f.q.d.n]/[instance_name]/documents/17/view/ turns up alright, and I can go to the page details, displayed via an Ajax window: https://[f.q.d.n]/[instance_name]/documents/page/141/. As soon as I either do any transformation other than reset (zooming in or out, rotation left or right), or click any of the navigation button under "Related actions" on the right panel, I get a "Page not found" error, and the log says:
29/Sep/2014 19:05:47] "GET /api/v0/documents/documents/17/image/?size=1200&rotation=0&version=17&page=3&zoom=100 HTTP/1.0" 200 147004
WARNING
Not Found: /[instance_name]/documents/page/143/navigation/previous/
WARNING
Not Found: /[instance_name]/documents/page/143/navigation/previous/
[29/Sep/2014 19:05:51] "GET /documents/page/143/navigation/previous/ HTTP/1.0" 404 14880
I note that the GET command impolitely drops the sub-URI folder name [instance_name], while the WARNING message preserves the same very well.
This is strange, as all actions work well.
For completion, allow me to give you relevant snippets of my Nginx configuration, sitting in a different jail:
The [instance]-specific http configuration file:

# handle ${INSTANCE} at /${INSTANCE}"
location                        
/${INSTANCE}/ {"
    # redirect to https
    return                      301 https://$host$request_uri;
}
The [instance]-specific http+https configuration file:
# define the location of the static collection
location                        
/${INSTANCE}/static/ {
   
alias                       /home/${INSTANCE}/static/;
    proxy_cache                 $
{VIRTUAL_DOMAIN}_proxy_cache;
    expires                     $
{PROXY_CACHE_EXPIRY};
}
echo
'' >> /usr/local/etc/nginx/include/${VIRTUAL_DOMAIN}/http+https/default.conf
The [instance]-specific https configuration file:
#
# handle ${INSTANCE} and /${INSTANCE}
location                        
/${INSTANCE}/ {
    proxy_pass                  http
://www_py.jail.vlan:8004/;
}
No magic here... Just a bit of caution with the right tailing forward slashes (/).

Any idea what I did wrong, or is there any standard instruction how to deploy Mayan-EDMS in a sub-URI?
Thanks a million,

Chris

Christoph H. Larsen

unread,
Oct 2, 2014, 3:35:40 PM10/2/14
to mayan...@googlegroups.com
No solution in sight, it seems. I went through several hoops and loops, and eventually got a new sub-domain name. However, it would still be nice the be able to run Mayan-EDMS from a sub-URI... saving costs on certificates and such. Maybe a feature request? Or is there already a way to get there?
Thanks a lot,
Chris

Roberto Rosario

unread,
Oct 4, 2014, 12:02:55 AM10/4/14
to mayan...@googlegroups.com
At the time Mayan was started it did not supported sub URL installation mostly because of some Django pre 1.3 shortcommings (no lazy reverse, etc). Now that those features are in Django 1.6 and up there is ticket to start supporting this, issue #40:  https://github.com/mayan-edms/mayan-edms/issues/40 It is marked with the tag "Easy pickings", if you have some spare time pull requests are welcomed and will help get this ready feature for release.

PS: All tickets marked "Easy pickings" are intended to help new Mayan/Django developers participate in the project without requiring advanced knowledge of Mayan/Django.

--Roberto

Christoph H. Larsen

unread,
Oct 4, 2014, 4:36:15 AM10/4/14
to mayan...@googlegroups.com
Dear Roberto,
Thanks a lot for your reply. I hope the above settings, which "got me there" to aobut 80% may help.  Great idea with the "Easy Pickings", will have a look!
Chris

--

---
You received this message because you are subscribed to a topic in the Google Groups "Mayan EDMS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mayan-edms/9oPas8xWO-8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mayan-edms+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Christoph H. Larsen
synaLinQ
P.O. BOX 55, Buu dien Nha Trang
Nha Trang
Vietnam
E-mail: christop...@synalinq.com

Roberto Rosario

unread,
Oct 23, 2014, 2:52:52 AM10/23/14
to mayan...@googlegroups.com, christop...@synalinq.com
Issue #40 (https://github.com/mayan-edms/mayan-edms/issues/40) was completed, there are no more hard coded references to root path '/'. Please test.


On Saturday, October 4, 2014 4:36:15 AM UTC-4, Christoph H. Larsen wrote:
Dear Roberto,
Thanks a lot for your reply. I hope the above settings, which "got me there" to aobut 80% may help.  Great idea with the "Easy Pickings", will have a look!
Chris
To unsubscribe from this group and all its topics, send an email to mayan-edms+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages