Anomaly detection service 🔎👻
First of all, download the .env vars for production deployment at following link:
- s3://s0nar/env/master/.env
Create s0nar API and workers images
docker-compose build --no-cache . # In project's root folder
Then start all containers using docker-compose, except LSTM-GPU worker:
docker-compose up -d api mongodb rabbitmq flower arima-worker lstm-cpu-worker
We don't start the gpu worker because docker-compose has no support for nvidia-docker flags, then:
docker run --name lstm-gpu-worker --gpus all s0nar_lstm-gpu-worker:latest
First, establish the env vars and deploy mongodb and rabbitmq (and flower if you want to track the celery task)
cp .env.sample .env # maybe you need to update these variables
docker-compose up -d mongodb rabbitmq flower
Then start s0nar service
python app.py
Finally, start the workers:
- auto-arima worker
celery --app=project.ml_task.celery_app worker -l INFO -n worker.arima -Q arima -c 1
- LSTM-CPU worker
celery --app=project.ml_task.celery_app worker -l INFO -n worker.lstm-cpu -Q lstm-cpu -c 1
- LSTM-CPU worker
celery --app=project.ml_task.celery_app worker -l INFO -n worker.lstm-gpu -Q lstm-gpu -c 1
Once both services are running you can test it using postman or cURL.
- python >=3.5 (using conda, virtenv, etc, it doesn't matter )
- pip3
- docker
- docker-compose
- cURL or Postman