-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Make sure the DB is available - Make sure we have updated migrations - Tuning spc docker-compose
- Loading branch information
afabiani
committed
Jul 8, 2019
1 parent
75c5f20
commit 5bcbe01
Showing
4 changed files
with
157 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,54 @@ | ||
# TODO : use python:2.7.13-alpine3.6 to make this lighter ( it is what we use for letsencryipt as well) | ||
# But it seems it's not possible for now because alpine only has geos 3.6 which is not supported by django 1.8 | ||
# (probably because of https://code.djangoproject.com/ticket/28441) | ||
|
||
FROM python:2.7.14-slim-stretch | ||
|
||
# Install system dependencies | ||
RUN echo "Updating apt-get" && \ | ||
apt-get update && \ | ||
echo "Installing build dependencies" && \ | ||
apt-get install -y gcc make libc-dev musl-dev libpcre3 libpcre3-dev g++ && \ | ||
echo "Installing Pillow dependencies" && \ | ||
# RUN apt-get install -y NOTHING ?? It was probably added in other packages... ALPINE needed jpeg-dev zlib-dev && \ | ||
echo "Installing GDAL dependencies" && \ | ||
apt-get install -y libgeos-dev libgdal-dev && \ | ||
echo "Installing Psycopg2 dependencies" && \ | ||
# RUN apt-get install -y NOTHING ?? It was probably added in other packages... ALPINE needed postgresql-dev && \ | ||
echo "Installing other dependencies" && \ | ||
apt-get install -y libxml2-dev libxslt-dev && \ | ||
echo "Installing GeoIP dependencies" && \ | ||
apt-get install -y geoip-bin geoip-database && \ | ||
echo "Installing healthceck dependencies" && \ | ||
apt-get install -y curl && \ | ||
echo "Python server" && \ | ||
pip install uwsgi && \ | ||
echo "Removing build dependencies and cleaning up" && \ | ||
# TODO : cleanup apt-get with something like apt-get -y --purge autoremove gcc make libc-dev musl-dev libpcre3 libpcre3-dev g++ && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
rm -rf ~/.cache/pip | ||
|
||
# Install python dependencies | ||
RUN echo "Geonode python dependencies" | ||
RUN pip install celery==4.1.0 # see https://github.com/GeoNode/geonode/pull/3714 | ||
|
||
# Install geonode dependencies | ||
ADD requirements.txt /requirements.txt | ||
RUN pip install -r requirements.txt | ||
RUN rm requirements.txt | ||
|
||
# Install pygdal (after requirements https://github.com/GeoNode/geonode/pull/4599) | ||
RUN pip install pygdal==$(gdal-config --version).* | ||
|
||
# Install geonode | ||
RUN mkdir /spcgeonode | ||
WORKDIR /spcgeonode/ | ||
ADD . /spcgeonode/ | ||
RUN pip install -e . | ||
RUN chmod +x scripts/spcgeonode/django/docker-entrypoint.sh | ||
|
||
# Export ports | ||
EXPOSE 8000 | ||
|
||
# We provide no command or entrypoint as this image can be used to serve the django project or run celery tasks | ||
# TODO : use python:2.7.13-alpine3.6 to make this lighter ( it is what we use for letsencryipt as well) | ||
# But it seems it's not possible for now because alpine only has geos 3.6 which is not supported by django 1.8 | ||
# (probably because of https://code.djangoproject.com/ticket/28441) | ||
|
||
FROM python:2.7.16-slim-stretch | ||
|
||
# Install system dependencies | ||
RUN echo "Updating apt-get" && \ | ||
apt-get update && \ | ||
echo "Installing build dependencies" && \ | ||
apt-get install -y gcc make libc-dev musl-dev libpcre3 libpcre3-dev g++ && \ | ||
echo "Installing Pillow dependencies" && \ | ||
# RUN apt-get install -y NOTHING ?? It was probably added in other packages... ALPINE needed jpeg-dev zlib-dev && \ | ||
echo "Installing GDAL dependencies" && \ | ||
apt-get install -y libgeos-dev libgdal-dev && \ | ||
echo "Installing Psycopg2 dependencies" && \ | ||
# RUN apt-get install -y NOTHING ?? It was probably added in other packages... ALPINE needed postgresql-dev && \ | ||
echo "Installing other dependencies" && \ | ||
apt-get install -y libxml2-dev libxslt-dev && \ | ||
echo "Installing GeoIP dependencies" && \ | ||
apt-get install -y geoip-bin geoip-database && \ | ||
echo "Installing healthceck dependencies" && \ | ||
apt-get install -y curl && \ | ||
echo "Python server" && \ | ||
pip install uwsgi && \ | ||
echo "Removing build dependencies and cleaning up" && \ | ||
# TODO : cleanup apt-get with something like apt-get -y --purge autoremove gcc make libc-dev musl-dev libpcre3 libpcre3-dev g++ && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
rm -rf ~/.cache/pip | ||
|
||
# Install python dependencies | ||
RUN echo "Geonode python dependencies" | ||
RUN pip install celery==4.2.1 # see https://github.com/GeoNode/geonode/pull/3714 | ||
RUN pip install django-celery-monitor==1.1.2 | ||
|
||
# Install geonode dependencies | ||
ADD requirements.txt /requirements.txt | ||
RUN pip install -r requirements.txt | ||
RUN rm requirements.txt | ||
|
||
# Install pygdal (after requirements https://github.com/GeoNode/geonode/pull/4599) | ||
RUN pip install pygdal==$(gdal-config --version).* | ||
|
||
# Install geonode | ||
RUN mkdir /spcgeonode | ||
WORKDIR /spcgeonode/ | ||
ADD . /spcgeonode/ | ||
RUN pip install -e . | ||
RUN chmod +x scripts/spcgeonode/django/docker-entrypoint.sh | ||
|
||
# Export ports | ||
EXPOSE 8000 | ||
|
||
# We provide no command or entrypoint as this image can be used to serve the django project or run celery tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,60 @@ | ||
# This is the main gepgeonode conf | ||
|
||
charset utf-8; | ||
|
||
# max upload size | ||
client_max_body_size 100G; | ||
|
||
# compression | ||
gzip on; | ||
gzip_proxied any; | ||
gzip_types | ||
text/css | ||
text/javascript | ||
text/xml | ||
text/plain | ||
application/javascript | ||
application/x-javascript | ||
application/json; | ||
|
||
# Geoserver | ||
location /geoserver { | ||
|
||
# Using a variable is a trick to let Nginx start even if upstream host is not up yet | ||
# (see https://sandro-keil.de/blog/2017/07/24/let-nginx-start-if-upstream-host-is-unavailable-or-down/) | ||
set $upstream geoserver:8080; | ||
|
||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
|
||
proxy_pass http://$upstream; | ||
} | ||
|
||
# Django media | ||
location /uploaded { | ||
alias /spcgeonode-media; # your Django project's media files - amend as required | ||
include /etc/nginx/mime.types; | ||
expires 365d; | ||
} | ||
|
||
location /static { | ||
alias /spcgeonode-static; # your Django project's static files - amend as required | ||
include /etc/nginx/mime.types; | ||
expires 365d; | ||
} | ||
|
||
# Finally, send all non-media requests to the Django server. | ||
location / { | ||
|
||
# Using a variable is a trick to let Nginx start even if upstream host is not up yet | ||
# (see https://sandro-keil.de/blog/2017/07/24/let-nginx-start-if-upstream-host-is-unavailable-or-down/) | ||
set $upstream django:8000; | ||
|
||
uwsgi_pass $upstream; | ||
|
||
# uwsgi_params | ||
include /etc/nginx/uwsgi_params; | ||
} | ||
# This is the main gepgeonode conf | ||
|
||
charset utf-8; | ||
|
||
# max upload size | ||
client_max_body_size 100G; | ||
|
||
# compression | ||
gzip on; | ||
gzip_proxied any; | ||
gzip_types | ||
text/css | ||
text/javascript | ||
text/xml | ||
text/plain | ||
application/javascript | ||
application/x-javascript | ||
application/json; | ||
|
||
# Geoserver | ||
location /geoserver { | ||
|
||
# Using a variable is a trick to let Nginx start even if upstream host is not up yet | ||
# (see https://sandro-keil.de/blog/2017/07/24/let-nginx-start-if-upstream-host-is-unavailable-or-down/) | ||
set $upstream geoserver:8080; | ||
|
||
proxy_set_header Host $http_host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
|
||
proxy_pass http://$upstream; | ||
} | ||
|
||
# Django media | ||
location /uploaded { | ||
alias /spcgeonode-media; # your Django project's media files - amend as required | ||
include /etc/nginx/mime.types; | ||
expires 365d; | ||
} | ||
|
||
location /static { | ||
alias /spcgeonode-static; # your Django project's static files - amend as required | ||
include /etc/nginx/mime.types; | ||
expires 365d; | ||
} | ||
|
||
# Finally, send all non-media requests to the Django server. | ||
location / { | ||
# uwsgi_params | ||
include /etc/nginx/uwsgi_params; | ||
|
||
# Using a variable is a trick to let Nginx start even if upstream host is not up yet | ||
# (see https://sandro-keil.de/blog/2017/07/24/let-nginx-start-if-upstream-host-is-unavailable-or-down/) | ||
set $upstream django:8000; | ||
uwsgi_pass $upstream; | ||
|
||
# when a client closes the connection then keep the channel to uwsgi open. Otherwise uwsgi throws an IOError | ||
uwsgi_ignore_client_abort on; | ||
} |