Skip to content

Commit

Permalink
Fix argoCD hook issues
Browse files Browse the repository at this point in the history
- Lower docker file size
  • Loading branch information
thenav56 committed Nov 27, 2024
1 parent 462050e commit 24afc6f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ MANIFEST
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
.aider*

# Installer logs
pip-log.txt
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ RUN apt-get update -y \
&& poetry --version \
# Configure to use system instead of virtualenvs
&& poetry config virtualenvs.create false \
&& poetry install --no-root \
&& poetry install --no-root --no-cache --no-interaction \
# Clean-up
&& pip uninstall -y poetry virtualenv-clone virtualenv \
&& apt-get remove -y gcc libc-dev libproj-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /root/.cache/


COPY . /code/
3 changes: 3 additions & 0 deletions helm/templates/argo-hooks/hook-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ spec:
limits:
cpu: {{ default $.Values.api.resources.limits.cpu $hook.limitsCpu }}
memory: {{ default $.Values.api.resources.limits.memory $hook.limitsMemory }}
env:
- name: DJANGO_APP_TYPE
value: hook
envFrom:
- secretRef:
name: {{ template "ifrcgo-alert-hub.secretname" $ }}
Expand Down
2 changes: 1 addition & 1 deletion helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ worker:

argoHooks:
# NOTE: Make sure keys are lowercase
database-migration:
db-migrate:
enabled: true
hook: PostSync
preservehistory: true
Expand Down
24 changes: 11 additions & 13 deletions main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
DJANGO_DEBUG=(bool, False),
DJANGO_SECRET_KEY=str,
DJANGO_TIME_ZONE=(str, 'UTC'),
DJANGO_APP_TYPE=str, # web/worker
DJANGO_APP_TYPE=str, # web/worker/hook
DJANGO_APP_ENVIRONMENT=str, # dev/prod
# App Domain
APP_RELEASE=(str, 'develop'),
Expand Down Expand Up @@ -144,17 +144,17 @@
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'main.middlewares.SentryTransactionMiddleware',
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"corsheaders.middleware.CorsMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"main.middlewares.SentryTransactionMiddleware",
]

AUTHENTICATION_BACKENDS = [
Expand Down Expand Up @@ -259,11 +259,9 @@
# TODO: Use custom config for static files
STATICFILES_DIRS = (str(BASE_DIR.joinpath('static')),)


STATIC_URL = env("DJANGO_STATIC_URL")
MEDIA_URL = env("DJANGO_MEDIA_URL")

# Django storage
STORAGES = {
"default": {
# XXX: This is not recommended for Production, but we don't need persistant storage until now
Expand Down

0 comments on commit 24afc6f

Please sign in to comment.