[ckan-dev] mounting CKAN at a non-root URL

Hildegard Gerlach hildegard.gerlach at jrc.ec.europa.eu
Mon Aug 24 14:19:40 UTC 2015


Hello again,

did anybody get it to work ? Setting  ckan.site_url doesn't change 
anything in my case.

I changed these 2 files:

- Apache configuration file ckan.conf
     before:
         ProxyPass        / http://localhost:5000/ retry=1 acquire=3000 
timeout=600 Keepalive=On
         ProxyPassReverse / http://localhost:5000/
     after:
         ProxyPass        /ckan http://localhost:5000/ retry=1 
acquire=3000 timeout=600 Keepalive=On
         ProxyPassReverse /ckan http://localhost:5000/

- production.ini
     before:
         ckan.site_url = http://localhost/
     after:
         ckan.site_url = http://localhost/ckan/

I can access the site on /localhost/ckan, but nothing is found, not even 
the css

I would need to add this to my ckan.conf, but for everything (e.g. 
/about  etc)
ProxyPass /fanstatic/ http://localhost:5000/fanstatic/
ProxyPassReverse /fanstatic/ http://localhost:5000/fanstatic/

data-site-root never changes, it doesn't depend on what value for 
ckan.site_url I am setting. It is still like that
   <body data-site-root="http://localhost/" 
data-locale-root="http://localhost/" >

and also setting different values for  ckan.site_url  doesn't seem to 
make any difference.

Thanks

Hilde



On 8/17/2015 5:13 PM, Armin Retterath wrote:
> the solution maybe to define the proxy for https and http directly in 
> the ini file? or is this a problem of debian 8?
>
> i solved the issues by editing
> https://github.com/ckan/ckanext-geoview/blob/master/ckanext/geoview/controllers/service_proxy.py
> and
> https://github.com/ckan/ckan/blob/master/ckanext/resourceproxy/controller.py
> defining the 'proxies' variable and adding this variable to each call 
> to the requests function. but this is only a workaround i think ;-)
>
> best regards from germany
> armin
>
> 2015-08-17 14:45 GMT+02:00 Armin Retterath <armin.retterath at gmail.com 
> <mailto:armin.retterath at gmail.com>>:
>
>     hi nigel,
>
>     i deployed the system with the use of nginx - now the first
>     problem disapears, but the other problem occurs:
>     the service_proxy script don't care about the proxy which defined
>     in the /etc/environment :-( .
>     is there another option to set an env var in the application
>     (proxy and port?) with running paster the system proxy and port is
>     recognized !
>
>     http://opendata.geoportal.rlp.de/dataset/denkmaldaten-gdke/resource/aa71be28-0ff6-4454-8203-2f0683d1a158
>
>     thanx in advance
>
>     armin
>
>     2015-08-17 13:22 GMT+02:00 Armin Retterath
>     <armin.retterath at gmail.com <mailto:armin.retterath at gmail.com>>:
>
>         hi nigel,
>
>         i had the same problem as giuiliano and set the right
>         ckan.site_url - the problem is maybe the apache mod_proxy
>         (reverse proxy). i defined the mod_proxy on the localhost
>         server of ckan to serve ckan at port 80. on the reverse proxy
>         in the www, i did the same to publish my ckan installation.
>         the problem now is, that the 2 different mod_proxy make
>         trouble - they rewrite  urls, so that some links are false.
>         for example see: http://opendata.geoportal.rlp.de/dataset
>         in chromiums developer tools there is following error:
>
>         XMLHttpRequest cannot load
>         http://opendata.geoportal.rlp.de%2C%20opendata.geoportal.rlp.de/api/i18n/de
>         <http://20opendata.geoportal.rlp.de/api/i18n/de>. No
>         'Access-Control-Allow-Origin' header is present on the
>         requested resource. Origin 'http://opendata.geoportal.rlp.de'
>         is therefore not allowed access.
>         (cors list is configured in development.ini and the
>         application run without any errors on http://localhost:80/ !)
>
>         Firebug give none error!
>
>         maybe there is a possible option for mod_proxy not to rewrite
>         http://opendata.geoportal.rlp.de/api/i18n/de to
>         http://opendata.geoportal.rlp.de%2C%20opendata.geoportal.rlp.de/api/i18n/de
>         <http://20opendata.geoportal.rlp.de/api/i18n/de> - which is
>         urldecoded: http://opendata.geoportal.rlp.de,
>         opendata.geoportal.rlp.de/api/i18n/de
>         <http://opendata.geoportal.rlp.de/api/i18n/de> :-( .
>         another option maybe to allow the paster serve listening on
>         foreign ip's. default it only listen on localhost!
>         did someone know how to alter this behaviour?
>
>         thanx in advance,
>
>         armin
>
>
>         2015-08-15 5:20 GMT+02:00 Nigel Babu <nigel at nigelb.me
>         <mailto:nigel at nigelb.me>>:
>
>             To everyone on this thread, the problem you're all hitting
>             is the same. if you want your ckan site on
>             somedomain.com/ckan <http://somedomain.com/ckan>, you need
>             to set `site_url = http://somedomain.com/ckan`. Giuiliano,
>             I notice that your site_url isn't set correctly. If you
>             have set it correctly in the config, perhaps you need to
>             restart Apache for the setting to take effect.
>             --
>             nigelb
>             On Fri, Aug 14, 2015, at 08:33 PM, Hildegard Gerlach wrote:
>>             Hello,
>>             we also would like to run CKAN at a non-root URL. I think
>>             we have a similar configuration as Giuliano.
>>             We are using supervisord to run Ckan with the paster
>>             command, but I don't think this makes any difference to
>>             the problem.
>>             ---------------------------- extract of superisord.conf
>>             [program:ckan]
>>             command=/Ckan/ckan_home/ckan_env/bin/paster serve
>>             /Ckan/ckan_home/ckan_env/src/ckan/production.ini
>>             user=ckan
>>             ________________________________
>>             and ckan.conf
>>                     ProxyPass / http://localhost:5000/ retry=1
>>             acquire=3000 timeout=600 Keepalive=On
>>                     ProxyPassReverse / http://localhost:5000/
>>             I tried what has been described in this thread, but I
>>             didn't succeed to get it working as it should.
>>             It is also not clear to me where data-site-root can be
>>             configured. Changing it in base.html doesn't work.
>>             Would it be possible to get a documentation how to
>>             install (or move) Ckan on a non-root URL ? It would be
>>             appreciated.
>>             Thanx in advance
>>             Hilde
>>             On 8/14/2015 11:08 AM, Armin Retterath wrote:
>>>             hello together,
>>>             i now got another subdomain:
>>>             opendata.geoportal.rlp.de <http://opendata.geoportal.rlp.de>
>>>             but the viewers are not shown any longer?????
>>>             on the real server the viewer are shown without any
>>>             problems.
>>>             on 127.0.0.1 apache proxy_http get port 5000 to 80 and
>>>             on the front server the same module is used to transfer
>>>             the requests so the ckan server ???
>>>             thanx in advance
>>>             armin
>>>             2015-08-14 9:40 GMT+02:00 Giuliano Veronese - Provincia
>>>             di Pordenone <veronese at provincia.pordenone.it
>>>             <mailto:veronese at provincia.pordenone.it>>:
>>>
>>>                 Hello Nigel,
>>>                 thank you for your answer.
>>>                 I can not link you the site because it is offline
>>>                 (virtual machine for experiments).
>>>                 This is the output you asked:
>>>                 {"Help": "Return a dictionary with information about
>>>                 the site's configuration.", "Success": true,
>>>                 "result": {"ckan_version": "2.1a", "site_url":
>>>                 "http: //catalog.data .gov "," site_description ":"
>>>                 "," SITE_TITLE ":" Data.gov "," error_emails_to ":"
>>>                 catalog-notification at googlegroups.com
>>>                 <mailto:catalog-notification at googlegroups.com> ","
>>>                 locale_default ":" en "," extensions ": ["
>>>                 geodatagov "," datagov_harvest ","
>>>                 geodatagov_geoportal_harvester "," z3950_harvester
>>>                 "," arcgis_harvester "," waf_harvester_collection
>>>                 "," geodatagov_csw_harvester ","
>>>                 geodatagov_doc_harvester ","
>>>                 geodatagov_waf_harvester "," spatial_metadata ","
>>>                 spatial_query "," resource_proxy ","
>>>                 spatial_harvest_metadata_api ", "recline_preview",
>>>                 "pdf_preview", "googleanalytics", "SAML2",
>>>                 "datajson", "datajson_harvest", "archiver", "qa",
>>>                 "ckan_harvester", "report", "broken_link_report",
>>>                 "datagovtheme", "extlink "]}}
>>>                 I send you the contents of ckan file
>>>                 (/etc/apache2/sites-availables/ckan):
>>>                 <VirtualHost *:80>
>>>                 ServerAdmin webmaster at localhost
>>>                 DocumentRoot /var/www
>>>                     ProxyPass   /geoserver
>>>                 http://localhost:8090/geoserver
>>>                 ProxyPassReverse /geoserver
>>>                 http://localhost:8090/geoserver
>>>                         ProxyPass       /mapstore
>>>                 http://localhost:8081/mapstore
>>>                 ProxyPassReverse /mapstore
>>>                 http://localhost:8081/mapstore
>>>                         ProxyPass       /mapstore
>>>                  ajp://localhost:8013/mapstore
>>>                 ProxyPassReverse /mapstore
>>>                  ajp://localhost:8013/mapstore
>>>                         ProxyPass       /geostore
>>>                  ajp://localhost:8013/geostore
>>>                 ProxyPassReverse /geostore
>>>                  ajp://localhost:8013/geostore
>>>                         ProxyPass       /http_proxy
>>>                 ajp://localhost:8013/http_proxy
>>>                 ProxyPassReverse /http_proxy
>>>                 ajp://localhost:8013/http_proxy
>>>                         ProxyPass       /geonetwork
>>>                 http://localhost:8082/geonetwork
>>>                 ProxyPassReverse /geonetwork
>>>                 http://localhost:8082/geonetwork
>>>                         ProxyPass       /ckan http://localhost:5000
>>>                 ProxyPassReverse /ckan http://localhost:5000
>>>                 <Directory />
>>>                 Options FollowSymLinks
>>>                 AllowOverride None
>>>                 </Directory>
>>>                     <Directory /var/www/>
>>>                 Options Indexes FollowSymLinks MultiViews
>>>                 AllowOverride None
>>>                 Order allow,deny
>>>                 allow from all
>>>                 </Directory>
>>>                 ### Abilitare FCGI
>>>                 http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
>>>                    # FcgidMaxRequestsPerProcess should be <=
>>>                 PHP_FCGI_MAX_REQUESTS
>>>                    # The example PHP wrapper script overrides the
>>>                 default PHP setting.
>>>                 FcgidMaxRequestsPerProcess 10000
>>>                    # Uncomment the following line if
>>>                 cgi.fix_pathinfo is set to 1 in
>>>                    # php.ini:
>>>                    # FcgidFixPathinfo 1
>>>                     Alias /phpapp/ /usr/local/phpapp/
>>>                   <Location /phpapp/>
>>>                     AddHandler fcgid-script .php
>>>                     Options +ExecCGI
>>>                     FcgidWrapper /usr/local/bin/php-wrapper .php
>>>                     # Customize the next two directives for your
>>>                 requirements. Configurata sopra
>>>                     # Order allow,deny
>>>                     # Allow from all
>>>                 </Location>
>>>                 ### fine inserimento FCGI
>>>                     ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>>>                 <Directory /usr/lib/cgi-bin>
>>>                 AllowOverride None
>>>                 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>>>                 Order allow,deny
>>>                 Allow from all
>>>                 </Directory>
>>>                         ErrorLog ${APACHE_LOG_DIR}/error.log
>>>                         # Possible values include: debug, info,
>>>                 notice, warn, error, crit,
>>>                         # alert, emerg.
>>>                         LogLevel warn
>>>                         CustomLog ${APACHE_LOG_DIR}/access.log combined
>>>                 </VirtualHost>
>>>                 And finally, the row that contains "data-site-root"
>>>                 and "data-locale-root" in source of the page:
>>>                 <body data-site-root="http://localhost:7000/"
>>>                 data-locale-root="http://localhost:7000/" >
>>>                 I tried to manually edit the file "base.html" and to
>>>                 change the 'data-site-root' and 'data-locale-root',
>>>                 but did not work and I have restored the original
>>>                 version:
>>>                 ORIGINAL: <body{% block bodytag %}
>>>                 data-site-root="{{ h.url('/', locale='default',
>>>                 qualified=true) }}" data-locale-root="{{ h.url('/',
>>>                 qualified=true) }}" {% endblock %}>
>>>                 RESULT: <body
>>>                 data-site-root="http://localhost:7000/"
>>>                 data-locale-root="http://localhost:7000/" >
>>>                 CHANGED (but now restored): <body{% block bodytag %}
>>>                 data-site-root="{{ h.url('/ckan', locale='default',
>>>                 qualified=true) }}" data-locale-root="{{
>>>                 h.url('/ckan', qualified=true) }}" {% endblock %}>
>>>                 RESULT: <body
>>>                 data-site-root="http://localhost:7000/ckan"
>>>                 data-locale-root="http://localhost:7000/ckan" > (do
>>>                 not work)
>>>                 Note: that "localhost:7000" is only redirection used
>>>                 by VirtualBox ( the server CKAN runs, on the virtual
>>>                 machine, on port 5000)
>>>                 Thanks for your help.
>>>
>>>                 Giuliano
>>>
>>>
>>>
>>>                 Il 13/08/2015 16:23, Nigel Babu ha scritto:
>>>
>>>                     Can you link me to the site? If not, please
>>>                     paste the output of
>>>                     /api/action/status_show. In your case, it might be
>>>                     ckan/api/action/status_show.
>>>
>>>                     Can you also view the source of the page and
>>>                     paste the <body> tag? I'd
>>>                     like to see the values of data-site-root and
>>>                     data-locale-root.
>>>
>>>                 _______________________________________________
>>>                 ckan-dev mailing list
>>>                 ckan-dev at lists.okfn.org <mailto:ckan-dev at lists.okfn.org>
>>>                 https://lists.okfn.org/mailman/listinfo/ckan-dev
>>>                 Unsubscribe:
>>>                 https://lists.okfn.org/mailman/options/ckan-dev
>>>
>>>             _______________________________________________
>>>             ckan-dev mailing list
>>>             ckan-dev at lists.okfn.org <mailto:ckan-dev at lists.okfn.org>  https://lists.okfn.org/mailman/listinfo/ckan-dev
>>>             Unsubscribe:https://lists.okfn.org/mailman/options/ckan-dev
>>             _________________________________________________
>>             ckan-dev mailing list
>>             ckan-dev at lists.okfn.org <mailto:ckan-dev at lists.okfn.org>
>>             https://lists.okfn.org/mailman/listinfo/ckan-dev
>>             Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>             _______________________________________________
>             ckan-dev mailing list
>             ckan-dev at lists.okfn.org <mailto:ckan-dev at lists.okfn.org>
>             https://lists.okfn.org/mailman/listinfo/ckan-dev
>             Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
>
>
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20150824/6f56cd76/attachment-0003.html>


More information about the ckan-dev mailing list