Giter Site home page Giter Site logo

sjkingo / django-ebhealthcheck Goto Github PK

View Code? Open in Web Editor NEW
33.0 33.0 7.0 10 KB

Django app to add an instance's public IP to ALLOWED_HOSTS for Elastic Beanstalk's health check system

License: BSD 2-Clause "Simplified" License

Python 100.00%
django elasticbeanstalk python

django-ebhealthcheck's People

Contributors

omarryhan avatar samkingstoncr avatar sjkingo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

django-ebhealthcheck's Issues

Invalid header X-aws-ec2-metadata-token (invalid return char or leading space in header)

Hey,

Thanks for the awesome work you've put into this lib!
In our CI (Github actions), we're occasionally getting this error when get_ec2_instance_ip() runs.

requests.exceptions.InvalidHeader: Invalid return character or leading space in header: X-aws-ec2-metadata-token

It happens approximately 1 in 4 times everytime our CI runs. Usually when we face this issue, we just manually run the CI in hope of a metadata-token that won't throw this error, but it's getting a bit tedious. Especially that our CI runs more than once a day.

I'll work on a fix and create a PR now.

requests.exceptions.ReadTimeout

this error came up in local development while using the planes wifi

ed_web     | Exception in thread django-main-thread:
ed_web     | Traceback (most recent call last):
ed_web     |   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 466, in _make_request
ed_web     |     six.raise_from(e, None)
ed_web     |   File "<string>", line 3, in raise_from
ed_web     |   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 461, in _make_request
ed_web     |     httplib_response = conn.getresponse()
ed_web     |   File "/usr/local/lib/python3.9/http/client.py", line 1377, in getresponse
ed_web     |     response.begin()
ed_web     |   File "/usr/local/lib/python3.9/http/client.py", line 320, in begin
ed_web     |     version, status, reason = self._read_status()
ed_web     |   File "/usr/local/lib/python3.9/http/client.py", line 281, in _read_status
ed_web     |     line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
ed_web     |   File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
ed_web     |     return self._sock.recv_into(b)
ed_web     | socket.timeout: timed out
ed_web     | 
ed_web     | During handling of the above exception, another exception occurred:
ed_web     | 
ed_web     | Traceback (most recent call last):
ed_web     |   File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 486, in send
ed_web     |     resp = conn.urlopen(
ed_web     |   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 798, in urlopen
ed_web     |     retries = retries.increment(
ed_web     |   File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 550, in increment
ed_web     |     raise six.reraise(type(error), error, _stacktrace)
ed_web     |   File "/usr/local/lib/python3.9/site-packages/urllib3/packages/six.py", line 770, in reraise
ed_web     |     raise value
ed_web     |   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 714, in urlopen
ed_web     |     httplib_response = self._make_request(
ed_web     |   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 468, in _make_request
ed_web     |     self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
ed_web     |   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 357, in _raise_timeout
ed_web     |     raise ReadTimeoutError(
ed_web     | urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='169.254.169.254', port=80): Read timed out. (read timeout=0.1)
ed_web     | 
ed_web     | During handling of the above exception, another exception occurred:
ed_web     | 
ed_web     | Traceback (most recent call last):
ed_web     |   File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
ed_web     |     self.run()
ed_web     |   File "/usr/local/lib/python3.9/threading.py", line 917, in run
ed_web     |     self._target(*self._args, **self._kwargs)
ed_web     |   File "/usr/local/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
ed_web     |     fn(*args, **kwargs)
ed_web     |   File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
ed_web     |     autoreload.raise_last_exception()
ed_web     |   File "/usr/local/lib/python3.9/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
ed_web     |     raise _exception[1]
ed_web     |   File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 394, in execute
ed_web     |     autoreload.check_errors(django.setup)()
ed_web     |   File "/usr/local/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
ed_web     |     fn(*args, **kwargs)
ed_web     |   File "/usr/local/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
ed_web     |     apps.populate(settings.INSTALLED_APPS)
ed_web     |   File "/usr/local/lib/python3.9/site-packages/django/apps/registry.py", line 124, in populate
ed_web     |     app_config.ready()
ed_web     |   File "/usr/local/lib/python3.9/site-packages/ebhealthcheck/apps.py", line 35, in ready
ed_web     |     public_ip = get_ec2_instance_ip()
ed_web     |   File "/usr/local/lib/python3.9/site-packages/ebhealthcheck/apps.py", line 22, in get_ec2_instance_ip
ed_web     |     token = requests.put(metadata_url + "/api/token", timeout=0.1, headers={
ed_web     |   File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 130, in put
ed_web     |     return request("put", url, data=data, **kwargs)
ed_web     |   File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 59, in request
ed_web     |     return session.request(method=method, url=url, **kwargs)
ed_web     |   File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 589, in request
ed_web     |     resp = self.send(prep, **send_kwargs)
ed_web     |   File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 703, in send
ed_web     |     r = adapter.send(request, **kwargs)
ed_web     |   File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 532, in send
ed_web     |     raise ReadTimeout(e, request=request)
ed_web     | requests.exceptions.ReadTimeout: HTTPConnectionPool(host='169.254.169.254', port=80): Read timed out. (read timeout=0.1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.