[GeoNode-users] GeoNode-Project Docker Postgres Access

Toni Schönbuchner toni.schoenbuchner at csgis.de
Wed Nov 18 12:13:44 PST 2020


Hi Irlan,

in Docker the database is addressed by the container name ‚db‘

DATABASE_URL=postgis://{{project_name}}:geonode at db:5432/{{project_name}}
https://github.com/GeoNode/geonode-project/blob/master/.env#L34 <https://github.com/GeoNode/geonode-project/blob/master/.env#L34>

In other words Django calls the database by it’s container name not the IP.
You can try to change it but I’m not sure if this all what is needed …
Probably not, as the geonode postgis image has some logic built in …
https://github.com/GeoNode/postgis-docker <https://github.com/GeoNode/postgis-docker>


DATABASE_URL=postgis://{{project_name}}:geonode at db:192.168.100.22/{{project_name}}

The env file will overwrite:
https://github.com/GeoNode/geonode/blob/master/geonode/settings.py#L104 <https://github.com/GeoNode/geonode/blob/master/geonode/settings.py#L104>
!



cheers,

Toni

> Am 18.11.2020 um 21:00 schrieb geonode-users-request at lists.osgeo.org:
> 
> Send geonode-users mailing list submissions to
> 	geonode-users at lists.osgeo.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://lists.osgeo.org/mailman/listinfo/geonode-users
> or, via email, send a message with subject or body 'help' to
> 	geonode-users-request at lists.osgeo.org
> 
> You can reach the person managing the list at
> 	geonode-users-owner at lists.osgeo.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of geonode-users digest..."
> Today's Topics:
> 
>   1. Re: GeoNode-Project Docker Postgres Access (irlan128)
> 
> Von: irlan128 <irlan128 at gmail.com>
> Betreff: Aw: [GeoNode-users] GeoNode-Project Docker Postgres Access
> Datum: 18. November 2020 um 14:21:49 MEZ
> An: geonode-users at lists.osgeo.org
> 
> 
> Hi Julierme
> I`m install geonode via docker, i`m want to change the database with another
> database in another server(192.168.100.22), i`m already change my
> local_settings.py
> *DATABASES = {
>    'default': {
>        'ENGINE': 'django.db.backends.postgresql_psycopg2',
>        'NAME': 'geonode',
>        'USER': 'geonode',
>        'PASSWORD': 'geonode',
>        'HOST': '192.168.100.22',
>        'PORT': '5432',
>        'CONN_MAX_AGE': 0,
>        'CONN_TOUT': 5,
>        'OPTIONS': {
>            'connect_timeout': 5,
>        }
>    },
>    # vector datastore for uploads
>    'datastore': {
>        'ENGINE': 'django.contrib.gis.db.backends.postgis',
>        # 'ENGINE': '', # Empty ENGINE name disables
>        'NAME': 'geonode_data',
>        'USER': 'geonode',
>        'PASSWORD': 'geonode',
>        'HOST': '192.168.100.22',
>        'PORT': '5432',
>        'CONN_MAX_AGE': 0,
>                            *
> 
> and i`m already change wsgi.py to localhost
> *os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geonode.local_settings")
> *
> 
> but still when i`m running "docker logs -f django4geonode" ,still the
> database redirect to db not my postgre host  which on192.168.100.22
> * "postgres://geonode:geonode@db:5432/geonode"
> *
> can you give me a way to solve this problem?
> thanks
> 
> *
> 2369 static files copied to '/mnt/volumes/statics/static'.
> static data refreshed
> Executing UWSGI server uwsgi --ini /usr/src/app/uwsgi.ini for Production
> command to be executed is uwsgi --ini /usr/src/app/uwsgi.ini
> [uWSGI] getting INI configuration from /usr/src/app/uwsgi.ini
> Restarting periodic command scheduler: cronStopping periodic command
> scheduler: cron.
> Starting periodic command scheduler: cron.
> IS_CELERY=false
> DATABASE_URL=postgres://geonode:geonode@db:5432/geonode
> GEODATABASE_URL=postgis://geonode_data:geonode_data@db:5432/geonode_data
> SITEURL=http://localhost/
> ALLOWED_HOSTS=['localhost', 'localhost', 'localhost:None', 'django',
> 'geonode']
> GEOSERVER_PUBLIC_LOCATION=http://localhost/geoserver/
> GEOSERVER_WEB_UI_LOCATION=http://localhost/geoserver/
> waitfordbs task done
> 
> *
> 
> 
> 
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/GeoNode-users-f5185389.html
> 
> 
> 
> _______________________________________________
> geonode-users mailing list
> geonode-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geonode-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20201118/94f7cf3e/attachment.html>


More information about the geonode-users mailing list