diff --git a/README.md b/README.md index b4efcd5d84ff7407ccd10b5425a74a506c3d3a4c..648984586416a3cec9a287ae1212ba1fe8c2b1e8 100644 --- a/README.md +++ b/README.md @@ -95,9 +95,9 @@ acting as a reverse proxy. If you are not planning to go with Docker or just want to setup a local development environment, then you'll need: -Python 3.7+ -MariaDB -Virtualenv +- Python 3.7+ +- MariaDB +- Virtualenv ### Installation @@ -107,7 +107,13 @@ Create a virtual environment for your Python dependencies: virtualenv -p python3.7 python ``` -Install the required dependencies: +To activate that environment, run + +```bash +source python/bin/activate +``` + +Install the required dependencies ```bash pip3 install -r requirements.txt @@ -205,18 +211,63 @@ Then run this from the root directory: ./run.sh api ``` +If this is succeeding, you can now proceed to configure Engine API to run as a system daemon using [Systemd](#running-with-systemd) or +[Supervisor](#running-with-supervisor). + ### Running with Systemd -**tbd** +The Systemd unit file configuration expects to be running under the user `engineuser`. To create such user type: + +```shell + sudo adduser engineuser + sudo adduser engineuser sudo +``` + +Copy the systemd unit file in `./config/sample/systemd` to `/etc/systemd/system`. This configuration file is expecting you to have +Engine API installed under `/opt/aura/engine-api` and `engineuser` owning the files. + +Next login to `engineuser` and give it permissions to the unit file + +```shell + su engineuser + sudo chmod 644 /etc/systemd/system/aura-engine-api.service +``` + +Let's start the service + +```shell +sudo systemctl start aura-engine-api +``` + +And check if it has started successfully + +```shell +sudo systemctl status aura-engine-api +``` + +If you experience issues and need more information, check the syslog while starting the service + +```shell +tail -f /var/log/syslog +``` + +You can stop or restart the service with one of these + +```shell +sudo systemctl stop aura-engine-api +sudo systemctl restart aura-engine-api +``` + +Note, any requirements from the [Installation](#installation) step need to be available for that user. ### Running with Supervisor -Alternatively to Systemd you can start Engine API using [Supervisor](http://supervisord.org/). In `./config/sample/supervisor/aura-engine-api.conf` you can find a example. -Supervisor configuration file. +Alternatively to Systemd you can start Engine API using [Supervisor](http://supervisord.org/). In `./config/sample/supervisor/aura-engine-api.conf` you +can find an example Supervisor configuration file. Follow the initial steps of the Systemd setup. ### Running with Docker -To run the server on a Docker container, please execute the following from the root directory: +To run the server in a Docker container, please execute the following from the root directory: ```bash # Building the image