Skip to content

Commit

Permalink
- Backporting Docker Improvs and Fixes from master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Jun 25, 2018
1 parent 4c4e60c commit 5bbbcaf
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ RUN python manage.py makemigrations --settings=geonode.settings
RUN python manage.py migrate --settings=geonode.settings

EXPOSE 8000

# CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
CMD ["paver", "start_django", "-b", "0.0.0.0:8000"]
# CMD ["paver", "start_django", "-b", "0.0.0.0:8000"]
CMD ["uwsgi", "--ini", "uwsgi.ini"]

3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ services:
- db
# - elasticsearch
- rabbitmq
command: paver start_django -b 0.0.0.0:8000
# command: paver start_django -b 0.0.0.0:8000
command: uwsgi --ini uwsgi.ini
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- geoserver-data-dir:/geoserver_data/data
Expand Down
12 changes: 5 additions & 7 deletions geonode/geoserver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
import httplib2

import urllib
from urlparse import urlparse
from urlparse import urlsplit
from urlparse import urlsplit, urlparse, urljoin

from agon_ratings.models import OverallRating
from bs4 import BeautifulSoup
Expand Down Expand Up @@ -1257,15 +1256,14 @@ def ows(self):
The Open Web Service url for the server.
"""
location = self.PUBLIC_LOCATION if self.PUBLIC_LOCATION else self.LOCATION
return self.OWS_LOCATION if self.OWS_LOCATION else location + 'ows'
return self.OWS_LOCATION if self.OWS_LOCATION else urljoin(location, 'ows')

@property
def rest(self):
"""
The REST endpoint for the server.
"""
return self.LOCATION + \
'rest' if not self.REST_LOCATION else self.REST_LOCATION
return urljoin(self.LOCATION, 'rest') if not self.REST_LOCATION else self.REST_LOCATION

@property
def public_url(self):
Expand All @@ -1280,14 +1278,14 @@ def internal_ows(self):
The Open Web Service url for the server used by GeoNode internally.
"""
location = self.LOCATION
return location + 'ows'
return urljoin(location, 'ows')

@property
def internal_rest(self):
"""
The internal REST endpoint for the server.
"""
return self.LOCATION + 'rest'
return urljoin(self.LOCATION, 'rest')

@property
def hostname(self):
Expand Down
8 changes: 4 additions & 4 deletions geonode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,12 +749,12 @@
# Uploader Settings
DATA_UPLOAD_MAX_NUMBER_FIELDS = 100000
UPLOADER = {
'BACKEND': 'geonode.rest',
'BACKEND': os.getenv('DEFAULT_BACKEND_UPLOADER', 'geonode.rest'),
# 'BACKEND': 'geonode.importer',
'OPTIONS': {
'TIME_ENABLED': False,
'MOSAIC_ENABLED': False,
'GEOGIG_ENABLED': False,
'TIME_ENABLED': strtobool(os.getenv('TIME_ENABLED', 'False')),
'MOSAIC_ENABLED': strtobool(os.getenv('MOSAIC_ENABLED', 'False')),
'GEOGIG_ENABLED': strtobool(os.getenv('GEOGIG_ENABLED', 'False')),
},
'SUPPORTED_CRS': [
'EPSG:4326',
Expand Down
7 changes: 6 additions & 1 deletion scripts/docker/env/production/django.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GEONODE_GEODATABASE=geonode_data
GEONODE_GEODATABASE_PASSWORD=geonode_data
ASYNC_SIGNALS=False
BROKER_URL=amqp://guest:guest@rabbitmq:5672
ALLOWED_HOSTS=['localhost', 'django',]
ALLOWED_HOSTS=['localhost', 'django', 'geonode']
DOCKER_ENV=production
UWSGI_CMD=uwsgi --ini /usr/src/app/uwsgi.ini
IS_CELERY=False
Expand All @@ -19,6 +19,11 @@ GEOSERVER_PUBLIC_LOCATION=http://geonode/geoserver/
GEOSERVER_LOCATION=http://geonode/geoserver/
SITEURL=http://geonode/
COMPOSE_HTTP_TIMEOUT=300
DEFAULT_BACKEND_UPLOADER=geonode.importer
TIME_ENABLED=True
MOSAIC_ENABLED=False
GEOGIG_ENABLED=False

# See https://github.com/geosolutions-it/geonode-generic/issues/28
# to see why we force API version to 1.24
DOCKER_API_VERSION: "1.24"
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def update(ctx):
ctx.run("echo export SITEURL=\
http://{public_fqdn}/ >> {override_fn}".format(**envs), pty=True)
ctx.run("echo export ALLOWED_HOSTS=\
\"\\\"['{public_fqdn}', '{public_host}', 'django', 'geonode',]\\\"\" \
\"\\\"['{public_fqdn}', '{public_host}', 'localhost', 'django', 'geonode',]\\\"\" \
>> {override_fn}".format(**envs), pty=True)
ctx.run("echo export DATABASE_URL=\
{dburl} >> {override_fn}".format(**envs), pty=True)
Expand Down
6 changes: 4 additions & 2 deletions uwsgi.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[uwsgi]
http-socket = 0.0.0.0:8000
uwsgi-socket = 0.0.0.0:8000
# http-socket = 0.0.0.0:8000
chdir = /usr/src/app/
logto = /tmp/uwsgi.log
logto = /var/log/geonode.log
pidfile = /tmp/geonode.pid
harakiri = 25
module = geonode.wsgi:application
master = 1
Expand Down

0 comments on commit 5bbbcaf

Please sign in to comment.