Merge pull request #11341 from shanemcd/fix-image-builds

Fix official image builds
This commit is contained in:
Shane McDonald 2021-11-13 14:31:26 +08:00 committed by GitHub
commit aec7ac6ebd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 3 deletions

View File

@ -151,7 +151,7 @@ def manage():
from django.core.management import execute_from_command_line
# enforce the postgres version is equal to 12. if not, then terminate program with exit code of 1
if not MODE == 'development':
if not os.getenv('SKIP_PG_VERSION_CHECK', False) and not MODE == 'development':
if (connection.pg_version // 10000) < 12:
sys.stderr.write("Postgres version 12 is required\n")
sys.exit(1)

View File

@ -9,6 +9,7 @@ import copy
import errno
import sys
import traceback
import socket
# Django Split Settings
from split_settings.tools import optional, include
@ -88,4 +89,8 @@ except IOError:
# The below runs AFTER all of the custom settings are imported.
DATABASES['default'].setdefault('OPTIONS', dict()).setdefault('application_name', f'{CLUSTER_HOST_ID}-{os.getpid()}-{" ".join(sys.argv)}'[:63]) # noqa
CLUSTER_HOST_ID = socket.gethostname()
DATABASES.setdefault('default', dict()).setdefault('OPTIONS', dict()).setdefault(
'application_name', f'{CLUSTER_HOST_ID}-{os.getpid()}-{" ".join(sys.argv)}'[:63]
) # noqa

View File

@ -1,11 +1,14 @@
# AWX settings file
import os
import base64
def get_secret():
if os.path.exists("/etc/tower/SECRET_KEY"):
return open('/etc/tower/SECRET_KEY', 'rb').read().strip()
else:
return base64.encodebytes(os.urandom(32)).decode().rstrip()
ADMINS = ()
@ -44,6 +47,7 @@ LOGGING['handlers']['console'] = {
'()': 'logging.StreamHandler',
'level': 'DEBUG',
'formatter': 'simple',
'filters': ['guid'],
}
LOGGING['loggers']['django.request']['handlers'] = ['console']
@ -62,6 +66,9 @@ LOGGING['handlers']['tower_warnings'] = {'class': 'logging.NullHandler'}
LOGGING['handlers']['rbac_migrations'] = {'class': 'logging.NullHandler'}
LOGGING['handlers']['system_tracking_migrations'] = {'class': 'logging.NullHandler'}
LOGGING['handlers']['management_playbooks'] = {'class': 'logging.NullHandler'}
LOGGING['handlers']['dispatcher'] = {'class': 'logging.NullHandler'}
LOGGING['handlers']['job_lifecycle'] = {'class': 'logging.NullHandler'}
LOGGING['handlers']['wsbroadcast'] = {'class': 'logging.NullHandler'}
DATABASES = {
'default': {

View File

@ -78,7 +78,8 @@ WORKDIR /tmp/src/
RUN make sdist && /var/lib/awx/venv/awx/bin/pip install dist/awx.tar.gz
{% if not headless|bool %}
RUN /var/lib/awx/venv/awx/bin/awx-manage collectstatic --noinput --clear
ADD tools/ansible/roles/dockerfile/files/settings.py /etc/tower/settings.py
RUN SKIP_PG_VERSION_CHECK=yes /var/lib/awx/venv/awx/bin/awx-manage collectstatic --noinput --clear
{% endif %}
{% endif %}