[GeoNode-users] Multi-Tenancy: how to start

Eugenio Trumpy frippe12573 at hotmail.com
Tue Dec 20 00:36:17 PST 2016


Hi Simone and all,


thanks again for your inputs.

However, I think I'm at a crucial position to finalize the configuration of the first new geosite (named gemex).

Just to clarify all the step performed and to focus the stage where I'm now, I list here below what I did and what I miss:


  1.  in setting.py I added under INSTALLED_APPS the line 'geonode.contrib.geosites'
  2.  I run python manage.py syncdb
  3.  I copy site-template (i.e. the folder inside contrib/geosites/) in the same position (i.e. contrib/geosites/) with a new name (e.g. gemex in my case)
  4.  I created a 4 level doman to be linked to the new site (i.e. gemex.igg.cnr.it in my case)
  5.  I added a new site from the admin panel available from a normal running installation
  6.  I create a new virtual host (for apache2) by copy the virtual host I had for the normal running installation. Here what is clear to me are the items:
     *   ServerName = where I put the created 4 level domain
     *   WSGIScriptAlias where I put the link to the wsgi.py available within the created newsite (i.e. path to contrib/geosites/gemex/wsgi.py)
     *   ProxyPass and ProxyPassReverse linked to the local geoserver

What is not yet clear:
from your last email I understand that the new site can be where I prefer. I would say that for now I can leave it inside contrib/geosites, if I can of course.
Then I have doubts to setup these lines:

  *   In the normal config I have Alias /geonode /dati/geonode/geonode but I think I should change to link it to my new site, is it right?
  *   In WSGIProcessGroup the normal config has geonode, for my new site do I need to change it?
  *   Regarding the directive Directory I had <Directory "/dati/geonode/geonode/"> for the normal config, here should I insert the path to my new site?
  *   Regarding /uploaded/ and /static/ Aliases, I understood from your email I can put those directory where I prefer. Now another trivial question: /uploaded/ and /static/ folder have to be different from those created for the normal installation? if no, then it is easy both configure the virtual host and run collectstatic. If yes, it is not clear how to run collectstatic for the new site. That's why the command python manage.py collectstatic works only within geonode folder and fill in the normal static_root folder. Could you clarify this point?
  *   Last but not least the line WSGIDaemonProcess is not clear, because running: service apache reload I had an error: Name duplicates previous WSGI daemon definition (that's why apache find the virtualhost I have for the normal installation. The normal installation has: WSGIDaemonProcess geonode python-path=/dati/geonode/:/dati/.venvs/geonode/lib/python2.7/site-packages user=eugenio threads=15 processes=2 How should sort out this line for the new site?

I offer myself to prepare an how to for dummies to be included as documentation in git, if I will be able to configure geosites.

Thanks for any clarification

Eugenio



________________________________
Da: Simone Dalmasso <simone.dalmasso at gmail.com>
Inviato: lunedì 19 dicembre 2016 18.33
A: Eugenio Trumpy
Cc: geonode-users at lists.osgeo.org
Oggetto: Re: Multi-Tenancy: how to start

I mean the whole gemex folder can be outside. For the static roots they can be anywhere and is not recommended to have them inside but rather in /var/www as they need to be served by the web server at some point.

2016-12-19 16:50 GMT+01:00 Eugenio Trumpy <frippe12573 at hotmail.com<mailto:frippe12573 at hotmail.com>>:

Ok, once I run syncdb I 'm able to register new site! first step!!!!


Coming back to the first issue, I'm not sure to have understood well, do you mean the dir thumb, layers, static_root can stay ouside my newsite directory?

That means I cannot run collectstatic if those dirs are inside my site dir?

Actually in the docs I read I saw that the static folder is inside the new sites.


This part is not so clear to me....


E.


________________________________
Da: Simone Dalmasso <simone.dalmasso at gmail.com<mailto:simone.dalmasso at gmail.com>>
Inviato: lunedì 19 dicembre 2016 16.22

A: Eugenio Trumpy
Cc: geonode-users at lists.osgeo.org<mailto:geonode-users at lists.osgeo.org>
Oggetto: Re: Multi-Tenancy: how to start

It is a good practice to not install the new sites folders into the root of the code. They can live outside without problems.

The second issue is that you did not run python manage.py syncdb or migrate to install the tables that come with geosites.

2016-12-19 15:50 GMT+01:00 Eugenio Trumpy <frippe12573 at hotmail.com<mailto:frippe12573 at hotmail.com>>:

Sorry for these multiple emails,


I following your suggestion to create the site by hand I proceeded to register the new site by using the admin console as you suggested.

On save action I had this error message:


http://pastebin.com/SskX1QNB




It seems geonode.contrib.geosites is not installed yet, right?

E.


________________________________
Da: Eugenio Trumpy <frippe12573 at hotmail.com<mailto:frippe12573 at hotmail.com>>
Inviato: lunedì 19 dicembre 2016 15.37
A: Simone Dalmasso

Oggetto: Re: Multi-Tenancy: how to start


Ok,


this is my new virtualhost prepared for the new site named 'gemex':


<VirtualHost *:80>
    ServerName http://gemex.igg.cnr.it
    ServerAdmin webmaster at localhost
    DocumentRoot /var/www/html

    Options -Indexes +FollowSymLinks

    Alias /gemex "/dati/geonode/geonode/contrib/geosites"

    WSGIDaemonProcess gemex python-path=/dati/geonode/geonode/contrib/geosites:/dati/.venvs/geonode/lib/python2.7/site-packages user=eugenio threads=15 processes=2

    ErrorLog /var/log/apache2/error.log
    LogLevel warn
    CustomLog /var/log/apache2/access.log combined

    WSGIProcessGroup gemex
    WSGIPassAuthorization On
    WSGIScriptAlias / /dati/geonode/geonode/contrib/geosites/gemex/wsgi.py

    <Directory "/dati/geonode/geonode/contrib/geosites/gemex">
           Options Indexes FollowSymLinks
        Require all granted
        IndexOptions FancyIndexing
    </Directory>

    Alias /uploaded/ /dati/geonode/geonode/contrib/geosites/gemex/uploaded/
    Alias /static/ /dati/geonode/geonode/contrib/geosites/gemex/static_root/

     ProxyPreserveHost On
    ProxyPass /geoserver http://localhost:8080/geoserver
    ProxyPassReverse /geoserver http://localhost:8080/geoserver

    ProxyPass /geoserver2 http://localhost:8080/geoserver2
    ProxyPassReverse /geoserver2 http://localhost:8080/geoserver2


</VirtualHost>


My concerns are:

  *   WSGIDeamon line, is that correct?
  *   the first Alias, is that correct too?
  *   Eventually the Directory is right?


Moreover, I followed again this page for the http setup:
http://docs.geonode.org/en/master/tutorials/install_and_admin/geonode_install/setup_configure_httpd.html

I think now should be rready for the collecstatic command, but I don't know how to run it in in the new static_root inside my site gemex.

Any hints?

E.
Setup & Configure HTTPD — GeoNode 2.4 documentation<http://docs.geonode.org/en/master/tutorials/install_and_admin/geonode_install/setup_configure_httpd.html>
docs.geonode.org<http://docs.geonode.org>
Setup & Configure HTTPD¶ In this section we are going to setup Apache HTTP to serve GeoNode.




________________________________
Da: Simone Dalmasso <simone.dalmasso at gmail.com<mailto:simone.dalmasso at gmail.com>>
Inviato: lunedì 19 dicembre 2016 15.03
A: Eugenio Trumpy
Cc: geonode-users at lists.osgeo.org<mailto:geonode-users at lists.osgeo.org>
Oggetto: Re: Multi-Tenancy: how to start

Exactly, one virtualhost for each site.

2016-12-19 14:53 GMT+01:00 Eugenio Trumpy <frippe12573 at hotmail.com<mailto:frippe12573 at hotmail.com>>:

Ok,


I will proceed this way.

Then I have to create a new virtualhost pointing to the wsgi.py within the new site dir, right?
In the same virtual host have I to set new aliases for uploaded dir and static_root as I did for the normal installation?

E.

________________________________
Da: Simone Dalmasso <simone.dalmasso at gmail.com<mailto:simone.dalmasso at gmail.com>>
Inviato: lunedì 19 dicembre 2016 14.21

A: Eugenio Trumpy
Cc: geonode-users at lists.osgeo.org<mailto:geonode-users at lists.osgeo.org>
Oggetto: Re: Multi-Tenancy: how to start

I suggest you to go manually and create a site folder copying the site_template, rename and add the Site object into the database.

geosites has not been revised for a while and geonode improved. It works but the shortcut command addsite may be broken.

2016-12-19 11:32 GMT+01:00 Eugenio Trumpy <frippe12573 at hotmail.com<mailto:frippe12573 at hotmail.com>>:

Hi Simone,


I did what you suggested, actually now I have the addsite command, but as you announced I have also this error:


AttributeError: 'Settings' object has no attribute 'SITE_ROOT'


then I added SITE_ROOT in local_setting.py inserting the path "geonode/contrib/geosites"


afterwords I had this error:


AttributeError: 'Settings' object has no attribute 'SERVE_PATH'


so that I added SERVE_PATH in local_setting.py inserting the path "geonode/contrib/geosites/static"


but I'm not sure I did the right thing, since now I have this error:


OSError: [Errno 17] File exists: '/dati/geonode/geonode/contrib/site2'

Where I'm wrong?

Thanks

Eugenio

________________________________
Da: Simone Dalmasso <simone.dalmasso at gmail.com<mailto:simone.dalmasso at gmail.com>>
Inviato: lunedì 19 dicembre 2016 11.04
A: Eugenio Trumpy
Cc: geonode-users at lists.osgeo.org<mailto:geonode-users at lists.osgeo.org>
Oggetto: Re: Multi-Tenancy: how to start

you have to add it in INSTALLED_APPS, currently it is only listed in the contrib apps.

2016-12-19 9:20 GMT+01:00 Eugenio Trumpy <frippe12573 at hotmail.com<mailto:frippe12573 at hotmail.com>>:

Hi Simone,


and thank you for your answer.

Sorry for my trivial question:


in my setting.py I have already geonode.contrib.geosites

in GEONODE_CONTRIB_APPS, see below:

GEONODE_CONTRIB_APPS = (
    # GeoNode Contrib Apps
    'geonode.contrib.dynamic',
    'geonode.contrib.exif',
    'geonode.contrib.favorite',
    'geonode.contrib.geogig',
    'geonode.contrib.geosites',
    'geonode.contrib.nlp',
    'geonode.contrib.slack'
)

in INSTALLED_APPS I have:

INSTALLED_APPS = (

    # Boostrap admin theme
    # 'django_admin_bootstrapped.bootstrap3',
    # 'django_admin_bootstrapped',

    # Apps bundled with Django
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'django.contrib.sitemaps',
    'django.contrib.staticfiles',
    'django.contrib.messages',
    'django.contrib.humanize',
    'django.contrib.gis',

    # Third party apps

    # Utility
    'pagination',
    'taggit',
    'friendlytagloader',
    'geoexplorer',
    'leaflet',
    'django_extensions',
    # 'haystack',

....and others...

Should I insert geonode.contrib.geosites somewhere in local_setting? or it's already ok as it? or copy geonode.contrib.geosites in settings.py under INSTALLED_APPS?

Sorry again for this banal question...

E.




________________________________
Da: Simone Dalmasso <simone.dalmasso at gmail.com<mailto:simone.dalmasso at gmail.com>>
Inviato: lunedì 19 dicembre 2016 09.04
A: Eugenio Trumpy
Cc: geonode-users at lists.osgeo.org<mailto:geonode-users at lists.osgeo.org>
Oggetto: Re: Multi-Tenancy: how to start

Ciao Eugenio,

sorry for being so late in the response.

You have to add 'geonode.contrib.geosites' to your INSTALLED_APPS in order to get the command.

In case you get errors in running that command, you can always 'make' a geosite by yourself by copying the folder 'site_template' and changing it's name and internal parameters and then register the new Site in the admin panel. You can follow the utils.py add_site function and replicate the needed steps (some of them are only for production).
Take also some time to see how the pre and post settings work.

Hope this helps


2016-12-19 8:55 GMT+01:00 Eugenio Trumpy <frippe12573 at hotmail.com<mailto:frippe12573 at hotmail.com>>:

Hi everyone,


regarding the multi-tenancy setting up and in particular the installation of new site since the command:

python manage.py addsite sitename sitedomain


return me:

Unknown command: 'addsite'
Type 'manage.py help' for usage.


Do you know way? Have I 'activate' in some way the multi-tenancy before? or it is ready to use?

If it is ready to use, why 'addsite' is an unknown command?

I launched the command from the main geonode directory, am I right?

As I wrote in the previous email in my installation I have only manage.py file in
/geonode directory.

I'm testing on on ubuntu 14.04 and geonode is at version 2.4.dev20151029170512.
I installed geonode as custom installation (not by apt-get).

Thanks

Eugenio
________________________________
Da: Eugenio Trumpy <frippe12573 at hotmail.com<mailto:frippe12573 at hotmail.com>>
Inviato: venerdì 16 dicembre 2016 15.04
A: geonode-users at lists.osgeo.org<mailto:geonode-users at lists.osgeo.org>
Oggetto: Multi-Tenancy: how to start


Hi all,


as pointed in the email object I want to try the geonode multi-tenancy capabilities.

I started of course from the documentation [1] and [2], but a need some hints to start.


I have already a running geonode instance. Do you think I should start from

a clean geonode installation or I can arrange the running one?

Is there somewhere a set of commands to setup the geosite 1, geosite 2, ...

I was looking into geosites folder, as suggested in [2], but I don't see neither manage.py nor manage_all.py files.

I tried python manage.py addsite geosite1 geosite1domain

but I got Unknown command: 'addsite'


Am I missing something?


After that: How can I sort out the already stored layers?


Thank you very much for hints and for the patience of this stupid questions,


Eugenio


[1] https://geonode.readthedocs.io/en/2.0/tutorials/admin/multi-tenancy.html

[2] https://github.com/GeoNode/geonode/tree/master/geonode/contrib/geosites





--
Simone



--
Simone



--
Simone



--
Simone



--
Simone



--
Simone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20161220/fe7a85bf/attachment-0001.html>


More information about the geonode-users mailing list