1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-04 22:40:30 +00:00

Compare commits

...

3 commits

Author SHA1 Message Date
4aa620465a Bump version 2024-09-09 13:45:49 +02:00
bbe1f028ac Update deps 2024-09-09 13:43:05 +02:00
7b482d0cba Update config and log to stdout/stderr 2024-09-09 12:50:59 +02:00
9 changed files with 1323 additions and 931 deletions

View file

@ -1,5 +1,10 @@
# Changelog # Changelog
## 1.0.3
- Log to stdout/stderr instead of a log file. The volume for logs isn't needed anymore.
- Updated dependencies.
## 1.0.2 ## 1.0.2
### Fixes ### Fixes

View file

@ -12,12 +12,11 @@ Assistants have a separate interface to set marks and schedule appointments with
You can deploy AdvLabDB easily using Docker. Take a look at [`compose.yaml`](compose.yaml) as a starting point for usage with `docker compose`. You can deploy AdvLabDB easily using Docker. Take a look at [`compose.yaml`](compose.yaml) as a starting point for usage with `docker compose`.
The container uses two volumes: One volume has to be mounted at `/volumes/data` in the container.
This volume has to contain the two files `settings.ini` and `secrets.ini`:
- One volume has to be mounted at `/volumes/data` in the container. This volume has to contain the two files `settings.ini` and `secrets.ini`: - A template for `settings.ini` can be found at [`deploy/settings_template.ini`](deploy/settings_template.ini). This template will be automatically copied to the data volume as default settings file if a settings file does not already exist.
- A template for `settings.ini` can be found at [`deploy/settings_template.ini`](deploy/settings_template.ini). This template will be automatically copied to the data volume as default settings file if a settings file does not already exist. - The file `secrets.ini` will be generated automatically after the first start of the container if it does not exist.
- The file `secrets.ini` will be generated automatically after the first start of the container if it does not exist.
- The second volume has to be mounted at `/volumes/logs` to store logs.
After configuring a compose file, run the command `sudo docker compose run advlabdb manage.py setup init-db` to initialize the database with a guide. After configuring a compose file, run the command `sudo docker compose run advlabdb manage.py setup init-db` to initialize the database with a guide.
@ -34,7 +33,7 @@ If you don't want to use your own reverse proxy, you can use [`compose.yaml`](co
- Open the file `~/advlabdb/traefik/etc/dynamic`, uncomment ``rule: Host(`SERVER_NAME`)`` and replace `SERVER_NAME` with your domain, `advlabdb.mo8it.com` for example. - Open the file `~/advlabdb/traefik/etc/dynamic`, uncomment ``rule: Host(`SERVER_NAME`)`` and replace `SERVER_NAME` with your domain, `advlabdb.mo8it.com` for example.
- Change the time zone `TZ` in `~/advlabdb/traefik/compose.yaml` if it is not `Europe/Berlin`. Use the command `tzselect` to find out your time zone. - Change the time zone `TZ` in `~/advlabdb/traefik/compose.yaml` if it is not `Europe/Berlin`. Use the command `tzselect` to find out your time zone.
- Now start Traefik by running the command `sudo docker compose up -d` in the directory `~/advlabdb/traefik`. - Now start Traefik by running the command `sudo docker compose up -d` in the directory `~/advlabdb/traefik`.
- Create directories for the data and logs volumes: `mkdir ~/advlabdb/{data,logs}` - Create a directory for the data volume: `mkdir ~/advlabdb/data`
- Change the time zone `TZ` in `~/advlabdb/repo/compose.yaml` if it is not `Europe/Berlin`. - Change the time zone `TZ` in `~/advlabdb/repo/compose.yaml` if it is not `Europe/Berlin`.
- Initialize the database by running `sudo docker compose run advlabdb manage.py setup init-db` in the directory `~/advlabdb/repo` and following the guide. - Initialize the database by running `sudo docker compose run advlabdb manage.py setup init-db` in the directory `~/advlabdb/repo` and following the guide.
- Start AdvLabDB by running the command `sudo docker compose up -d` in the directory `~/advlabdb/repo`. - Start AdvLabDB by running the command `sudo docker compose up -d` in the directory `~/advlabdb/repo`.

View file

@ -8,7 +8,6 @@ services:
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ../data:/volumes/data:Z - ../data:/volumes/data:Z
- ../logs:/volumes/logs:Z
environment: environment:
- TZ=Europe/Berlin - TZ=Europe/Berlin
networks: networks:

View file

@ -5,7 +5,6 @@ services:
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ./etc:/etc/traefik:Z,ro - ./etc:/etc/traefik:Z,ro
- ./logs:/volumes/logs:Z
- ./certs:/volumes/certs:Z - ./certs:/volumes/certs:Z
environment: environment:
- TZ=Europe/Berlin - TZ=Europe/Berlin

View file

@ -3,10 +3,6 @@ global:
checkNewVersion: false checkNewVersion: false
sendAnonymousUsage: false sendAnonymousUsage: false
log:
filePath: /volumes/logs/traefik.log
level: ERROR
entryPoints: entryPoints:
web: web:
address: :80 address: :80
@ -15,7 +11,6 @@ entryPoints:
entryPoint: entryPoint:
to: websecure to: websecure
scheme: https scheme: https
websecure: websecure:
address: :443 address: :443
http: http:
@ -31,7 +26,6 @@ certificatesResolvers:
tlsChallenge: {} tlsChallenge: {}
accessLog: accessLog:
filePath: /volumes/logs/access.log
bufferingSize: 128 bufferingSize: 128
providers: providers:

View file

@ -1,14 +1,14 @@
#!/bin/bash #!/bin/bash
# Use settings template as default settings if the settings does not file already exist # Use the settings template as default settings if the settings file doesn't already exist
SETTINGS_FILE=/volumes/data/settings.ini SETTINGS_FILE=/volumes/data/settings.ini
if [[ ! -f "$SETTINGS_FILE" ]]; then if [[ ! -f "$SETTINGS_FILE" ]]; then
cp deploy/settings_template.ini "$SETTINGS_FILE" \ cp deploy/settings_template.ini "$SETTINGS_FILE" \
&& echo "Initialized default settings at $SETTINGS_FILE" && echo "Initialized default settings at $SETTINGS_FILE"
fi fi
# Generate secrets if the secrets file does not already exist # Generate secrets if the secrets file doesn't already exist
./manage.py setup generate-secrets ./manage.py setup generate-secrets
# Start the server # Start the server
gunicorn --bind "0.0.0.0:80" --workers "5" --log-file "/volumes/logs/gunicorn.log" "run:create_app()" gunicorn --bind 0.0.0.0:80 --workers 4 --log-level error "run:create_app()"

1149
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,26 +1,23 @@
[tool.poetry] [tool.poetry]
name = "advlabdb" name = "advlabdb"
version = "1.0.2" version = "1.0.3"
description = "Database with a web interface for labs." description = "Database with a web interface for labs."
authors = ["Mo Bitar <mo8it@proton.me>"] authors = ["Mo Bitar <mo8it@proton.me>"]
readme = "README.md" readme = "README.md"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = ">3.11,<3.13" python = "~3.12"
argon2-cffi = "^23.1" # Needed for hashing passwords with flask-security
click = "^8.1" click = "^8.1"
email-validator = "^2.1"
flask = "^3.0"
flask-admin = "^1.6" flask-admin = "^1.6"
flask-login = "^0.6"
flask-migrate = "^4.0" flask-migrate = "^4.0"
flask-security-Too = "^5.4" flask-security = "^5.5"
flask-sqlalchemy = "^3.1" flask-sqlalchemy = "^3.1"
flask-wtf = "^1.2" gunicorn = "^23.0"
gunicorn = "^21.2"
markupsafe = "^2.1" markupsafe = "^2.1"
matplotlib = "^3.8" matplotlib = "^3.9"
numpy = "^1.26" numpy = "^2.1"
setuptools = "^69.1" setuptools = "^74.1"
[tool.ruff] [tool.ruff]
line-length = 120 line-length = 120

File diff suppressed because it is too large Load diff