Skip to content

Commit

Permalink
Merge 879b307 into fd01c96
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Paz committed Jul 11, 2018
2 parents fd01c96 + 879b307 commit 0e7cd78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions bothub/health/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

CHECK_ACCESSIBLE_API_URL = config(
'CHECK_ACCESSIBLE_API_URL',
default='http://localhost/api/repositories/')
default=None)


def check_database_connection(**kwargs):
Expand All @@ -27,10 +27,16 @@ def check_database_connection(**kwargs):
return True


def check_accessible_api(**kwargs):
def check_accessible_api(request, **kwargs):
import requests
logger.info('requesting {}'.format(CHECK_ACCESSIBLE_API_URL))
response = requests.get(CHECK_ACCESSIBLE_API_URL)
if CHECK_ACCESSIBLE_API_URL:
response = requests.get(CHECK_ACCESSIBLE_API_URL)
else:
url = 'http://{}/api/repositories/'.format(
request.META.get('HTTP_HOST'))
logger.info('requesting to {}'.format(url))
response = requests.get(url)
logger.info('{} response status code {}'.format(
CHECK_ACCESSIBLE_API_URL,
response.status_code))
Expand Down
2 changes: 1 addition & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ python manage.py collectstatic --noinput

GUNICORN_LOG_FILE="/var/log/gunicorn.log"
touch ${GUNICORN_LOG_FILE}
gunicorn bothub.wsgi -c docker/gunicorn.conf.py --log-file ${GUNICORN_LOG_FILE} --log-level debug
gunicorn bothub.wsgi -c docker/gunicorn.conf.py --log-file ${GUNICORN_LOG_FILE} --log-level debug --capture-output

mkdir -p /run/nginx/
nginx
Expand Down

0 comments on commit 0e7cd78

Please sign in to comment.