Deployment¶
All the packages necessary to run the recommendation server can be installed by using the requirements.txt file or the environment.yaml file, depending if you use pip or conda. Those packages can be easily installed by running either of these commands:
pip install -r requirements.txt
conda env update –file environment.yaml
Docker-compose configuration¶
If you just want to deploy the recommendation server and a Postgres database in Docker using data files located in test_db/ then follow these steps:
Move to the tests folder: cd tests
Run the command “docker-compose up”.
Update the configuration values from util/train_save_model_config.json to reflect your desired values.
Remember to set these keys to true in the util/train_save_model_config.json
“create_models”: true
“upload_models”: true
Run the util/train_save_model.py script to create the model files and upload them to the recommendation server.
Docker configuration¶
If you want to use your own database, then you can build only the Dockerfile from lkweb folder. The steps to setup the recommendation server using Docker are:
Update the database configuration from config.cfg
Move to the lkweb folder: cd lkweb
Build the rec server image from the Dockerfile: docker build -t rec-server .
Update the values from util/train_save_model_config.json to reflect your desired values.
Remember to set these keys to true in the util/train_save_model_config.json
“create_models”: true
“upload_models”: true
Run the util/train_save_model.py script to create the model files and upload them to the recommendation server.
No-Docker configuration¶
The steps to setup the recommendation server without Docker are:
Update the database configuration from config.cfg
Install the python packages by using the requirements.txt file or the environment.yaml file.
Start the recommendation server with 4 workers in gunicorn: gunicorn -w 4 wsgi:app
Update the values from util/train_save_model_config.json to reflect your desired values.
Remember to set these keys to true in the util/train_save_model_config.json
“create_models”: true
“upload_models”: true
Run the util/train_save_model.py script to create the model files and upload them to the recommendation server.
It is recommended to create a virtualenv or anaconda environment before step 2.