mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 19:54:13 +00:00
build(config.yml): reintroduce mounting config.yaml
This commit is contained in:
parent
59bf294308
commit
e08da07def
3 changed files with 24 additions and 31 deletions
|
@ -103,9 +103,10 @@ jobs:
|
||||||
command: |
|
command: |
|
||||||
docker run -d \
|
docker run -d \
|
||||||
-p 4000:4000 \
|
-p 4000:4000 \
|
||||||
-e DATABASE_URL=$PROXY_DOCKER_DB_URL \
|
|
||||||
--name my-app \
|
--name my-app \
|
||||||
my-app:latest
|
-v $(pwd)/proxy_server_config.yaml:/app/config.yaml \
|
||||||
|
my-app:latest \
|
||||||
|
--config /app/config.yaml
|
||||||
- run:
|
- run:
|
||||||
name: Install curl and dockerize
|
name: Install curl and dockerize
|
||||||
command: |
|
command: |
|
||||||
|
|
|
@ -5,7 +5,7 @@ import random
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import importlib
|
import importlib
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
import operator
|
|
||||||
|
|
||||||
sys.path.append(os.getcwd())
|
sys.path.append(os.getcwd())
|
||||||
|
|
||||||
|
@ -32,29 +32,6 @@ def run_ollama_serve():
|
||||||
) # noqa
|
) # noqa
|
||||||
|
|
||||||
|
|
||||||
def clone_subfolder(repo_url, subfolder, destination):
|
|
||||||
# Clone the full repo
|
|
||||||
repo_name = repo_url.split("/")[-1]
|
|
||||||
repo_master = os.path.join(destination, "repo_master")
|
|
||||||
subprocess.run(["git", "clone", repo_url, repo_master])
|
|
||||||
|
|
||||||
# Move into the subfolder
|
|
||||||
subfolder_path = os.path.join(repo_master, subfolder)
|
|
||||||
|
|
||||||
# Copy subfolder to destination
|
|
||||||
for file_name in os.listdir(subfolder_path):
|
|
||||||
source = os.path.join(subfolder_path, file_name)
|
|
||||||
if os.path.isfile(source):
|
|
||||||
shutil.copy(source, destination)
|
|
||||||
else:
|
|
||||||
dest_path = os.path.join(destination, file_name)
|
|
||||||
shutil.copytree(source, dest_path)
|
|
||||||
|
|
||||||
# Remove cloned repo folder
|
|
||||||
subprocess.run(["rm", "-rf", os.path.join(destination, "repo_master")])
|
|
||||||
feature_telemetry(feature="create-proxy")
|
|
||||||
|
|
||||||
|
|
||||||
def is_port_in_use(port):
|
def is_port_in_use(port):
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
@ -371,6 +348,20 @@ def run_server(
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"Uvicorn needs to be imported. Run - `pip install uvicorn`"
|
"Uvicorn needs to be imported. Run - `pip install uvicorn`"
|
||||||
)
|
)
|
||||||
|
if os.getenv("DATABASE_URL", None) is not None:
|
||||||
|
# run prisma db push, before starting server
|
||||||
|
# Save the current working directory
|
||||||
|
original_dir = os.getcwd()
|
||||||
|
# set the working directory to where this script is
|
||||||
|
abspath = os.path.abspath(__file__)
|
||||||
|
dname = os.path.dirname(abspath)
|
||||||
|
os.chdir(dname)
|
||||||
|
try:
|
||||||
|
subprocess.run(
|
||||||
|
["prisma", "db", "push", "--accept-data-loss"]
|
||||||
|
) # this looks like a weird edge case when prisma just wont start on render. we need to have the --accept-data-loss
|
||||||
|
finally:
|
||||||
|
os.chdir(original_dir)
|
||||||
if port == 8000 and is_port_in_use(port):
|
if port == 8000 and is_port_in_use(port):
|
||||||
port = random.randint(1024, 49152)
|
port = random.randint(1024, 49152)
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
|
|
|
@ -255,8 +255,9 @@ class PrismaClient:
|
||||||
)
|
)
|
||||||
## init logging object
|
## init logging object
|
||||||
self.proxy_logging_obj = proxy_logging_obj
|
self.proxy_logging_obj = proxy_logging_obj
|
||||||
|
try:
|
||||||
if os.getenv("DATABASE_URL", None) is None: # setup hasn't taken place
|
from prisma import Prisma # type: ignore
|
||||||
|
except:
|
||||||
os.environ["DATABASE_URL"] = database_url
|
os.environ["DATABASE_URL"] = database_url
|
||||||
# Save the current working directory
|
# Save the current working directory
|
||||||
original_dir = os.getcwd()
|
original_dir = os.getcwd()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue