From efd30e9a28273e1b20b9f58f323bc000221102f2 Mon Sep 17 00:00:00 2001 From: kirby Date: Tue, 14 Jan 2025 11:51:45 +0100 Subject: [PATCH] update --- Dockerfile | 12 ++-- README.md | 72 ------------------- app/dashboard/fixtures/os.yaml | 14 ++++ .../templates/registration/login.html | 2 +- app/dashboard/templates/squeleton.html | 2 +- app/dashboard/urls.py | 2 +- app/results/2022-08-17.csv | 3 +- app/updatesdashboard/.env.dev | 8 +-- app/updatesdashboard/settings.py | 7 +- docker-compose.yml | 26 ++----- docker/nginx/updatesdashboard.conf | 25 +++++++ docker/scripts/entrypoint.dev.sh | 2 +- docker/scripts/entrypoint.prod.sh | 9 ++- 13 files changed, 69 insertions(+), 115 deletions(-) delete mode 100644 README.md create mode 100644 docker/nginx/updatesdashboard.conf diff --git a/Dockerfile b/Dockerfile index 8281ccb..e9f3c7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ### DEV ENV ### -FROM python:3.9.16-slim-bullseye AS app_dev +FROM python:3.13.1-slim-bookworm AS app_dev ARG APP_UID=1000 ARG APP_GID=1000 @@ -9,20 +9,20 @@ ENV PYTHONUNBUFFERED 1 WORKDIR /app/ -RUN apt update && apt install -y procps less netcat libmariadb-dev-compat libmariadb-dev mariadb-client gcc nginx-light +RUN apt update && apt install -y procps less netcat-traditional libmariadb-dev-compat libmariadb-dev mariadb-client gcc nginx-light pkg-config -COPY ./docker/nginx/dev.conf /etc/nginx/sites-enabled/updatesdashboard.conf +COPY ./docker/nginx/updatesdashboard.conf /etc/nginx/sites-enabled/updatesdashboard.conf RUN rm -f /etc/nginx/sites-enabled/default -COPY ./docker/scripts/entrypoint.dev.sh /usr/local/bin/entrypoint -RUN chmod +x /usr/local/bin/entrypoint - RUN addgroup --system gunicorn --gid ${APP_GID} && adduser --uid ${APP_UID} --system --disabled-login --group gunicorn RUN pip install --upgrade pip COPY ./app/requirements.txt . RUN pip install -r requirements.txt +COPY ./docker/scripts/entrypoint.dev.sh /usr/local/bin/entrypoint +RUN chmod +x /usr/local/bin/entrypoint + COPY ./app/ . COPY ./app/updatesdashboard/.env.dev ./updatesdashboard/.env diff --git a/README.md b/README.md deleted file mode 100644 index e6d00b7..0000000 --- a/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# Updates Dashboard - -## Summary - -This is a tool to have a clear view of the which servers are outdated, and keep trace of the updates. - -## Technical information - -It runs with Django. The information are daily generated by an ansible playbook, which is not located in this repo (infrastructure/updates-dashboard-ansible). - -## Install - -### Run with docker - -``` -docker-compose up -``` - -### On-premise - -Dependencies in case of Debian 10. -``` - apt install python3-venv libmariadb-dev-compat libmariadb-dev mariadb-client python3-dev gcc -``` -Following procedure to install the apps. -``` - useradd -d /var/www/updates-dashboard/ -g www-data -M -s /bin/false www-updash - cd /var/www/ - git clone updates-dashboard - chown -R www-updash:www-data updates-dashboard - touch /var/log/gunicorn.log - chown www-updash:www-data /var/log/gunicorn.log - cd updates-dashboard - python3 -m venv updash-venv - source updash-venv/bin/activate - (updash-venv) pip install -r requirements.txt - mkdir results results-packages - cp defaults/settings_local.py updatesdashboard/ - cp defaults/gunicorn.service /etc/systemd/system/ - cp defaults/updates-dashboard.conf /etc/nginx/sites-available - cd /etc/nginx/sites-enabled - ln -s /etc/nginx/sites-avaiable/updates-dashboard.conf . -``` -* Set `settings_local.py` with correct values -* Set `gunicorn.service` with correct values -* Set `updates-dashboard.conf` with correct values -```shell - systemctl daemon-reload - systemctl enable gunicorn.service - nginx -t - systemctl reload nginx -``` -To initialize the project: -```shell - (updash-venv) ./manage.py makemigrations - (updash-venv) ./manage.py makemigrations dashboard - (updash-venv) ./manage.py collectstatic - (updash-venv) ./manage.py migrate - (updash-venv) ./manage.py loaddata dashboard/fixtures/os.yaml - (updash-venv) ./manage.py loaddata dashboard/fixtures/teams.yaml -``` -Vérifier les flux de mise à jour des données. Ansible->Dashboard -Vérifier le sql mode de la base de données -```shell -set @@global.sql_mode='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; -``` - -## TODO - -* playbook to install via ansible ? -* playbook to update via ansible ? -* buttons should be 'previous / next results' instead of 'previous / next day' diff --git a/app/dashboard/fixtures/os.yaml b/app/dashboard/fixtures/os.yaml index 084ec21..238a965 100644 --- a/app/dashboard/fixtures/os.yaml +++ b/app/dashboard/fixtures/os.yaml @@ -72,6 +72,13 @@ version: '11', end_of_support: 2026-06-30 } +- model: dashboard.os + pk: null + fields: { + distribution: Debian, + version: '12', + end_of_support: 2028-06-30 + } # Ubuntu Server - model: dashboard.os @@ -207,6 +214,13 @@ version: '22.04', end_of_support: 2027-04-01 } +- model: dashboard.os + pk: null + fields: { + distribution: Ubuntu, + version: '24.04', + end_of_support: 2029-04-01 + } # CentOS - model: dashboard.os diff --git a/app/dashboard/templates/registration/login.html b/app/dashboard/templates/registration/login.html index 9337822..7dd7289 100644 --- a/app/dashboard/templates/registration/login.html +++ b/app/dashboard/templates/registration/login.html @@ -26,7 +26,7 @@