mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-02 22:33:05 +00:00
Update config and log to stdout/stderr
This commit is contained in:
parent
9a2647480b
commit
7b482d0cba
5 changed files with 8 additions and 17 deletions
11
README.md
11
README.md
|
@ -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`.
|
||||
|
||||
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.
|
||||
- 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.
|
||||
- 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.
|
||||
|
||||
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.
|
||||
- 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`.
|
||||
- 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`.
|
||||
- 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`.
|
||||
|
|
|
@ -8,7 +8,6 @@ services:
|
|||
restart: unless-stopped
|
||||
volumes:
|
||||
- ../data:/volumes/data:Z
|
||||
- ../logs:/volumes/logs:Z
|
||||
environment:
|
||||
- TZ=Europe/Berlin
|
||||
networks:
|
||||
|
|
|
@ -5,7 +5,6 @@ services:
|
|||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./etc:/etc/traefik:Z,ro
|
||||
- ./logs:/volumes/logs:Z
|
||||
- ./certs:/volumes/certs:Z
|
||||
environment:
|
||||
- TZ=Europe/Berlin
|
||||
|
|
|
@ -3,10 +3,6 @@ global:
|
|||
checkNewVersion: false
|
||||
sendAnonymousUsage: false
|
||||
|
||||
log:
|
||||
filePath: /volumes/logs/traefik.log
|
||||
level: ERROR
|
||||
|
||||
entryPoints:
|
||||
web:
|
||||
address: :80
|
||||
|
@ -15,7 +11,6 @@ entryPoints:
|
|||
entryPoint:
|
||||
to: websecure
|
||||
scheme: https
|
||||
|
||||
websecure:
|
||||
address: :443
|
||||
http:
|
||||
|
@ -31,7 +26,6 @@ certificatesResolvers:
|
|||
tlsChallenge: {}
|
||||
|
||||
accessLog:
|
||||
filePath: /volumes/logs/access.log
|
||||
bufferingSize: 128
|
||||
|
||||
providers:
|
||||
|
|
6
init.sh
6
init.sh
|
@ -1,14 +1,14 @@
|
|||
#!/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
|
||||
if [[ ! -f "$SETTINGS_FILE" ]]; then
|
||||
cp deploy/settings_template.ini "$SETTINGS_FILE" \
|
||||
&& echo "Initialized default settings at $SETTINGS_FILE"
|
||||
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
|
||||
|
||||
# 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()"
|
||||
|
|
Loading…
Reference in a new issue