From 3f6c257b351dce84566958f662b8524637d7b6cc Mon Sep 17 00:00:00 2001 From: David Trattnig <david.trattnig@o94.at> Date: Thu, 10 Sep 2020 13:58:09 +0200 Subject: [PATCH] More documentation on server setup. --- README.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a03d8d9..4d4a120 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,17 @@ sudo mysql -u root -p < contrib/mariadb-database.sql ### Configuration Copy the sample configuration file in `./config/sample/sample-production.engine-api` to `config` and edit the file. -First update the main configuration and then configure the type of federation. Depending on how you want to run your + +First update the main configuration, such as your database connection and the default port. Also set the correct IP +and port in `gunicorn.conf.py` file. + +> You might alos need to 'open' the chosen port in your `iptables` (Default is 8008) + +```shell +iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 8008 -j ACCEPT +``` + +Then configure the type of federation. Depending on how you want to run your Engine API node and where it is deployed, you'll needed to uncomment one of these federation sections: > To avoid any malfunction it is important that any other node-type configurations are commented out. @@ -193,6 +203,10 @@ To run the API in an local development server execute: For convenience running a plain `./run.sh` also starts the development server. +In development mode Engine uses the default [Flask](https://palletsprojects.com/p/flask/) web server. + +**Please be careful not to use this type of server in your production environment!** + When you'll need to run all three nodes to do testing during development you can run: ```bash @@ -205,7 +219,16 @@ Here the run script uses the configurations located in `./test/config`. ### Production -To run the server for production using Gunicorn, you first need to create the Gunicorn configuration +For production Engine API defaults to using the WSGI HTTP Server [`Gunicorn`](https://gunicorn.org/). + +You might also want to pair Gunicorn with some proxy server, such as Nginx. + +> Although there are many HTTP proxies available, we strongly advise that you use Nginx. If you choose another proxy +server you need to make sure that it buffers slow clients when you use default Gunicorn workers. Without this buffering +Gunicorn will be easily susceptible to denial-of-service attacks. You can use Hey to check if your proxy is behaving properly. +— [**Gunicorn Docs**](http://docs.gunicorn.org/en/latest/deploy.html). + +To run Gunicorn, you first need to create the Gunicorn configuration by copying the sample `./config/sample/gunicorn/sample-production.gunicorn.conf.py` to your `config` directory. -- GitLab