Compare commits
No commits in common. "main" and "dockerisation" have entirely different histories.
main
...
dockerisat
10
Dockerfile
10
Dockerfile
@ -1,5 +1,5 @@
|
||||
### DEV ENV ###
|
||||
FROM python:3.13.1-slim-bookworm AS app_dev
|
||||
FROM python:3.9.16-slim-bullseye 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-traditional libmariadb-dev-compat libmariadb-dev mariadb-client gcc nginx-light pkg-config
|
||||
RUN apt update && apt install -y procps less netcat libmariadb-dev-compat libmariadb-dev mariadb-client gcc nginx-light
|
||||
|
||||
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
|
||||
|
||||
|
||||
72
README.md
Normal file
72
README.md
Normal file
@ -0,0 +1,72 @@
|
||||
# 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 git@gitlab.infolegale.net:infrastructure/updates-dashboard.git 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'
|
||||
@ -72,13 +72,6 @@
|
||||
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
|
||||
@ -214,13 +207,6 @@
|
||||
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
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<!-- Navigation -->
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="{% url 'index' %}">Hyrule - Servers information</a>
|
||||
<a class="navbar-brand" href="{% url 'index' %}">Infolegale - Servers information</a>
|
||||
</div>
|
||||
<div class="nav navbar-right top-nav">
|
||||
<!-- <button class="btn btn-lg btn-danger disabled">Confidential information</button> -->
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
<!-- Navigation -->
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="{% url 'index' %}">Hyrule - Servers Informations</a>
|
||||
<a class="navbar-brand" href="{% url 'index' %}">Infolegale - Servers Informations</a>
|
||||
</div>
|
||||
<div class="nav navbar-right top-nav">
|
||||
<!-- <button class="btn btn-lg btn-danger disabled">Confidential information</button> -->
|
||||
|
||||
@ -8,7 +8,7 @@ from . import views
|
||||
|
||||
urlpatterns = [
|
||||
# home
|
||||
re_path(r'^$',
|
||||
re_path(r'^/?$',
|
||||
views.index,
|
||||
name='index'),
|
||||
|
||||
|
||||
@ -1,9 +1,19 @@
|
||||
server1;Debian;8;0;5
|
||||
server2;Debian;9;0;9
|
||||
server3;Debian;10;0;147
|
||||
server4;Debian;11;0;147
|
||||
server5;Ubuntu;20.04;0;308
|
||||
server6;Ubuntu;22.04;0;147
|
||||
server7;OpenBSD;6.4;3;119
|
||||
server8;Ubuntu;18.04;0;28
|
||||
server9;Debian;12;0;147
|
||||
vlearning-db001-tst.infolegale.net;Debian;10;0;5
|
||||
app-db001-tst.infolegale.net;Debian;10;0;9
|
||||
consults-db001-tst.infolegale.net;Debian;10;0;147
|
||||
vador-db001-tst.infolegale.net;Debian;10;0;147
|
||||
tlearning-db003-tst.infolegale.net;Ubuntu;18.04;0;308
|
||||
transdb-db001-tst.infolegale.net;Debian;10;0;147
|
||||
mysql8-db001-tst.infolegale.net;Debian;11;3;119
|
||||
mongo-db001-tst.infolegale.net;Ubuntu;20.04;0;28
|
||||
orchestrator-mgr001-tst.infolegale.net;Ubuntu;20.04;0;28
|
||||
redis5-db001-tst.infolegale.net;Debian;10;0;326
|
||||
redis-db001-tst.infolegale.net;Ubuntu;18.04;0;326
|
||||
docker-hpv001-tst.infolegale.net;Ubuntu;20.04;0;106
|
||||
docker-hpv002-tst.infolegale.net;Ubuntu;20.04;0;398
|
||||
docker-hpv003-tst.infolegale.net;Ubuntu;20.04;0;125
|
||||
rundeck-sch001-tst.infolegale.net;Debian;10;0;91
|
||||
proxysql-db001-tst.infolegale.net;Ubuntu;20.04;0;475
|
||||
docker-hpv005-tst.infolegale.net;Ubuntu;20.04;0;119
|
||||
docker-hpv004-tst.infolegale.net;Ubuntu;20.04;0;28
|
||||
docker-hpv006-tst.infolegale.net;Ubuntu;20.04;0;309
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
GUNICORN_CMD_ARGS=--bind=127.0.0.1:3001 --workers=3 --timeout=300 --error-logfile=/var/log/gunicorn-error.log
|
||||
GUNICORN_CMD_ARGS=--bind=127.0.0.1:3000 --workers=3 --timeout=300 --error-logfile=/var/log/gunicorn-error.log
|
||||
DJANGO_SUPERUSER_PASSWORD=admin
|
||||
SECRET_KEY=uv88xpv8kb2r6j7rubtnhkps
|
||||
DATABASE_NAME=infra_dashboard
|
||||
DATABASE_USER=infra_dashboard
|
||||
DATABASE_PASSWORD=sebisdown
|
||||
DATABASE_NAME=updates_dashboard
|
||||
DATABASE_USER=updates_dashboard
|
||||
DATABASE_PASSWORD=miengetBatheajOf
|
||||
DATABASE_HOST=mysql
|
||||
DATABASE_PORT=3306
|
||||
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1
|
||||
|
||||
@ -110,10 +110,13 @@ DEBUG_TOOLBAR = True
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/1.10/topics/i18n/
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
TIME_ZONE = 'UTC'
|
||||
USE_I18N = True
|
||||
USE_L10N = True
|
||||
USE_TZ = True
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
version: '0.1'
|
||||
services:
|
||||
web:
|
||||
container_name: updatesdashboard.front
|
||||
@ -5,15 +6,28 @@ services:
|
||||
context: ./
|
||||
target: app_dev
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "3000:3001"
|
||||
volumes:
|
||||
- ./app/:/app/
|
||||
env_file:
|
||||
- ./app/updatesdashboard/.env.dev
|
||||
networks:
|
||||
- infra-dashboard
|
||||
|
||||
- updates-dashboard-network
|
||||
depends_on:
|
||||
- mysql
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: updatesdashboard.mysql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: updates_dashboard
|
||||
MYSQL_USER: updates_dashboard
|
||||
MYSQL_PASSWORD: miengetBatheajOf
|
||||
ports:
|
||||
- "3306:3306"
|
||||
networks:
|
||||
infra-dashboard:
|
||||
name: infra-dashboard_infra-dashboard
|
||||
external: true
|
||||
- updates-dashboard-network
|
||||
networks:
|
||||
updates-dashboard-network:
|
||||
driver: bridge
|
||||
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
server {
|
||||
listen 3001;
|
||||
server_name localhost;
|
||||
|
||||
# css, js…
|
||||
location /static {
|
||||
alias /app/static;
|
||||
}
|
||||
|
||||
if ($request_uri !~ "^/admin.*") {
|
||||
# don't rewrite admin
|
||||
rewrite ^/(.*)/$ /$1 permanent;
|
||||
}
|
||||
|
||||
location / {
|
||||
include proxy_params;
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_connect_timeout 120s;
|
||||
proxy_read_timeout 300s;
|
||||
|
||||
}
|
||||
|
||||
error_log /var/log/updatesdashboard-error.log;
|
||||
access_log /var/log/updatesdashboard-access.log;
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
server {
|
||||
listen 3000;
|
||||
server_name updates-dashboard.hyrule.ovh;
|
||||
listen 3001;
|
||||
server_name updates-dashboard.infolegale.net;
|
||||
|
||||
# css, js…
|
||||
location /static {
|
||||
@ -14,7 +14,7 @@ server {
|
||||
|
||||
location / {
|
||||
include proxy_params;
|
||||
proxy_pass http://127.0.0.1:3001;
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_connect_timeout 120s;
|
||||
proxy_read_timeout 300s;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
until nc -vz $1 $2; do echo "Waiting for MySQL $1:$2..."; sleep 3; done;
|
||||
|
||||
python /app/manage.py migrate
|
||||
python /app/manage.py collectstatic --clear --no-input
|
||||
python /app/manage.py collectstatic
|
||||
python /app/manage.py loaddata /app/dashboard/fixtures/os.yaml
|
||||
python /app/manage.py createsuperuser --noinput --username admin --email test@example.com
|
||||
service nginx start
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
#!/bin/sh
|
||||
until nc -vz $1 $2; do echo "Waiting for MySQL $1:$2..."; sleep 3; done;
|
||||
|
||||
python /app/manage.py migrate
|
||||
python /app/manage.py collectstatic
|
||||
python /app/manage.py loaddata /app/dashboard/fixtures/os.yaml
|
||||
python /app/manage.py createsuperuser --noinput --username admin --email test@example.com
|
||||
service nginx start
|
||||
gunicorn updatesdashboard.wsgi:application
|
||||
#python /app/manage.py flush --no-input
|
||||
#python /app/manage.py migrate
|
||||
#python /app/manage.py loaddata dashboard/fixtures/os.yaml
|
||||
|
||||
exec "$@"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user