From b95ea7f4e68a0794a44e68621a8210bb4db43e67 Mon Sep 17 00:00:00 2001 From: Jocelyn Delalande Date: Sat, 3 Feb 2018 18:52:04 +0100 Subject: Add statistics support to API --- docs/api.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'docs') diff --git a/docs/api.rst b/docs/api.rst index b82c6f3..0ae4214 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -164,3 +164,25 @@ And you can of course `DELETE` them at `/api/projects//bills/`:: $ curl --basic -u demo:demo -X DELETE\ https://ihatemoney.org/api/projects/demo/bills/80\ "OK" + + +Statistics +---------- + +You can get some project stats with a `GET` on `/api/projects//statistics`:: + + $ curl --basic -u demo:demo https://ihatemoney.org/api/projects/demo/statistics + [ + { + "balance": 12.5, + "member": {"activated": True, "id": 1, "name": "alexis", "weight": 1.0}, + "paid": 25.0, + "spent": 12.5 + }, + { + "balance": -12.5, + "member": {"activated": True, "id": 2, "name": "fred", "weight": 1.0}, + "paid": 0, + "spent": 12.5 + } + ] -- cgit v1.1 From d9471733f82f948e4e77ac91d6280fa5c4856358 Mon Sep 17 00:00:00 2001 From: 0livd Date: Wed, 7 Feb 2018 09:37:21 +0100 Subject: Fix some anti patterns in docker deployment (#321) - Use exec to run gunicorn and avoid creating a new process. - Add the possibility to pass any additional parameters to gunicorn. - Use only one gunicorn worker by default as the usual way to scale the app in production would be to use the scale command of the cluster scheduler. Additional workers could still be added by passing the "-w" gunicorn parameter to docker run. --- docs/installation.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/installation.rst b/docs/installation.rst index 0c3cfac..e7d586e 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -154,9 +154,10 @@ A volume can also be specified to persist the default database file:: docker run -d -p 8000:8000 -v /host/path/to/database:/database ihatemoney -The following gunicorn parameters are also available:: +Additional gunicorn parameters can be passed using the docker ``CMD`` parameter. +For example, use the following command to add more gunicorn workers:: - GUNICORN_NUM_WORKERS (default: 3) + docker run -d -p 8000:8000 ihatemoney -w 3 Configuration ============= -- cgit v1.1 From 9caf213e1d4f2f92944000f2c072fcece885f407 Mon Sep 17 00:00:00 2001 From: JocelynDelalande Date: Tue, 17 Jul 2018 00:22:23 +0200 Subject: Document MySQL setup (#357) PyMySQL is more difficult to install since its version 0.9 since it now depends on *cryptography* lib, which in turns depends on OpenSSL and Python dev files. See https://github.com/PyMySQL/PyMySQL/issues/697 --- docs/installation.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/installation.rst b/docs/installation.rst index e7d586e..4829c5d 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -63,6 +63,22 @@ Once installed, you can start a test server:: And point your browser at `http://localhost:5000 `_. +Configure database with MySQL/MariaDB (optional) +================================================ + +Only required if you prefer MySQL/MariaDB over SQLite. + +1. Install PyMySQL dependencies. On Debian or Ubuntu, that would be:: + + apt install python3-dev libssl-dev + +2. Install PyMySQL (within your virtualenv):: + + pip install 'PyMySQL>=0.9,<0.10' + +3. Create an empty database and a database user +4. Configure :ref:`SQLALCHEMY_DATABASE_URI ` accordingly + Deploy it ========= @@ -159,6 +175,8 @@ For example, use the following command to add more gunicorn workers:: docker run -d -p 8000:8000 ihatemoney -w 3 +.. _configuration: + Configuration ============= @@ -187,7 +205,7 @@ Production values are recommended values for use in production. | | | **Production value:** `ihatemoney conf-example ihatemoney.cfg` sets it to something | | | | random, which is good. | +-------------------------------+---------------------------------+----------------------------------------------------------------------------------------+ -| MAIL_DEFAULT_SENDER | ``("Budget manager", | A python tuple describing the name and email address to use when sending | +| MAIL_DEFAULT_SENDER | ``("Budget manager", | A python tuple describing the name and email address to use when sending | | | "budget@notmyidea.org")`` | emails. | | | | | | | | **Production value:** Any tuple you want. | -- cgit v1.1