Skip to content

Commit

Permalink
More deployment fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmccully committed Dec 6, 2024
1 parent 882fd89 commit 00c03ee
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ WORKDIR /banzai-floyds-ui/banzai_floyds_ui

RUN python manage.py collectstatic

RUN python manage.py createcachetable

RUN python manage.py makemigrations

RUN python manage.py migrate
Expand Down
36 changes: 24 additions & 12 deletions banzai_floyds_ui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
SECRET_KEY = os.getenv('SECRET_KEY', 'django-insecure-0*$4nwm8zd$jcc*xlwm$2nm_=r6bn5rv@#k7jrta^dy&c*3)(y')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = eval(os.getenv('DEBUG', False))
DEBUG = eval(os.getenv('DEBUG', 'False'))

ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '*').split(',')

Expand All @@ -49,7 +49,8 @@
'bootstrap4',
'django_plotly_dash.apps.DjangoPlotlyDashConfig',
'dpd_static_support',
'fontawesomefree'
'fontawesomefree',
'django_redis'
]

MIDDLEWARE = [
Expand All @@ -66,6 +67,7 @@
]

SESSION_ENGINE = "django.contrib.sessions.backends.cache"
SESSION_CACHE_ALIAS = "default"

ROOT_URLCONF = 'banzai_floyds_ui.gui.urls'

Expand All @@ -90,16 +92,16 @@
if os.environ.get('REDIS_HOST') is None:
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
"LOCATION": "unique-snowflake",
"BACKEND": "django.core.cache.backends.db.DatabaseCache",
"LOCATION": "django_cache_table",
}
}
else:
CACHES = {
'default':
{
'BACKEND': 'django_redis.cache.RedisCache',
"LOCATION": f"redis://{os.environ['REDIS_HOST']}/{os.environ['REDIS_PORT']}",
"LOCATION": f"redis://{os.environ['REDIS_HOST']}:{os.environ['REDIS_PORT']}",
'OPTIONS': {'CLIENT_CLASS': 'django_redis.client.DefaultClient'}
}
}
Expand All @@ -108,14 +110,24 @@
# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
if os.getenv('FLOYDS_UI_DB_HOST') is None:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
else:
DATABASES = {
'default': {
'ENGINE': os.getenv('FLOYDS_UI_DB_ENGINE', 'django.db.backends.postgresql'),
'NAME': os.environ['FLOYDS_UI_DB_NAME'],
'USER': os.environ['FLOYDS_UI_DB_USER'],
'PASSWORD': os.environ['FLOYDS_UI_DB_PASSWORD'],
'HOST': os.environ['FLOYDS_UI_DB_HOST'],
'PORT': os.getenv('FLOYDS_UI_DB_PORT', '5432'),
}
}
}


# Password validation
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators

Expand Down
4 changes: 2 additions & 2 deletions k8s/base/deploy-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ spec:
initialDelaySeconds: 15
timeoutSeconds: 3
httpGet:
path: /status/
path: status
port: http
readinessProbe:
initialDelaySeconds: 15
timeoutSeconds: 3
httpGet:
path: /status/
path: status
port: http
1 change: 1 addition & 0 deletions k8s/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ configMapGenerator:
- REDIS_PORT=6379
- DEBUG=1
- DB_ADDRESS=sqlite:///test.db
- OPENTSDB_PYTHON_METRICS_TEST_MODE=1

0 comments on commit 00c03ee

Please sign in to comment.