LitServe is a high-throughput serving engine for deploying AI models at scale, while Traefik is a modern HTTP reverse proxy and load balancer that simplifies microservices deployment.
git clone https://github.com/bhimrazy/litserve-meets-traefik.git
cd litserve-meets-traefik
# Install dependencies
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
# Start the server
python server.py
Check the server at http://localhost:8000.
# Start the services
docker-compose up # or docker-compose up -d to run in detached mode
Check the server at http://litapi.localhost.
-
Create a new EC2 instance and install Docker and Docker Compose:
sudo apt-get update sudo apt-get install docker.io sudo apt-get install docker-compose # Check Docker status sudo systemctl status docker
-
Clone the repo & Set Up Environment Variables:
-
Clone the repository and navigate to the project directory.
git clone https://github.com/bhimrazy/litserve-meets-traefik.git cd litserve-meets-traefik
-
Create
.env
from.env.example
and customize with your values.cp .env.example .env
-
-
Generate Traefik Dashboard Password:
-
Install
apache2-utils
and generate a password for the Traefik dashboard.sudo apt install apache2-utils htpasswd -nbB yourusername yourpassword
-
Add the generated password to
.env
.
-
-
Start the Services: use
docker-compose.prod.yml
to start the services in production mode.sudo docker-compose -f docker-compose.prod.yml up -d
Check the API server at API_DOMAIN
as configured in .env
, and access the Traefik dashboard at TRAEFIK_DOMAIN
as specified in .env
.
Ensure that .env
contains the following configuration:
API_DOMAIN=your-api-domain.com # make sure to update your DNS records
TRAEFIK_DOMAIN=your-traefik-dashboard-domain.com # make sure to update your DNS records
TRAEFIK_USER=
TRAEFIK_PASSWORD=
EMAIL=
# Add other necessary environment variables
Generate a password for the Traefik dashboard using htpasswd
and update .env
:
htpasswd -nbB yourusername yourpassword
- LitServe API: http://litapi.localhost
- Traefik Dashboard: http://traefik.localhost
- LitServe API: httsp://your-api-domain.com
- Traefik Dashboard: https://your-traefik-dashboard-domain.com
- Ensure proper DNS configuration for domain-based access in production.
- Monitor Traefik logs (
docker-compose logs -f traefik
) for troubleshooting and monitoring. - Customize
docker-compose.prod.yml
and.env
according to your specific deployment requirements.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.