From 010f9fc7641c85f19445df706e3672a19b882207 Mon Sep 17 00:00:00 2001 From: DavidVadnais Date: Sat, 18 Jan 2025 02:51:15 +0000 Subject: [PATCH 01/18] temp fix for titles not updating --- helpdesk/update_ticket.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/helpdesk/update_ticket.py b/helpdesk/update_ticket.py index 8577472b..6657df43 100644 --- a/helpdesk/update_ticket.py +++ b/helpdesk/update_ticket.py @@ -268,6 +268,9 @@ def update_ticket( files = process_attachments(f, files) if files else [] + if not ticket_title and title: + ticket_title = title + if ticket_title and ticket_title != ticket.title: c = f.ticketchange_set.create( field=_('Title'), From 9cbe8ebcfac2b29b549d4b69f4f5e348ee3bdf1a Mon Sep 17 00:00:00 2001 From: DavidVadnais Date: Tue, 21 Jan 2025 18:38:27 +0000 Subject: [PATCH 02/18] Revert "temp fix for titles not updating" This reverts commit 010f9fc7641c85f19445df706e3672a19b882207. --- helpdesk/update_ticket.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/helpdesk/update_ticket.py b/helpdesk/update_ticket.py index 6657df43..8577472b 100644 --- a/helpdesk/update_ticket.py +++ b/helpdesk/update_ticket.py @@ -268,9 +268,6 @@ def update_ticket( files = process_attachments(f, files) if files else [] - if not ticket_title and title: - ticket_title = title - if ticket_title and ticket_title != ticket.title: c = f.ticketchange_set.create( field=_('Title'), From 6f3549eb5a78c1af9afc4ea892403bd6104826af Mon Sep 17 00:00:00 2001 From: DavidVadnais Date: Tue, 21 Jan 2025 18:49:06 +0000 Subject: [PATCH 03/18] Remove ticket_title in favor of title --- helpdesk/update_ticket.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/helpdesk/update_ticket.py b/helpdesk/update_ticket.py index 8577472b..51ac7d19 100644 --- a/helpdesk/update_ticket.py +++ b/helpdesk/update_ticket.py @@ -198,7 +198,6 @@ def update_ticket( files=None, public=False, owner=-1, - ticket_title=None, priority=-1, queue=-1, new_status=None, @@ -268,13 +267,13 @@ def update_ticket( files = process_attachments(f, files) if files else [] - if ticket_title and ticket_title != ticket.title: + if title and title != ticket.title: c = f.ticketchange_set.create( field=_('Title'), old_value=ticket.title, - new_value=ticket_title, + new_value=title, ) - ticket.title = ticket_title + ticket.title = title if new_status != old_status: c = f.ticketchange_set.create( From 92513f4f3e56b5d19a10e728b9fa673771abdfd6 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Mon, 3 Jun 2024 17:20:14 +0200 Subject: [PATCH 04/18] Add ci workflow for building standalone docker image --- .../build-standalone-docker-image.yml | 30 +++++++++++++++++++ docs/standalone.rst | 4 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-standalone-docker-image.yml diff --git a/.github/workflows/build-standalone-docker-image.yml b/.github/workflows/build-standalone-docker-image.yml new file mode 100644 index 00000000..68d88498 --- /dev/null +++ b/.github/workflows/build-standalone-docker-image.yml @@ -0,0 +1,30 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log in to Docker Hub + run: echo '${{ secrets.DOCKER_HUB_PASS }}' | docker login -u djangohelpdesk --password-stdin + + - name: Build Docker image + run: cd standalone ; docker build -t djangohelpdesk/standalone:latest .. + + - name: Push Docker image + run: docker push djangohelpdesk/standalone:latest + + - name: Tag and push Docker image with year, month and Git SHA + run: docker tag djangohelpdesk/standalone:latest djangohelpdesk/standalone:$(date +%Y-%m)-$(git rev-parse --short HEAD) ; docker push djangohelpdesk/standalone:$(date +%Y-%m)-$(git rev-parse --short HEAD) + + - name: If we are at a tag, add a tag to the current docker image push the image with the tag + if: startsWith(github.ref, 'refs/tags/') + run: docker tag djangohelpdesk/standalone:latest djangohelpdesk/standalone:${{ github.ref }} ; docker push djangohelpdesk/standalone:${{ github.ref }} diff --git a/docs/standalone.rst b/docs/standalone.rst index 3d1e14b8..85ab6fbd 100644 --- a/docs/standalone.rst +++ b/docs/standalone.rst @@ -1,7 +1,9 @@ Django-Helpdesk Standalone Installation ======================================= -Installation +You can find standalone docker images at `djangohelpdesk/standalone:latest `_. + +Installation using docker-compose ------------ 1. Clone the django-helpdesk repository: From ff3df683ad14cbb7a3f8e5f1e4e57bc65ddd0e58 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Tue, 16 Jul 2024 13:49:43 +0200 Subject: [PATCH 05/18] Update structure of installation docs --- docs/index.rst | 1 + docs/install.rst | 2 +- docs/standalone.rst | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 7f1ffe04..1b5fe292 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,6 +10,7 @@ Contents :maxdepth: 2 :glob: + standalone install upgrade configuration diff --git a/docs/install.rst b/docs/install.rst index f486defc..c28fefaf 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -1,4 +1,4 @@ -Installation +Installation/integration into an existing Django application ============ .. note:: diff --git a/docs/standalone.rst b/docs/standalone.rst index 85ab6fbd..cee28582 100644 --- a/docs/standalone.rst +++ b/docs/standalone.rst @@ -1,4 +1,4 @@ -Django-Helpdesk Standalone Installation +Standalone Installation ======================================= You can find standalone docker images at `djangohelpdesk/standalone:latest `_. From 325eaa6318099fcf261c59990140a512ebd62a42 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Sun, 21 Jul 2024 21:12:54 +0200 Subject: [PATCH 06/18] Improving standalone standalone-ness --- standalone/.dockerignore | 1 + standalone/Caddyfile | 2 +- standalone/Dockerfile | 4 ++-- standalone/docker-compose-dev.yml | 30 ++++++++++++++++++++++++++++++ standalone/docker-compose.yml | 4 +--- standalone/extra-requirements.txt | 3 --- standalone/requirements.txt | 3 +++ 7 files changed, 38 insertions(+), 9 deletions(-) create mode 100755 standalone/.dockerignore create mode 100644 standalone/docker-compose-dev.yml create mode 100644 standalone/requirements.txt diff --git a/standalone/.dockerignore b/standalone/.dockerignore new file mode 100755 index 00000000..19e01807 --- /dev/null +++ b/standalone/.dockerignore @@ -0,0 +1 @@ +db/ diff --git a/standalone/Caddyfile b/standalone/Caddyfile index 87a1008e..7e8ae74f 100644 --- a/standalone/Caddyfile +++ b/standalone/Caddyfile @@ -1,3 +1,3 @@ localhost { - reverse_proxy django-helpdesk:8000 + reverse_proxy django-helpdesk:8080 } diff --git a/standalone/Dockerfile b/standalone/Dockerfile index 002a5830..89653db9 100644 --- a/standalone/Dockerfile +++ b/standalone/Dockerfile @@ -7,9 +7,9 @@ RUN apt-get install -yqq \ cron \ git COPY requirements.txt /opt/django-helpdesk/requirements.txt -COPY standalone/extra-requirements.txt /opt/django-helpdesk/standalone/extra-requirements.txt +COPY standalone/requirements.txt /opt/django-helpdesk/standalone/requirements.txt RUN pip3 install -r /opt/django-helpdesk/requirements.txt -RUN pip3 install -r /opt/django-helpdesk/standalone/extra-requirements.txt +RUN pip3 install -r /opt/django-helpdesk/standalone/requirements.txt COPY . /opt/django-helpdesk WORKDIR /opt/django-helpdesk RUN pip3 install -e . diff --git a/standalone/docker-compose-dev.yml b/standalone/docker-compose-dev.yml new file mode 100644 index 00000000..5e35f3dd --- /dev/null +++ b/standalone/docker-compose-dev.yml @@ -0,0 +1,30 @@ +version: '2' +services: + caddy: + image: caddy:2 + restart: unless-stopped + volumes: + - /tmp/data/caddy/data:/data + - /tmp/data/caddy/config:/config + - ./Caddyfile:/etc/caddy/Caddyfile:r + ports: + - "80:80" + - "443:443" + + django-helpdesk: + build: + context: .. + dockerfile: standalone/Dockerfile + user: root + volumes: + - /tmp/django-helpdesk-data:/data/ + - ./custom_navigation_header.html:/opt/django-helpdesk/helpdesk/templates/helpdesk/custom_navigation_header.html:r + env_file: docker.env + depends_on: + - postgres + + postgres: + image: postgres:12-bullseye + volumes: + - ./db:/var/lib/postgresql/data + env_file: docker.env diff --git a/standalone/docker-compose.yml b/standalone/docker-compose.yml index 5e35f3dd..2c2d2e4a 100644 --- a/standalone/docker-compose.yml +++ b/standalone/docker-compose.yml @@ -12,9 +12,7 @@ services: - "443:443" django-helpdesk: - build: - context: .. - dockerfile: standalone/Dockerfile + image: djangohelpdesk/standalone user: root volumes: - /tmp/django-helpdesk-data:/data/ diff --git a/standalone/extra-requirements.txt b/standalone/extra-requirements.txt index a4961749..e69de29b 100644 --- a/standalone/extra-requirements.txt +++ b/standalone/extra-requirements.txt @@ -1,3 +0,0 @@ -whitenoise -gunicorn -psycopg2-binary diff --git a/standalone/requirements.txt b/standalone/requirements.txt new file mode 100644 index 00000000..a4961749 --- /dev/null +++ b/standalone/requirements.txt @@ -0,0 +1,3 @@ +whitenoise +gunicorn +psycopg2-binary From e12459bd3f47c1550259375ad7ba7be3b1a581b0 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Sun, 21 Jul 2024 21:42:03 +0200 Subject: [PATCH 07/18] Remove insecure development Dockerfile in favor of "standalone" Dockerfile --- Dockerfile | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 55ab90ff..00000000 --- a/Dockerfile +++ /dev/null @@ -1,46 +0,0 @@ -ARG PYTHON_VERSION=3.11.5-slim-bookworm - -# define an alias for the specfic python version used in this file. -FROM python:${PYTHON_VERSION} as python - -FROM python as python-build-stage - -# Install apt packages -RUN apt-get update && apt-get install --no-install-recommends -y \ - # dependencies for building Python packages - build-essential - -# Requirements are installed here to ensure they will be cached. -COPY ./requirements.txt ./requirements-dev.txt / - -# Create Python Dependency and Sub-Dependency Wheels -RUN pip install packaging -RUN pip wheel --wheel-dir /usr/src/app/wheels \ - -r requirements.txt \ - -r requirements-dev.txt - -FROM python as python-run-stage - -ARG APP_HOME=/app - -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 - -WORKDIR ${APP_HOME} - -COPY --from=python-build-stage /usr/src/app/wheels /wheels/ - -# use wheels to install python dependencies -RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \ - && rm -rf /wheels/ - -COPY ./entrypoint /entrypoint -RUN sed -i 's/\r$//g' /entrypoint && chmod +x /entrypoint - -FROM python-run-stage AS backend - -# copy application code to WORKDIR -COPY . ${APP_HOME} - -ENTRYPOINT ["/entrypoint"] -CMD ["python3", "demo/manage.py", "runserver", "--noreload", "0.0.0.0:8080"] From c0c0f2be5ddcfed0d214321c33751a39b322c856 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Sun, 21 Jul 2024 21:46:34 +0200 Subject: [PATCH 08/18] Fix docker build invocation --- .github/workflows/build-standalone-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-standalone-docker-image.yml b/.github/workflows/build-standalone-docker-image.yml index 68d88498..d9654574 100644 --- a/.github/workflows/build-standalone-docker-image.yml +++ b/.github/workflows/build-standalone-docker-image.yml @@ -17,7 +17,7 @@ jobs: run: echo '${{ secrets.DOCKER_HUB_PASS }}' | docker login -u djangohelpdesk --password-stdin - name: Build Docker image - run: cd standalone ; docker build -t djangohelpdesk/standalone:latest .. + run: docker build --file standalone/Dockerfile -t djangohelpdesk/standalone:latest .. - name: Push Docker image run: docker push djangohelpdesk/standalone:latest From a2b50919c20bf229b9b6efa4a1b2782cda088e95 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Sun, 21 Jul 2024 21:54:44 +0200 Subject: [PATCH 09/18] Try copying full source tree before installing requirements --- .dockerignore | 1 + standalone/Dockerfile | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100755 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100755 index 00000000..19e01807 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +db/ diff --git a/standalone/Dockerfile b/standalone/Dockerfile index 89653db9..0d94db43 100644 --- a/standalone/Dockerfile +++ b/standalone/Dockerfile @@ -6,11 +6,9 @@ RUN apt-get install -yqq \ postgresql-client \ cron \ git -COPY requirements.txt /opt/django-helpdesk/requirements.txt -COPY standalone/requirements.txt /opt/django-helpdesk/standalone/requirements.txt +COPY . /opt/ RUN pip3 install -r /opt/django-helpdesk/requirements.txt RUN pip3 install -r /opt/django-helpdesk/standalone/requirements.txt -COPY . /opt/django-helpdesk WORKDIR /opt/django-helpdesk RUN pip3 install -e . RUN DJANGO_HELPDESK_SECRET_KEY=foo python3 standalone/manage.py collectstatic From 1c5cc13f8699cf24314330d1c2972ca1d6be8563 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Mon, 22 Jul 2024 02:30:07 +0200 Subject: [PATCH 10/18] Add extras docker image --- .github/workflows/build-standalone-docker-image.yml | 9 +++++++++ standalone/Dockerfile.extras | 2 ++ standalone/extra-requirements.txt | 0 standalone/requirements-extras.txt | 4 ++++ 4 files changed, 15 insertions(+) create mode 100644 standalone/Dockerfile.extras delete mode 100644 standalone/extra-requirements.txt create mode 100644 standalone/requirements-extras.txt diff --git a/.github/workflows/build-standalone-docker-image.yml b/.github/workflows/build-standalone-docker-image.yml index d9654574..6dbaec31 100644 --- a/.github/workflows/build-standalone-docker-image.yml +++ b/.github/workflows/build-standalone-docker-image.yml @@ -19,12 +19,21 @@ jobs: - name: Build Docker image run: docker build --file standalone/Dockerfile -t djangohelpdesk/standalone:latest .. + - name: Build extras Docker image + run: docker build --file standalone/Dockerfile.extras -t djangohelpdesk/standalone-extras:latest .. + - name: Push Docker image run: docker push djangohelpdesk/standalone:latest + - name: Push extras Docker image + run: docker push djangohelpdesk/standalone-extras:latest + - name: Tag and push Docker image with year, month and Git SHA run: docker tag djangohelpdesk/standalone:latest djangohelpdesk/standalone:$(date +%Y-%m)-$(git rev-parse --short HEAD) ; docker push djangohelpdesk/standalone:$(date +%Y-%m)-$(git rev-parse --short HEAD) + - name: Tag and push extras Docker image with year, month and Git SHA + run: docker tag djangohelpdesk/standalone-extras:latest djangohelpdesk/standalone-extras:$(date +%Y-%m)-$(git rev-parse --short HEAD) ; docker push djangohelpdesk/standalone-extras:$(date +%Y-%m)-$(git rev-parse --short HEAD) + - name: If we are at a tag, add a tag to the current docker image push the image with the tag if: startsWith(github.ref, 'refs/tags/') run: docker tag djangohelpdesk/standalone:latest djangohelpdesk/standalone:${{ github.ref }} ; docker push djangohelpdesk/standalone:${{ github.ref }} diff --git a/standalone/Dockerfile.extras b/standalone/Dockerfile.extras new file mode 100644 index 00000000..67b050d3 --- /dev/null +++ b/standalone/Dockerfile.extras @@ -0,0 +1,2 @@ +FROM djangohelpdesk/standalone +RUN pip3 install -r /opt/django-helpdesk/requirements-extras.txt \ No newline at end of file diff --git a/standalone/extra-requirements.txt b/standalone/extra-requirements.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/standalone/requirements-extras.txt b/standalone/requirements-extras.txt new file mode 100644 index 00000000..d3d06990 --- /dev/null +++ b/standalone/requirements-extras.txt @@ -0,0 +1,4 @@ +django-ses +django-storages +boto3 +git+https://github.com/KristobalJunta/django-keycloak.git@1c3b555335e5a95f1bf1281f19ed082d96032f80 From 5ad7e2ed00ab204e6c9949ff42577ffc908bfbbf Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Mon, 22 Jul 2024 02:31:25 +0200 Subject: [PATCH 11/18] Revert incorrect changes to Caddyfile --- standalone/Caddyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standalone/Caddyfile b/standalone/Caddyfile index 7e8ae74f..87a1008e 100644 --- a/standalone/Caddyfile +++ b/standalone/Caddyfile @@ -1,3 +1,3 @@ localhost { - reverse_proxy django-helpdesk:8080 + reverse_proxy django-helpdesk:8000 } From 817cf75fd702c6beda652fdab7e03236873ab84e Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Mon, 22 Jul 2024 02:33:43 +0200 Subject: [PATCH 12/18] Fix path to extras requirements --- standalone/Dockerfile.extras | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standalone/Dockerfile.extras b/standalone/Dockerfile.extras index 67b050d3..861ec54c 100644 --- a/standalone/Dockerfile.extras +++ b/standalone/Dockerfile.extras @@ -1,2 +1,2 @@ FROM djangohelpdesk/standalone -RUN pip3 install -r /opt/django-helpdesk/requirements-extras.txt \ No newline at end of file +RUN pip3 install -r /opt/django-helpdesk/standalone/requirements-extras.txt \ No newline at end of file From 65b07e286391a6b6ca3bf1748b580a5885dad681 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Mon, 22 Jul 2024 02:40:06 +0200 Subject: [PATCH 13/18] Upgrade standalone python version --- standalone/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standalone/Dockerfile b/standalone/Dockerfile index 0d94db43..d67bb73d 100644 --- a/standalone/Dockerfile +++ b/standalone/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-slim-bullseye +FROM python:3.11-slim-bullseye LABEL src=https://github.com/django-helpdesk/django-helpdesk RUN apt-get update RUN apt-get install -yqq \ From e005db75210c90377220585fa0c0ebff3fce5a55 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Mon, 22 Jul 2024 10:10:39 +0200 Subject: [PATCH 14/18] Make dev docker-compose more useable --- standalone/docker-compose-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standalone/docker-compose-dev.yml b/standalone/docker-compose-dev.yml index 5e35f3dd..a42ae12a 100644 --- a/standalone/docker-compose-dev.yml +++ b/standalone/docker-compose-dev.yml @@ -18,7 +18,7 @@ services: user: root volumes: - /tmp/django-helpdesk-data:/data/ - - ./custom_navigation_header.html:/opt/django-helpdesk/helpdesk/templates/helpdesk/custom_navigation_header.html:r + - ../:/opt/django-helpdesk env_file: docker.env depends_on: - postgres From 76a4319ed50b430fb2936940484bfa3e945d8b13 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Mon, 22 Jul 2024 11:11:40 +0200 Subject: [PATCH 15/18] Remove deprecated entrypoint --- entrypoint | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 entrypoint diff --git a/entrypoint b/entrypoint deleted file mode 100644 index 28007576..00000000 --- a/entrypoint +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail -set -o nounset - -pip3 install -e . --user || pip3 install -e . -pip3 install -e demo --user || pip3 install -e demo -python3 demo/manage.py migrate --noinput - -if [ ! -e "/app/demo/demodesk/db.sqlite3" ]; then - DJANGO_SUPERUSER_PASSWORD=Test1234 python3 demo/manage.py createsuperuser --username admin --email helpdesk@example.com --noinput - # Install fixtures - python3 demo/manage.py loaddata emailtemplate.json - python3 demo/manage.py loaddata demo.json -fi - -exec "$@" From b8f4ba6d7918a58ae28983766093e5455c105b58 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Tue, 10 Sep 2024 15:22:56 +0200 Subject: [PATCH 16/18] Update standalone docs --- docs/standalone.rst | 20 +++++++------------- standalone/README.md | 2 ++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/docs/standalone.rst b/docs/standalone.rst index cee28582..fa8f22b2 100644 --- a/docs/standalone.rst +++ b/docs/standalone.rst @@ -3,6 +3,8 @@ Standalone Installation You can find standalone docker images at `djangohelpdesk/standalone:latest `_. +You will also find an alternative `standalone-extras `_ image with extra libraries needed to use the standalone image on cloud platforms such as AWS. You can find a full list of extra packages included in the extra's image `here `_. + Installation using docker-compose ------------ @@ -30,6 +32,7 @@ Installation using docker-compose docker-compose up + Creating an Admin User ---------------------- @@ -86,6 +89,8 @@ Configuration for Production Use AWS SES Email Configuration --------------------------- +You will need to use the standalone-extras image for SES support. + An example `local_settings` configuration for utilizing AWS SES for email: .. code-block:: python @@ -101,18 +106,14 @@ An example `local_settings` configuration for utilizing AWS SES for email: AWS_SES_REGION_ENDPOINT = "email.eu-west-1.amazonaws.com" AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY") -To integrate `django-ses`, bindmount a file to `/opt/extra-dependencies.txt` containing: - -.. code-block:: text - - django-ses - Make sure you update the `docker.env` file with the necessary secrets. S3 base attachment support --------------------------- +You will need to use the standalone-extras image for S3 support. + Working from the previous SES example we add the following to `local_settings`: .. code-block:: python @@ -126,10 +127,3 @@ Working from the previous SES example we add the following to `local_settings`: AWS_DEFAULT_ACL = "private" DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" - -To integrate `django-ses`, bindmount a file to `/opt/extra-dependencies.txt` containing: - -.. code-block:: text - - django-storages - boto3 diff --git a/standalone/README.md b/standalone/README.md index 7b68fbe7..3421ea75 100644 --- a/standalone/README.md +++ b/standalone/README.md @@ -5,3 +5,5 @@ This is a standalone installation of Django-helpdesk allowing you to run django- For installation instructions see [the documentation](../docs/standalone.rst) +For development and testing purposes, the `docker-compose-dev.yml` file will build the standalone docker images from source. + From abe22b6dda9d99e8327b675a21a5503128ad10ac Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Tue, 21 Jan 2025 20:24:35 +0100 Subject: [PATCH 17/18] Use proper docker volumes in docker compose --- docs/standalone.rst | 6 ++-- standalone/docker-compose.yml | 56 ++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/docs/standalone.rst b/docs/standalone.rst index fa8f22b2..6b56a037 100644 --- a/docs/standalone.rst +++ b/docs/standalone.rst @@ -67,11 +67,9 @@ Configuration for Production Use 1. Update the `Caddyfile` to replace the `localhost` URL with your desired production URL. -2. Modify the `docker-compose` file to adjust the paths. By default, files are stored in `/tmp`. +2. For custom configurations, bindmount a `local_settings.py` into `/opt/django-helpdesk/standalone/config/local_settings.py`. -3. For custom configurations, bindmount a `local_settings.py` into `/opt/django-helpdesk/standalone/config/local_settings.py`. - -4. To customize the logo in the top-left corner of the helpdesk: +3. To customize the logo in the top-left corner of the helpdesk: .. code-block:: html diff --git a/standalone/docker-compose.yml b/standalone/docker-compose.yml index 2c2d2e4a..d797cc7c 100644 --- a/standalone/docker-compose.yml +++ b/standalone/docker-compose.yml @@ -1,28 +1,36 @@ version: '2' + +# Define named volumes +volumes: + caddy_data: + caddy_config: + helpdesk_data: + postgres_data: + services: - caddy: - image: caddy:2 - restart: unless-stopped - volumes: - - /tmp/data/caddy/data:/data - - /tmp/data/caddy/config:/config - - ./Caddyfile:/etc/caddy/Caddyfile:r - ports: - - "80:80" - - "443:443" + caddy: + image: caddy:2 + restart: unless-stopped + volumes: + - caddy_data:/data + - caddy_config:/config + - ./Caddyfile:/etc/caddy/Caddyfile:ro + ports: + - "80:80" + - "443:443" - django-helpdesk: - image: djangohelpdesk/standalone - user: root - volumes: - - /tmp/django-helpdesk-data:/data/ - - ./custom_navigation_header.html:/opt/django-helpdesk/helpdesk/templates/helpdesk/custom_navigation_header.html:r - env_file: docker.env - depends_on: - - postgres + django-helpdesk: + image: djangohelpdesk/standalone + user: root + volumes: + - helpdesk_data:/data + - ./custom_navigation_header.html:/opt/django-helpdesk/helpdesk/templates/helpdesk/custom_navigation_header.html:ro + env_file: docker.env + depends_on: + - postgres - postgres: - image: postgres:12-bullseye - volumes: - - ./db:/var/lib/postgresql/data - env_file: docker.env + postgres: + image: postgres:12-bullseye + volumes: + - postgres_data:/var/lib/postgresql/data + env_file: docker.env From 32b577c1fff38e2dd7446be4600d913c284d8138 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Tue, 21 Jan 2025 20:31:48 +0100 Subject: [PATCH 18/18] Document env vars --- docs/standalone.rst | 58 +++++++++++++++++++++++++++++++++++ standalone/config/settings.py | 1 - 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/docs/standalone.rst b/docs/standalone.rst index 6b56a037..4d3a3318 100644 --- a/docs/standalone.rst +++ b/docs/standalone.rst @@ -84,6 +84,64 @@ Configuration for Production Use } +# Environment Variables Reference + +## Database Configuration +| Variable | Default | Description | +|----------|---------|-------------| +| ```POSTGRES_DB``` | ```postgres``` | Database name | +| ```POSTGRES_USER``` | ```postgres``` | Database user | +| ```POSTGRES_PASSWORD``` | ```postgres``` | Database password | +| ```POSTGRES_HOST``` | ```postgres``` | Database host | +| ```POSTGRES_PORT``` | ```5432``` | Database port | + +## Email Configuration +| Variable | Default | Description | +|----------|---------|-------------| +| ```DEFAULT_FROM_EMAIL``` | ```example@example.com``` | Default sender email address | +| ```SERVER_EMAIL``` | ```example@example.com``` | Server email address | +| ```EMAIL_HOST``` | *Required* | SMTP server host | +| ```EMAIL_PORT``` | *Required* | SMTP server port | + +## Static Files +| Variable | Default | Description | +|----------|---------|-------------| +| ```DJANGO_HELPDESK_STATIC_ROOT``` | ```./static``` | Static files root directory | +| ```DJANGO_HELPDESK_STATIC_URL``` | ```/static/``` | Static files URL prefix | + +## Security Settings +| Variable | Default | Description | +|----------|---------|-------------| +| ```DJANGO_HELPDESK_SECRET_KEY``` | *Required* | Django secret key | +| ```DJANGO_HELPDESK_ALLOWED_HOSTS``` | ```*, localhost, 0.0.0.0``` | Comma-separated list of allowed hosts | + +## Helpdesk Core Settings +| Variable | Default | Description | +|----------|---------|-------------| +| ```HELPDESK_USE_EMAIL_AS_SUBMITTER``` | ```True``` | Use email as ticket submitter | +| ```HELPDESK_EMAIL_ON_TICKET_ASSIGN``` | ```True``` | Send email on ticket assignment | +| ```HELPDESK_EMAIL_ON_TICKET_CHANGE``` | ```True``` | Send email on ticket changes | +| ```HELPDESK_LOGIN_VIEW_TICKETLIST``` | ```True``` | Show ticket list after login | +| ```HELPDESK_PRESET_REPLIES``` | ```True``` | Enable preset replies | +| ```HELPDESK_TICKETS_PER_PAGE``` | ```25``` | Number of tickets per page | + +## Public Portal Settings +| Variable | Default | Description | +|----------|---------|-------------| +| ```HELPDESK_PUBLIC_ENABLED``` | ```True``` | Enable public web portal | +| ```HELPDESK_VIEW_A_TICKET_PUBLIC``` | ```True``` | Allow public ticket viewing | +| ```HELPDESK_SUBMIT_A_TICKET_PUBLIC``` | ```True``` | Allow public ticket submission | +| ```HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT``` | ```False``` | Redirect to login instead of public portal | + +## Feature Toggles +| Variable | Default | Description | +|----------|---------|-------------| +| ```HELPDESK_KB_ENABLED``` | ```True``` | Enable knowledge base | +| ```HELPDESK_TICKETS_TIMELINE_ENABLED``` | ```True``` | Enable ticket timeline | +| ```HELPDESK_SHOW_CHANGE_PASSWORD``` | ```True``` | Allow users to change passwords | + + + AWS SES Email Configuration --------------------------- diff --git a/standalone/config/settings.py b/standalone/config/settings.py index 643caebf..b658baaa 100644 --- a/standalone/config/settings.py +++ b/standalone/config/settings.py @@ -98,7 +98,6 @@ HELPDESK_DEFAULT_SETTINGS = { 'email_on_ticket_assign': os.environ.get('HELPDESK_EMAIL_ON_TICKET_ASSIGN', 'True') == 'True', 'email_on_ticket_change': os.environ.get('HELPDESK_EMAIL_ON_TICKET_CHANGE', 'True') == 'True', 'login_view_ticketlist': os.environ.get('HELPDESK_LOGIN_VIEW_TICKETLIST', 'True') == 'True', - 'email_on_ticket_apichange': os.environ.get('HELPDESK_EMAIL_ON_TICKET_APICHANGE', 'True') == 'True', 'preset_replies': os.environ.get('HELPDESK_PRESET_REPLIES', 'True') == 'True', 'tickets_per_page': os.environ.get('HELPDESK_TICKETS_PER_PAGE', '25'), }