Add information about configuration, database and deployment in the README

This commit is contained in:
Alexis Métaireau 2020-11-24 20:57:32 +01:00
parent 10210272b6
commit 45c76d57a5

View file

@ -36,12 +36,16 @@ to ease the life of everyone involved :-)
## Philosophy ## Philosophy
- Keep things simple - Keep things simple.
- Do not rely on JavaScript (or the less possible) - Do not rely on JavaScript (or the less possible)
- Lower the cost of maintainance of the project - Lower the cost of maintainance of the project
## FAQ ## FAQ
### How files are stored? Does this rely on a database?
The current implementation of copanier doesn't need an external database, and relies on YAML files instead. It's done to keep things simple and easy to work with / backup, and we believe the needs for a database are very little, since we would very rarely have multiple writes at the same time.
### How is it different from cagette? ### How is it different from cagette?
[Cagette](https://www.cagette.net) is a free software which aims at solving a larger problem that what we're solving. Cagette has a more general approach, providing a tool that can be used by groups of producers, AMAPs, people having a physical store, and group of consumers. [Cagette](https://www.cagette.net) is a free software which aims at solving a larger problem that what we're solving. Cagette has a more general approach, providing a tool that can be used by groups of producers, AMAPs, people having a physical store, and group of consumers.
@ -114,6 +118,35 @@ $ # run the tests
$ py.test tests $ py.test tests
``` ```
## Configuration
Copanier uses environment variables to configure its behaviour. All the configuration flags are specified in [this config.py file](https://github.com/spiral-project/copanier/blob/master/copanier/config.py) and in order to use them, you will need to set them, considering their name starts with `COPANIER_`.
One simple way to handle this behaviour, is to have a `config.env` file and source it (with `source config.env`) before starting the server. Here is how this file could look like:
```bash
export COPANIER_SITE_NAME="You site name"
export COPANIER_SITE_DESCRIPTION="Site long description"
export COPANIER_XLSX_FILENAME="crac-produits"
export COPANIER_SEND_EMAILS=True
export COPANIER_SMTP_HOST="mail.gandi.net"
export COPANIER_SMTP_PASSWORD="something"
export COPANIER_SMTP_LOGIN="yourlogin"
export COPANIER_FROM_EMAIL="youremail@tld.com"
export COPANIER_EMAIL_SIGNATURE="The team"
export COPANIER_STAFF="staff@email.com another@staff.com"
```
## Deployment
If you're running the application locally, then just running it with `copanier serve` might be enough, but if you want to deploy it in production, the best way to make this run is to rely on a WSGI server. One good option is [gunicorn](https://gunicorn.org).
You can run it with this command:
```bash
gunicorn -k roll.worker.Worker copanier:app --bind [$IP]:$PORT
```
## Fork ## Fork
This project is a continuation of the work done by [Yohan](https://framagit.org/ybon/copanier), This project is a continuation of the work done by [Yohan](https://framagit.org/ybon/copanier),