Skip to content

Commit

Permalink
Ca 614 set up huey (#1088)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene authored Nov 29, 2024
2 parents 282df7b + 4cd65d5 commit 8dc4827
Show file tree
Hide file tree
Showing 16 changed files with 228 additions and 44 deletions.
12 changes: 12 additions & 0 deletions backend/ciso_assistant/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def set_ciso_assistant_url(_, __, event_dict):
"allauth.socialaccount",
"allauth.socialaccount.providers.saml",
"allauth.mfa",
"huey.contrib.djhuey",
]

MIDDLEWARE = [
Expand Down Expand Up @@ -224,6 +225,7 @@ def set_ciso_assistant_url(_, __, event_dict):
"MIN_REFRESH_INTERVAL": 60,
}


# Empty outside of debug mode so that allauth middleware does not raise an error
STATIC_URL = ""

Expand Down Expand Up @@ -372,6 +374,16 @@ def set_ciso_assistant_url(_, __, event_dict):
# OTHER SETTINGS
}

HUEY = {
"huey_class": "huey.SqliteHuey", # Huey implementation to use.
"name": "huey-ciso-assistant", # Use db name for huey.
"results": True, # Store return values of tasks.
"store_none": False, # If a task returns None, do not save to results.
"immediate": DEBUG, # If DEBUG=True, run synchronously.
"utc": True, # Use UTC for all times internally.
"filename": "db/huey.sqlite3",
}

# SSO with allauth

ACCOUNT_USER_MODEL_USERNAME_FIELD = None
Expand Down
60 changes: 16 additions & 44 deletions backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ python-magic = "0.4.27"
pytz = "2024.2"
fido2 = "^1.1.3"
humanize = "^4.11.0"
huey = "^2.5.2"

[tool.poetry.group.dev.dependencies]
pytest-django = "4.8.0"
Expand Down
17 changes: 17 additions & 0 deletions docker-compose-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ services:
volumes:
- ./db:/code/db

huey:
container_name: huey
build:
context: ./backend
dockerfile: Dockerfile
restart: always
environment:
- ALLOWED_HOSTS=backend,localhost
- DJANGO_DEBUG=False
volumes:
- ./db:/code/db
entrypoint:
- /bin/sh
- -c
- |
poetry run python manage.py run_huey
frontend:
container_name: frontend
environment:
Expand Down
15 changes: 15 additions & 0 deletions docker-compose-pg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ services:
volumes:
- ./db:/code/db

huey:
container_name: huey
image: ghcr.io/intuitem/ciso-assistant-community/backend:latest
restart: always
environment:
- ALLOWED_HOSTS=backend,localhost
- DJANGO_DEBUG=False
volumes:
- ./db:/code/db
entrypoint:
- /bin/sh
- -c
- |
poetry run python manage.py run_huey
frontend:
container_name: frontend
environment:
Expand Down
15 changes: 15 additions & 0 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ services:
volumes:
- ./db:/code/db

huey:
container_name: huey
image: ghcr.io/intuitem/ciso-assistant-community/backend:latest
restart: always
environment:
- ALLOWED_HOSTS=backend,localhost
- DJANGO_DEBUG=False
volumes:
- ./db:/code/db
entrypoint:
- /bin/sh
- -c
- |
poetry run python manage.py run_huey
frontend:
container_name: frontend
environment:
Expand Down
15 changes: 15 additions & 0 deletions docker-compose-remote-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ services:
volumes:
- ./db:/code/db

huey:
container_name: huey
image: ghcr.io/intuitem/ciso-assistant-community/backend:latest
restart: always
environment:
- ALLOWED_HOSTS=backend,localhost
- DJANGO_DEBUG=False
volumes:
- ./db:/code/db
entrypoint:
- /bin/sh
- -c
- |
poetry run python manage.py run_huey
frontend:
container_name: frontend
environment:
Expand Down
15 changes: 15 additions & 0 deletions docker-compose-remote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ services:
volumes:
- ./db:/code/db

huey:
container_name: huey
image: ghcr.io/intuitem/ciso-assistant-community/backend:latest
restart: always
environment:
- ALLOWED_HOSTS=backend,localhost
- DJANGO_DEBUG=False
volumes:
- ./db:/code/db
entrypoint:
- /bin/sh
- -c
- |
poetry run python manage.py run_huey
frontend:
container_name: frontend
environment:
Expand Down
15 changes: 15 additions & 0 deletions docker-compose-traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ services:
networks:
- front

huey:
container_name: huey
image: ghcr.io/intuitem/ciso-assistant-community/backend:latest
restart: always
environment:
- ALLOWED_HOSTS=backend,localhost
- DJANGO_DEBUG=False
volumes:
- ./db:/code/db
entrypoint:
- /bin/sh
- -c
- |
poetry run python manage.py run_huey
frontend:
container_name: frontend
restart: unless-stopped
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ services:
volumes:
- ./db:/code/db

huey:
container_name: huey
image: ghcr.io/intuitem/ciso-assistant-community/backend:latest
restart: always
environment:
- ALLOWED_HOSTS=backend,localhost
- DJANGO_DEBUG=False
volumes:
- ./db:/code/db
entrypoint:
- /bin/sh
- -c
- |
poetry run python manage.py run_huey
frontend:
container_name: frontend
environment:
Expand Down
17 changes: 17 additions & 0 deletions enterprise/docker-compose-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ services:
volumes:
- ./db:/code/db

huey:
container_name: huey
build:
context: ../
dockerfile: ./enterprise/backend/Dockerfile
restart: always
environment:
- ALLOWED_HOSTS=backend,localhost
- DJANGO_DEBUG=False
volumes:
- ./db:/code/db
entrypoint:
- /bin/sh
- -c
- |
poetry run python manage.py run_huey
frontend:
container_name: frontend
environment:
Expand Down
15 changes: 15 additions & 0 deletions enterprise/docker-compose-pg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ services:
volumes:
- ./db:/code/db

huey:
container_name: huey
image: ghcr.io/intuitem/ciso-assistant-community/backend:latest
restart: always
environment:
- ALLOWED_HOSTS=backend,localhost
- DJANGO_DEBUG=False
volumes:
- ./db:/code/db
entrypoint:
- /bin/sh
- -c
- |
poetry run python manage.py run_huey
frontend:
container_name: frontend
environment:
Expand Down
15 changes: 15 additions & 0 deletions enterprise/docker-compose-remote-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ services:
volumes:
- ./db:/code/db

huey:
container_name: huey
image: ghcr.io/intuitem/ciso-assistant-community/backend:latest
restart: always
environment:
- ALLOWED_HOSTS=backend,localhost
- DJANGO_DEBUG=False
volumes:
- ./db:/code/db
entrypoint:
- /bin/sh
- -c
- |
poetry run python manage.py run_huey
frontend:
container_name: frontend
environment:
Expand Down
Loading

0 comments on commit 8dc4827

Please sign in to comment.