For some reason there is an issue when deploying where it won’t connect to the postres database. I get
[2018-01-24 16:24:29,905: CRITICAL/MainProcess] Unrecoverable error: OperationalError(‘could not connect to server: No route to host\n\tIs the server running on host “postgres” (172.17.0.8) and accepting\n\tTCP/IP connections on port 5432?\n’,)
Traceback (most recent call last):
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/worker/worker.py”, line 203, in start
self.blueprint.start(self)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/bootsteps.py”, line 119, in start
step.start(parent)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/bootsteps.py”, line 370, in start
return self.obj.start()
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/worker/consumer/consumer.py”, line 320, in start
blueprint.start(self)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/bootsteps.py”, line 119, in start
step.start(parent)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/worker/consumer/consumer.py”, line 596, in start
c.loop(*c.loop_args())
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/worker/loops.py”, line 49, in asynloop
consumer.consume()
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/kombu/messaging.py”, line 477, in consume
self._basic_consume(T, no_ack=no_ack, nowait=False)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/kombu/messaging.py”, line 598, in _basic_consume
no_ack=no_ack, nowait=nowait)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/kombu/entity.py”, line 737, in consume
arguments=self.consumer_arguments)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/amqp/channel.py”, line 1564, in basic_consume
wait=None if nowait else spec.Basic.ConsumeOk,
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/amqp/abstract_channel.py”, line 59, in send_method
return self.wait(wait, returns_tuple=returns_tuple)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/amqp/abstract_channel.py”, line 79, in wait
self.connection.drain_events(timeout=timeout)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/amqp/connection.py”, line 471, in drain_events
while not self.blocking_read(timeout):
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/amqp/connection.py”, line 477, in blocking_read
return self.on_inbound_frame(frame)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/amqp/method_framing.py”, line 77, in on_frame
callback(channel, msg.frame_method, msg.frame_args, msg)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/amqp/connection.py”, line 481, in on_inbound_method
method_sig, payload, content,
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/amqp/abstract_channel.py”, line 128, in dispatch_method
listener(*args)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/amqp/channel.py”, line 1599, in _on_basic_deliver
fun(msg)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/kombu/messaging.py”, line 624, in _receive_callback
return on_m(message) if on_m else self.receive(decoded, message)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/worker/consumer/consumer.py”, line 570, in on_task_received
callbacks,
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/worker/strategy.py”, line 110, in task_message_handler
if (req.expires or req.id in revoked_tasks) and req.revoked():
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/worker/request.py”, line 279, in revoked
‘expired’ if expired else ‘revoked’, False, None, expired,
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/worker/request.py”, line 262, in _announce_revoked
self.id, reason, request=self, store_result=self.store_errors,
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/backends/base.py”, line 192, in mark_as_revoked
traceback=None, request=request)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/celery/backends/base.py”, line 309, in store_result
request=request, **kwargs)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django_celery_results/backends/database.py”, line 29, in _store_result
meta=meta,
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django_celery_results/managers.py”, line 50, in _inner
return fun(*args, **kwargs)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django_celery_results/managers.py”, line 119, in store_result
obj, created = self.get_or_create(task_id=task_id, defaults=fields)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/manager.py”, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/query.py”, line 464, in get_or_create
return self.get(**lookup), False
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/query.py”, line 374, in get
num = len(clone)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/query.py”, line 232, in len
self._fetch_all()
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/query.py”, line 1118, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/query.py”, line 53, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/sql/compiler.py”, line 882, in execute_sql
cursor = self.connection.cursor()
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 254, in cursor
return self._cursor()
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 229, in _cursor
self.ensure_connection()
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 213, in ensure_connection
self.connect()
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/utils.py”, line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 213, in ensure_connection
self.connect()
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/backends/base/base.py”, line 189, in connect
self.connection = self.get_new_connection(conn_params)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/backends/postgresql/base.py”, line 176, in get_new_connection
connection = Database.connect(**conn_params)
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/psycopg2/init.py”, line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
OperationalError: could not connect to server: No route to host
Is the server running on host “postgres” (172.17.0.8) and accepting
TCP/IP connections on port 5432?
When I do a docker container ls for postgres I see
f3b662abdf19 postgres:9.6 “docker-entrypoint…” 21 hours ago Restarting (1) 27 seconds ago postgres