Skip to content

Commit 5c98135

Browse files
author
afabiani
committed
- Align to geonode-project Dockerfile and docker-compose
(cherry picked from commit 3e9709f)
1 parent 1f817b8 commit 5c98135

5 files changed

Lines changed: 32 additions & 11 deletions

File tree

Dockerfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-k
1010
# This section is borrowed from the official Django image but adds GDAL and others
1111
RUN apt-get update && apt-get install -y \
1212
libpq-dev python-dev libxml2-dev \
13-
libxml2 libxml2-dev libxslt1-dev zlib1g-dev libjpeg-dev \
13+
libxml2 libxslt1-dev zlib1g-dev libjpeg-dev \
1414
libmemcached-dev libldap2-dev libsasl2-dev libffi-dev
1515

1616
RUN apt-get update && apt-get install -y \
1717
gcc zip gettext geoip-bin cron \
18-
postgresql-client-11 sqlite3 spatialite-bin libsqlite3-mod-spatialite \
18+
postgresql-client-11 \
19+
sqlite3 spatialite-bin libsqlite3-mod-spatialite \
1920
python3-gdal python3-psycopg2 python3-ldap \
2021
python3-pip python3-pil python3-lxml python3-pylibmc \
2122
python3-dev libgdal-dev \
@@ -51,6 +52,11 @@ RUN pip install --upgrade --no-cache-dir --src /usr/src -r requirements.txt \
5152
&& pip install pygdal==$(gdal-config --version).* \
5253
&& pip install flower==0.9.4
5354

55+
# Activate "memcached"
56+
RUN apt install memcached
57+
RUN pip install pylibmc \
58+
&& pip install sherlock
59+
5460
# Install "geonode-contribs" apps
5561
RUN cd /usr/src; git clone https://github.com/GeoNode/geonode-contribs.git -b master
5662
# Install logstash and centralized dashboard dependencies
@@ -59,5 +65,5 @@ RUN cd /usr/src/geonode-contribs/geonode-logstash; pip install --upgrade -e . \
5965

6066
EXPOSE 8000
6167

62-
ENTRYPOINT service cron restart && /usr/src/app/entrypoint.sh
68+
ENTRYPOINT service cron restart && service memcached restart && /usr/src/app/entrypoint.sh
6369
CMD ["uwsgi", "--ini", "/usr/src/app/uwsgi.ini"]

celery.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22
nohup celery -A geonode.celery_app:app beat -l DEBUG -f /var/log/celery.log &>/dev/null &
3-
nohup celery -A geonode.celery_app:app worker -B -E --statedb=worker.state --loglevel=INFO --concurrency=10 -n worker1@%h -f /var/log/celery.log &>/dev/null &
3+
nohup celery -A geonode.celery_app:app worker -B -E --statedb=worker.state -s celerybeat-schedule --loglevel=INFO --concurrency=10 -n worker1@%h -f /var/log/celery.log &>/dev/null &
44
nohup celery -A geonode.celery_app:app flower --auto_refresh=True --debug=False --broker=${BROKER_URL} --basic_auth=${ADMIN_USERNAME}:${ADMIN_PASSWORD} --address=0.0.0.0 --port=5555 &>/dev/null &

tasks.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ def update(ctx):
7777
"monitoring_host_name": os.environ.get('MONITORING_HOST_NAME', 'geonode'),
7878
"monitoring_service_name": os.environ.get('MONITORING_SERVICE_NAME', 'local-geonode'),
7979
"monitoring_data_ttl": os.environ.get('MONITORING_DATA_TTL', 7),
80-
"geoip_path": os.environ.get('GEOIP_PATH', '/mnt/volumes/statics/geoip.db'),
8180
"geonode_geodb_passwd": os.environ.get('GEONODE_GEODATABASE_PASSWORD', 'geonode_data'),
8281
"default_backend_datastore": os.environ.get('DEFAULT_BACKEND_DATASTORE', 'datastore'),
8382
"geonode_db_passwd": os.environ.get('GEONODE_DATABASE_PASSWORD', 'geonode'),
@@ -211,6 +210,21 @@ def prepare(ctx):
211210
client_secret=os.environ['OAUTH2_CLIENT_SECRET'],
212211
oauth_config=oauth_config
213212
), pty=True)
213+
ctx.run(
214+
'sed -i "s|<userAuthorizationUri>.*</userAuthorizationUri>|<userAuthorizationUri>{new_ext_ip}o/authorize/</userAuthorizationUri>|g" {oauth_config}'.format(
215+
new_ext_ip=os.environ['SITEURL'],
216+
oauth_config=oauth_config
217+
), pty=True)
218+
ctx.run(
219+
'sed -i "s|<redirectUri>.*</redirectUri>|<redirectUri>{new_ext_ip}geoserver/index.html</redirectUri>|g" {oauth_config}'.format(
220+
new_ext_ip=os.environ['SITEURL'],
221+
oauth_config=oauth_config
222+
), pty=True)
223+
ctx.run(
224+
'sed -i "s|<logoutUri>.*</logoutUri>|<logoutUri>{new_ext_ip}account/logout/</logoutUri>|g" {oauth_config}'.format(
225+
new_ext_ip=os.environ['SITEURL'],
226+
oauth_config=oauth_config
227+
), pty=True)
214228

215229

216230
@task
@@ -222,7 +236,7 @@ def fixtures(ctx):
222236
--settings={0}".format(_localsettings()), pty=True)
223237
ctx.run("python manage.py loaddata /tmp/default_site.json \
224238
--settings={0}".format(_localsettings()), pty=True)
225-
ctx.run("python manage.py loaddata /usr/src/app/fixtures/initial_data.json \
239+
ctx.run("python manage.py loaddata initial_data \
226240
--settings={0}".format(_localsettings()), pty=True)
227241
ctx.run("python manage.py set_all_layers_alternate \
228242
--settings={0}".format(_localsettings()), pty=True)

uwsgi.ini

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@ vacuum = true ; Delete sockets during shutdown
1212
single-interpreter = true
1313
die-on-term = true ; Shutdown when receiving SIGTERM (default is respawn)
1414
need-app = true
15+
thunder-lock = true
1516

16-
touch-reload = /usr/src/geonode_master/geonode_master/wsgi.py
17+
touch-reload = /usr/src/app/geonode/wsgi.py
1718
buffer-size = 32768
1819

19-
harakiri = 1200 ; forcefully kill workers after 600 seconds
20+
harakiri = 600 ; forcefully kill workers after 600 seconds
2021
py-callos-afterfork = true ; allow workers to trap signals
2122

2223
max-requests = 1000 ; Restart workers after this many requests
2324
max-worker-lifetime = 3600 ; Restart workers after this many seconds
2425
reload-on-rss = 2048 ; Restart workers after this much resident memory
25-
worker-reload-mercy = 1200 ; How long to wait before forcefully killing workers
26+
worker-reload-mercy = 600 ; How long to wait before forcefully killing workers
2627

2728
cheaper-algo = busyness
2829
processes = 128 ; Maximum number of workers allowed
@@ -37,6 +38,6 @@ cheaper-busyness-max = 70 ; Above this threshold, spawn new workers
3738
cheaper-busyness-backlog-alert = 16 ; Spawn emergency workers if more than this many requests are waiting in the queue
3839
cheaper-busyness-backlog-step = 2 ; How many emergency workers to create if there are too many requests in the queue
3940

40-
# cron = -1 -1 -1 -1 -1 sh -c '/usr/src/geonode_master/manage.sh collect_metrics -n -t xml';
41+
# cron = -1 -1 -1 -1 -1 sh -c '/usr/src/geonode/manage.sh collect_metrics -n -t xml';
4142
cron = 0 0 -1 -1 -1 sh -c 'find /backup_restore/ -type f -mtime +30 -exec rm -f {} \;'
4243
cron = 0 0 -1 -1 -1 sh -c 'find /backup_restore/ -type d -ctime +30 -exec rm -rf {} \;'

wait-for-databases.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -e
55
host="$1"
66
shift
77

8-
until PGPASSWORD=postgres psql -h "$host" -U "postgres" -P "pager=off" -c '\l'; do
8+
until PGPASSWORD=${POSTGRES_PASSWORD} psql -h "$host" -U ${POSTGRES_USER} -P "pager=off" -c '\l'; do
99
>&2 echo "Postgres is unavailable - sleeping"
1010
sleep 1
1111
done

0 commit comments

Comments
 (0)