Skip to content

Commit 93d82ed

Browse files
author
afabiani
committed
# Conflicts: # uwsgi.ini
2 parents 5c98135 + a0842d2 commit 93d82ed

2 files changed

Lines changed: 28 additions & 18 deletions

File tree

tasks.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def update(ctx):
8181
"default_backend_datastore": os.environ.get('DEFAULT_BACKEND_DATASTORE', 'datastore'),
8282
"geonode_db_passwd": os.environ.get('GEONODE_DATABASE_PASSWORD', 'geonode'),
8383
"geonode_geodb": os.environ.get('GEONODE_GEODATABASE', 'geonode_data'),
84-
"db_url": os.environ.get('DATABASE_URL', 'postgres://geonode:geonode@db:5432/geonode'),
84+
"db_url": os.environ.get('DATABASE_URL', 'postgis://geonode:geonode@db:5432/geonode'),
8585
"geodb_url": os.environ.get('GEODATABASE_URL', 'postgis://geonode:geonode@db:5432/geonode_data'),
8686
"geonode_db": os.environ.get('GEONODE_DATABASE', 'geonode'),
8787
"gs_loc": os.environ.get('GEOSERVER_LOCATION', 'http://geoserver:8080/geoserver/'),
@@ -297,10 +297,15 @@ def initialized(ctx):
297297
ctx.run('date > /mnt/volumes/statics/geonode_init.lock')
298298

299299
def _docker_host_ip():
300-
client = docker.from_env()
301-
ip_list = client.containers.run(BOOTSTRAP_IMAGE_CHEIP,
302-
network_mode='host'
303-
).split("\n")
300+
try:
301+
client = docker.from_env(version='1.24')
302+
ip_list = client.containers.run(BOOTSTRAP_IMAGE_CHEIP,
303+
network_mode='host'
304+
).split("\n")
305+
except Exception:
306+
import traceback
307+
traceback.print_exc()
308+
ip_list = ['127.0.0.1', ]
304309
if len(ip_list) > 1:
305310
print("Docker daemon is running on more than one \
306311
address {0}".format(ip_list))
@@ -314,24 +319,29 @@ def _docker_host_ip():
314319

315320

316321
def _container_exposed_port(component, instname):
317-
client = docker.from_env()
318-
ports_dict = json.dumps(
319-
[c.attrs['Config']['ExposedPorts'] for c in client.containers.list(
320-
filters={
321-
'label': 'org.geonode.component={0}'.format(component),
322-
'status': 'running'
323-
}
324-
) if '{0}'.format(instname) in c.name][0]
325-
)
326-
for key in json.loads(ports_dict):
327-
port = re.split('/tcp', key)[0]
322+
try:
323+
client = docker.from_env(version='1.24')
324+
ports_dict = json.dumps(
325+
[c.attrs['Config']['ExposedPorts'] for c in client.containers.list(
326+
filters={
327+
'label': 'org.geonode.component={0}'.format(component),
328+
'status': 'running'
329+
}
330+
) if '{0}'.format(instname) in c.name][0]
331+
)
332+
for key in json.loads(ports_dict):
333+
port = re.split('/tcp', key)[0]
334+
except Exception:
335+
import traceback
336+
traceback.print_exc()
337+
port = '80'
328338
return port
329339

330340
def _update_db_connstring():
331341
user = os.getenv('GEONODE_DATABASE', 'geonode')
332342
pwd = os.getenv('GEONODE_DATABASE_PASSWORD', 'geonode')
333343
dbname = os.getenv('GEONODE_DATABASE', 'geonode')
334-
connstr = 'postgres://{0}:{1}@db:5432/{2}'.format(
344+
connstr = 'postgis://{0}:{1}@db:5432/{2}'.format(
335345
user,
336346
pwd,
337347
dbname

uwsgi.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ cheaper-busyness-max = 70 ; Above this threshold, spawn new workers
3838
cheaper-busyness-backlog-alert = 16 ; Spawn emergency workers if more than this many requests are waiting in the queue
3939
cheaper-busyness-backlog-step = 2 ; How many emergency workers to create if there are too many requests in the queue
4040

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

0 commit comments

Comments
 (0)