-
Notifications
You must be signed in to change notification settings - Fork 2
Deployment Guide
This guide provides step-by-step instructions for setting up and running the Serverless Runtime on a host machine.
Before you begin, ensure you have the following software installed on your system:
- Python 3.10
- pip (the Python package installer)
- virtualenv (for creating isolated Python environments)
If you do not have virtualenv installed, you can install it using pip:
pip install virtualenvIt is highly recommended to use a virtual environment to manage the project's dependencies and avoid conflicts with system-wide packages.
-
Clone the Repository First, clone the
serverless-runtimerepository to your local machine:git clone https://github.com/SovereignEdgeEU-COGNIT/serverless-runtime.git cd serverless-runtime -
Create and Activate a Virtual Environment Create a new virtual environment using Python 3.10.
python3.10 -m venv serverless-env source serverless-env/bin/activateYour command prompt should now be prefixed with
(serverless-env), indicating that the virtual environment is active. -
Install Dependencies Install all the required Python packages using the
requirements.txtfile.pip install -r requirements.txt
Once the environment is set up, you can start the application. The runtime is a FastAPI application run with Uvicorn, a high-performance ASGI server.
-
Navigate to the Application Directory The main application file (
main.py) is located in theapp/directory.cd app -
Start the Server Use
uvicornto run the application. The server will listen for incoming requests on all network interfaces (0.0.0.0) on port8000.uvicorn main:app --host 0.0.0.0 --port 8000 --broker "$COGNIT_BROKER" --flavour "$COGNIT_FLAVOUR"
-
Verify the Service If the server starts successfully, you will see output similar to this:
INFO: Started server process [12345] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)You can now send a request to the health check endpoint (
http://<your-host-ip>:8000/) to confirm it is running.