Commit f7114606 authored by Ossi Laine's avatar Ossi Laine
Browse files

Update README

parent f4cc1322
...@@ -2,14 +2,21 @@ ...@@ -2,14 +2,21 @@
### Prerequisites ### Prerequisites
Flask app with MariaDB Flask app with MySql/MariaDB
Check requirements.txt Check requirements.txt
### Installing ### Deployment
There are multiple deployment options, but one working solution is:
nginx + gunicorn (with gevent worker)
Working directory: /srv/rating
#### Installing prequisites
Install python packages with pip and preferably in virtual environment: Install python packages with pip and preferably in virtual environment:
``` yy```
virtualenv venv virtualenv venv
source venv/bin/activate source venv/bin/activate
pip install -r requirements.txt pip install -r requirements.txt
...@@ -19,13 +26,10 @@ Create user 'rating' and grant access to database 'rating_db'. ...@@ -19,13 +26,10 @@ Create user 'rating' and grant access to database 'rating_db'.
Create necessary tables by running the initialization script: Create necessary tables by running the initialization script:
``` ```
mysql -u rating -p -D rating_db < create_rating_db.sql mysql -u rating -p -D rating_db < db/create_rating_db.sql
``` ```
### Deployment #### Setting startup script
There are multiple deployment options, but one working solution is:
nginx + gunicorn (with gevent worker)
Create systemd startup script in '/etc/systemd/system/gunicorn.service' Create systemd startup script in '/etc/systemd/system/gunicorn.service'
...@@ -52,15 +56,33 @@ service gunicorn enable ...@@ -52,15 +56,33 @@ service gunicorn enable
service gunicorn start service gunicorn start
``` ```
### Logs #### Logs
Error logs are saved to application folder (/srv/rating/logs/) Error logs are saved to application folder (/srv/rating/logs/)
Optionally with journalctl: Optionally with journalctl:
journalctl -u gunicorn.service journalctl -u gunicorn.service
### Restart server after updates #### Restart server after updates
``` ```
service gunicorn restart service gunicorn restart
``` ```
### Deployment with docker
Install docker and docker-compose
Go to deploy folder. Build containers and run them with:
```
docker-compose -f docker-compose.yml up -d --build
```
This will create persistent database 'rating_db' to deploy/dbdata with user 'rating'.
Application should be up and running in 'localhost'.
### Project contact details
- osmala@utu.fi
- timo.t.heikkila@utu.fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment