# AWX via Fargate Fails to start - postgresql errors

**URL:** <https://forum.ansible.com/t/awx-via-fargate-fails-to-start-postgresql-errors/33148>\
**Category:** AWX Project\
**Tags:** aws, awx\
**Created:** [June 10, 2020, 7:22pm UTC](https://forum.ansible.com/t/awx-via-fargate-fails-to-start-postgresql-errors/33148 "2020-06-10T19:22:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emil\_Safonov](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@Emil\_Safonov](https://forum.ansible.com/u/Emil_Safonov)\
**Post date:** [June 10, 2020, 7:22pm UTC](https://forum.ansible.com/t/awx-via-fargate-fails-to-start-postgresql-errors/33148/1 "2020-06-10T19:22:45Z")

</div>

Hey All,

I’ve been trying to deploy awx via ECS Fargate recently and am running into deployment issues. What I’ve done is build images based on Dockerfiles for:

- awx\_web

- awx\_task

- memcache

- awx\_rabbitmq

that pull the ‘original’ awx images from dockerhub and inject kms encryption environment variables to the containers, which are decrypted with the aws-cli (installed via the dockerfile). These environment variables are given to the underlying container in the launch\_awx.sh and launch\_awx\_task.sh files for their respective containers, and supervisord has access to them. The SECRET\_KEY file is also created and populated with the SECRET\_KEY environment variable from the injected kms secrets, then environment.sh is populated. None of this is done with installer or install.yml playbooks, all containers are deployed individually and the rabbitmq/awx\_web/memcache/awx\_task containers are fed environment variables that point to the ports / db info that they need.

Currently im stuck with this error:

`  
2020-06-10 17:47:58,878 ERROR awx.conf.settings Database settings are not available, using defaults.  
Traceback (most recent call last):  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 217, in ensure\_connection  
self.connect()  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 195, in connect  
self.connection = self.get\_new\_connection(conn\_params)  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/postgresql/base.py”, line 178, in get\_new\_connection  
connection = Database.connect(\*\*conn\_params)  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/psycopg2/ **init**.py”, line 126, in connect  
conn = \_connect(dsn, connection\_factory=connection\_factory, \*\*kwasync)  
psycopg2.OperationalError: could not connect to server: No such file or directory  
Is the server running locally and accepting  
connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/conf/settings.py”, line 76, in \_ctit\_db\_wrapper  
yield  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/conf/settings.py”, line 404, in **getattr**  
value = self.\_get\_local(name)  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/conf/settings.py”, line 347, in \_get\_local  
setting = Setting.objects.filter(key=name, user\_\_isnull=True).order\_by(‘pk’).first()  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 653, in first  
for obj in (self if self.ordered else self.order\_by(‘pk’))[:1]:  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 274, in **iter**  
self.\_fetch\_all()  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 1242, in \_fetch\_all  
self.\_result\_cache = list(self.\_iterable\_class(self))  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py”, line 55, in **iter**  
results = compiler.execute\_sql(chunked\_fetch=self.chunked\_fetch, chunk\_size=self.chunk\_size)  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/compiler.py”, line 1138, in execute\_sql  
cursor = self.connection.cursor()  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 256, in cursor  
return self.\_cursor()  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 233, in \_cursor  
self.ensure\_connection()  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 217, in ensure\_connection  
self.connect()  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/utils.py”, line 89, in **exit**  
raise dj\_exc\_value.with\_traceback(traceback) from exc\_value  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 217, in ensure\_connection  
self.connect()  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/base/base.py”, line 195, in connect  
self.connection = self.get\_new\_connection(conn\_params)  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/postgresql/base.py”, line 178, in get\_new\_connection  
connection = Database.connect(\*\*conn\_params)  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/psycopg2/ **init**.py”, line 126, in connect  
conn = \_connect(dsn, connection\_factory=connection\_factory, \*\*kwasync)  
django.db.utils.OperationalError: could not connect to server: No such file or directory  
Is the server running locally and accepting  
connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?  
`

which has to deal with awx\_web and awx\_task not connecting to the postgresql db, however all of my environment variables are correct and I can see the db running both in rds and when i test locally. Anyone have an idea of what could be going wrong? Not sure why awx.conf.settings says the database settings arent available.

Environment variables that I inject are:

AWX\_ADMIN\_PASSWORD

AWX\_ADMIN\_USER

DATABASE\_HOST

DATABASE\_NAME

DATABASE\_PASSWORD

DATABASE\_PORT

DATABASE\_USER

MEMCACHED\_HOST

MEMCACHED\_PORT

RABBITMQ\_HOST

RABBITMQ\_PASSWORD

RABBITMQ\_PORT

RABBITMQ\_USER

RABBITMQ\_VHOST

SECRET\_KEY

---

<div class="post-metadata">

**Author:** ![Emil\_Safonov](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@Emil\_Safonov](https://forum.ansible.com/u/Emil_Safonov)\
**Post date:** [June 10, 2020, 7:29pm UTC](https://forum.ansible.com/t/awx-via-fargate-fails-to-start-postgresql-errors/33148/2 "2020-06-10T19:29:29Z")

</div>

One more piece of info, the awx\_web and awx\_task containers have the entrypoint launch\_awx.sh and launch\_awx\_task.sh, which launch supervisord with supervisord.conf files. I assumed those two entrypoints would configure awx to use the environment variables I passed to the containers, but it doesnt seem to be doing so.
