docker stack commands

This commit is contained in:
2019-05-05 15:50:48 +02:00
parent c96b199932
commit 155c0b2c3d
20 changed files with 164 additions and 37 deletions

View File

@@ -102,3 +102,45 @@ $ make frontend-prod
```
App available on: `http://0.0.0.0:8080`.
## Production deployment
Prerequisite: machine with free ports 80 and 8084.
### Database
Either build the database from scratch (lenghty process) using above instructions or just migrate the database from the faculty server (recommended).
TODO: build my-mongo
### Backend
Set database connection details in `/src/backend_flask/db_config.py`.
```
mongodb://valuser:valuserpass@127.0.0.1:27017/valdb
```
In the above line, replace `valuser` with the username and `valuserpass` with the password that was used to create the database tables (the values were set in the root Makefile).
You can also set the number of workers in `/src/backend_flask/entrypoint.sh`.
In line with `gunicorn -t 4 -b 127.0.0.1:8084 app:app`, edit the `-t` parameter.
Rule of thumb is 2x number of available CPU cores.
Build the backend container:
```bash
# From git root
$ make build-backend-flask
```
### Frontend
Set the server address (where backend will be runnig) in `src/frontend_vue/config/config_prod.json`.
Build the `/dist` folder that contains the static app (we will be using Nginx to serve it).
```bash
# From git root
$ make build-frontend-prod
```
All set, now run the stack.
```bash
# From git root
$ make deploy-prod-stack
```