Running AWX Web and Task on AWS Fargate

,

I have awx running on AWS Fargate, but when I try to create a new project, I receive a 500 error and the error in the logs is "

RuntimeError: No instance found with the current cluster host id"

I think the problem is that I can’t set the hostname of the container when using Fargate.

I was wondering if anyone is running awx on Fargate and can share how they got it to work.

Here’s the whole error:

2019-01-27 00:35:05,193 ERROR django.request Internal Server Error: /api/v2/projects/

Traceback (most recent call last):

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/handlers/exception.py”, line 41, in inner

response = get_response(request)

File “/usr/lib/python2.7/site-packages/awx/wsgi.py”, line 71, in _legacy_get_response

return super(AWXWSGIHandler, self)._legacy_get_response(request)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/handlers/base.py”, line 249, in _legacy_get_response

response = self._get_response(request)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/handlers/base.py”, line 187, in _get_response

response = self.process_exception_by_middleware(e, request)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/handlers/base.py”, line 185, in _get_response

response = wrapped_callback(request, *callback_args, **callback_kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/utils/decorators.py”, line 185, in inner

return func(*args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/views/decorators/csrf.py”, line 58, in wrapped_view

return view_func(*args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/views/generic/base.py”, line 68, in view

return self.dispatch(request, *args, **kwargs)

File “/usr/lib/python2.7/site-packages/awx/api/generics.py”, line 327, in dispatch

return super(APIView, self).dispatch(request, *args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/views.py”, line 494, in dispatch

response = self.handle_exception(exc)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/views.py”, line 454, in handle_exception

self.raise_uncaught_exception(exc)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/views.py”, line 491, in dispatch

response = handler(request, *args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/generics.py”, line 244, in post

return self.create(request, *args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/mixins.py”, line 21, in create

self.perform_create(serializer)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/mixins.py”, line 26, in perform_create

serializer.save()

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/serializers.py”, line 214, in save

self.instance = self.create(validated_data)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/serializers.py”, line 917, in create

instance = ModelClass.objects.create(**validated_data)

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 394, in create

obj.save(force_insert=True, using=self.db)

File “/usr/lib/python2.7/site-packages/awx/main/models/projects.py”, line 354, in save

self.update()

File “/usr/lib/python2.7/site-packages/awx/main/models/unified_jobs.py”, line 307, in update

unified_job = self.create_unified_job()

File “/usr/lib/python2.7/site-packages/awx/main/models/unified_jobs.py”, line 383, in create_unified_job

unified_job.save()

File “/usr/lib/python2.7/site-packages/awx/main/models/unified_jobs.py”, line 838, in save

result = super(UnifiedJob, self).save(*args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/polymorphic/models.py”, line 83, in save

return super(PolymorphicModel, self).save(*args, **kwargs)

File “/usr/lib/python2.7/site-packages/awx/main/models/base.py”, line 198, in save

super(PasswordFieldsModel, self).save(*args, **kwargs)

File “/usr/lib/python2.7/site-packages/awx/main/models/base.py”, line 316, in save

super(PrimordialModel, self).save(*args, **kwargs)

File “/usr/lib/python2.7/site-packages/awx/main/models/base.py”, line 164, in save

super(CreatedModifiedModel, self).save(*args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/base.py”, line 808, in save

force_update=force_update, update_fields=update_fields)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/base.py”, line 848, in save_base

update_fields=update_fields, raw=raw, using=using,

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/dispatch/dispatcher.py”, line 193, in send

for receiver in self._live_receivers(sender)

File “/usr/lib/python2.7/site-packages/awx/main/models/ha.py”, line 338, in on_job_create

instance=Instance.objects.me(),

File “/usr/lib/python2.7/site-packages/awx/main/managers.py”, line 88, in me

raise RuntimeError(“No instance found with the current cluster host id”)

RuntimeError: No instance found with the current cluster host id

2019-01-27 00:35:05,193 ERROR django.request Internal Server Error: /api/v2/projects/

Traceback (most recent call last):

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/handlers/exception.py”, line 41, in inner

response = get_response(request)

File “/usr/lib/python2.7/site-packages/awx/wsgi.py”, line 71, in _legacy_get_response

return super(AWXWSGIHandler, self)._legacy_get_response(request)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/handlers/base.py”, line 249, in _legacy_get_response

response = self._get_response(request)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/handlers/base.py”, line 187, in _get_response

response = self.process_exception_by_middleware(e, request)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/handlers/base.py”, line 185, in _get_response

response = wrapped_callback(request, *callback_args, **callback_kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/utils/decorators.py”, line 185, in inner

return func(*args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/views/decorators/csrf.py”, line 58, in wrapped_view

return view_func(*args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/views/generic/base.py”, line 68, in view

return self.dispatch(request, *args, **kwargs)

File “/usr/lib/python2.7/site-packages/awx/api/generics.py”, line 327, in dispatch

return super(APIView, self).dispatch(request, *args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/views.py”, line 494, in dispatch

response = self.handle_exception(exc)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/views.py”, line 454, in handle_exception

self.raise_uncaught_exception(exc)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/views.py”, line 491, in dispatch

response = handler(request, *args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/generics.py”, line 244, in post

return self.create(request, *args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/mixins.py”, line 21, in create

self.perform_create(serializer)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/mixins.py”, line 26, in perform_create

serializer.save()

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/serializers.py”, line 214, in save

self.instance = self.create(validated_data)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/rest_framework/serializers.py”, line 917, in create

instance = ModelClass.objects.create(**validated_data)

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 394, in create

obj.save(force_insert=True, using=self.db)

File “/usr/lib/python2.7/site-packages/awx/main/models/projects.py”, line 354, in save

self.update()

File “/usr/lib/python2.7/site-packages/awx/main/models/unified_jobs.py”, line 307, in update

unified_job = self.create_unified_job()

File “/usr/lib/python2.7/site-packages/awx/main/models/unified_jobs.py”, line 383, in create_unified_job

unified_job.save()

File “/usr/lib/python2.7/site-packages/awx/main/models/unified_jobs.py”, line 838, in save

result = super(UnifiedJob, self).save(*args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/polymorphic/models.py”, line 83, in save

return super(PolymorphicModel, self).save(*args, **kwargs)

File “/usr/lib/python2.7/site-packages/awx/main/models/base.py”, line 198, in save

super(PasswordFieldsModel, self).save(*args, **kwargs)

File “/usr/lib/python2.7/site-packages/awx/main/models/base.py”, line 316, in save

super(PrimordialModel, self).save(*args, **kwargs)

File “/usr/lib/python2.7/site-packages/awx/main/models/base.py”, line 164, in save

super(CreatedModifiedModel, self).save(*args, **kwargs)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/base.py”, line 808, in save

force_update=force_update, update_fields=update_fields)

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/base.py”, line 848, in save_base

update_fields=update_fields, raw=raw, using=using,

File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/dispatch/dispatcher.py”, line 193, in send

for receiver in self._live_receivers(sender)

File “/usr/lib/python2.7/site-packages/awx/main/models/ha.py”, line 338, in on_job_create

instance=Instance.objects.me(),

File “/usr/lib/python2.7/site-packages/awx/main/managers.py”, line 88, in me

raise RuntimeError(“No instance found with the current cluster host id”)

RuntimeError: No instance found with the current cluster host id