Server component for BotMan
- Clone the repository
- Install requirements
-
pip3 install -r requirements.txt
-
- Fill in
config.json
with appropriate data
- Make sure the config entries are filled correctly.
- Make sure Docker Desktop is installed and running
- Install Tesseract OCR
- Instructions are in the Binaries section
-
python3 app.py
- Make sure the config entries are filled correctly.
- Build the Docker image
-
docker build -t botman-server .
-
- Run the Docker container
-
docker run -p 8000:{PORT} botman-server # PORT is the port specified in the config file
{
"host": "0.0.0.0",
"port": 8000,
"currency-api-key": "Your API Key",
"spotify-client-id": "Spotify Client ID",
"spotify-client-secret": "Spotify Client Secret",
"tesseract_exec_path": "tesseract",
"tesseract_tessdata_path": "/usr/local/Cellar/tesseract-lang/4.1.0/share/tessdata",
"logfile": "log.db"
}
currency-api-key
- Free API Key from CurrencyConverterAPI.
spotify-client-id
&spotify-client-secret
- Spotify Client ID and Secret from Spotify Developer Dashboard.
- Create a new app, go to its settings, and copy the Client ID and Client Secret.
tesseract_exec_path
- Path to the
tesseract
executable. If installed properly, should betesseract.exe
for Windows andtesseract
for Linux and macOS. - If installed in a custom path, or you knew what you were doing, change the path to the installation's path accordingly.
- Path to the
tesseract_tessdata_path
- Path to the
tessdata
folder. This is for additional languages support. Not mandatory.
- Path to the
- Sometimes, you may need to run the app behind a proxy, like I had to with Kubernetes and the Nginx Ingress Controller.
- if the app is served with an additional path prefix, say
/api/v1
, FastAPI freaks out. - So to fix this, we need to set the prefix manually.
- Set the
FASTAPI_ROOT_PATH
environment variable to your path prefix - Check this page for more information.
- Build the container using
-
sudo docker build -t mahasvan/botmanserver:latest .
-
- Install the Nginx Ingress Controller - Install Guide
- Add the BotMan Server Docker image to the cluster registry
- If using K3S, refer to this answer on StackOverflow
- Go through the YAML files in the
k8s
directory, and change the details needed. - Apply the Kubernetes manifests
-
kubectl apply -f k8s/
-
- You should now have the deployment in effect.