mirror of
https://github.com/almet/copanier.git
synced 2025-04-28 11:32:38 +02:00
Docker: plusieurs améliorations (voir détails ci-dessous) (#57)
* docker: using gunicorn * cleanup * Docker: many improvements, added docker-compose for development purpose * display "sesame" on docker logs * auto restart app container in case of crash * dev mode: allow user to work on source code and synchronize changes with source code in "app" service * dev mode: auto reload gunicorn workers on source code change dev mode and data persistance * Suppression log inutile Co-authored-by: CapsLock <github@legeox.net>
This commit is contained in:
parent
ff6bdb0f10
commit
1784884a80
4 changed files with 17 additions and 3 deletions
|
@ -106,7 +106,11 @@ cd docker
|
|||
sudo docker-compose -p copanier up
|
||||
```
|
||||
|
||||
The app will be available at http://localhost:2244
|
||||
The app will be available at http://localhost:2244.
|
||||
|
||||
Database is saved under `db` folder. This folder is mounted in `app` container to persist data changes on host disk.
|
||||
|
||||
For development purpose, you can use both `docker-compose.yml` and `docker-compose-dev.yml` which allows you to work on copanier source code and make gunicorn automatically reload workers when code changes.
|
||||
|
||||
## Run local server
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ def send(to, subject, body, html=None, copy=None, attachments=None):
|
|||
|
||||
if not config.SEND_EMAILS:
|
||||
body = body.replace("https", "http")
|
||||
return print("Sending email", str(body.encode('utf-8')))
|
||||
return print("Sending email", str(body.encode('utf-8')), flush=True)
|
||||
|
||||
message.send(
|
||||
to=to,
|
||||
|
|
6
docker/docker-compose-dev.yml
Normal file
6
docker/docker-compose-dev.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
version: "3.9"
|
||||
services:
|
||||
app:
|
||||
command: /srv/copanier-venv/bin/gunicorn -k roll.worker.Worker copanier:app --bind 0.0.0.0:2244 --reload --log-level debug --access-logfile - --error-logfile -
|
||||
volumes:
|
||||
- "../:/srv/copanier/"
|
|
@ -5,12 +5,16 @@ services:
|
|||
context: ..
|
||||
dockerfile: "./docker/Dockerfile"
|
||||
command: /srv/copanier-venv/bin/gunicorn -k roll.worker.Worker copanier:app --bind 0.0.0.0:2244
|
||||
volumes:
|
||||
- "../copanier/db:/srv/copanier/db" # To persist database changes
|
||||
restart: always
|
||||
static:
|
||||
image: "nginx:latest"
|
||||
volumes:
|
||||
- "../copanier/static:/srv/copanier_static/static:ro"
|
||||
- "./nginx-default.conf:/etc/nginx/conf.d/default.conf:ro"
|
||||
restart: always
|
||||
depends_on:
|
||||
- app
|
||||
ports:
|
||||
- 0.0.0.0:2244:80
|
||||
- 0.0.0.0:2244:80
|
||||
|
|
Loading…
Reference in a new issue