From c5c2225a8852e80656d645b2ac1385a32ede519a Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Mon, 13 May 2024 10:37:07 -0400 Subject: [PATCH 1/4] Cycling API Keys --- ui/recipes-chat/librechat.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/recipes-chat/librechat.yaml b/ui/recipes-chat/librechat.yaml index a6834a20..6be20eb5 100644 --- a/ui/recipes-chat/librechat.yaml +++ b/ui/recipes-chat/librechat.yaml @@ -40,7 +40,7 @@ endpoints: assistants: true groups: - group: "region-eastus2" - apiKey: 21e38dd24f114ef7b7ea8cd96112603a + apiKey: ${AZURE_API_KEY_ENV} instanceName: "dkopenai2" version: "2024-02-15-preview" assistants: true From cd712a0903d6af2fe9092e235c7482993a94f485 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Mon, 13 May 2024 10:39:17 -0400 Subject: [PATCH 2/4] Cycling API Keys --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e4f4645..fe763c68 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ We will add more details here soon, for now, here are some notes on Azure ... ## Deploying to Azure -A deployment script './deployment/deploy_azure.py' is provided to deploy to an Azure Multicontainer web app you have set up with [these instructions](https://learn.microsoft.com/en-us/azure/app-service/tutorial-multi-container-app). Note: This is for demo purposes only, as Multicontainer web app are still in Public Preview. +A deployment script './deployment/deploy_azure.py' is provided to deploy to an Azure Multicontainer web app you have set up with [these instructions](https://learn.microsoft.com/en-us/azure/app-service/tutorial-multi-container-app). The script is run from the top directory. Note: This is for demo purposes only, as Multicontainer web app are still in Public Preview. To run the deployment ... From 2fb2a80697dd677c7c5d0129c126d42f1f6c85b0 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Mon, 13 May 2024 11:03:05 -0400 Subject: [PATCH 3/4] Tweaks to deploy --- .env.example | 2 +- deployment/deploy_azure.py | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 095d1878..bddf1346 100644 --- a/.env.example +++ b/.env.example @@ -63,7 +63,7 @@ IMAGE_HOST=http://localhost:3080/images # Deployment to Azure # #==================================================# AZURE_CONTAINER_REGISTRY= -AZURE_CONTAINER_REGISTRY_USERNAME=d +AZURE_CONTAINER_REGISTRY_REPO= #==================================================# # API Settings # diff --git a/deployment/deploy_azure.py b/deployment/deploy_azure.py index 56331941..f05954a3 100644 --- a/deployment/deploy_azure.py +++ b/deployment/deploy_azure.py @@ -9,14 +9,28 @@ # import os +import sys import docker +from dotenv import load_dotenv -client = docker.from_env() +load_dotenv() container_registry = os.getenv("AZURE_CONTAINER_REGISTRY") repo = os.getenv("AZURE_CONTAINER_REGISTRY_REPO") +# Script is run from top directory +docker_compose_file = "./deployment/docker-compose-deploy.yml" +azure_platform = "linux/amd64" + +if sys.platform == "darwin": + print("Running on Mac") + client = docker.DockerClient( + base_url="unix:///Users/matthewharris/.docker/run/docker.sock " + ) +else: + client = docker.from_env() + def run_cmd(cmd): """ @@ -69,8 +83,6 @@ def deploy(): "code-interpreter", ], } - docker_compose_file = "docker-compose-deploy.yml" - azure_platform = "linux/amd64" run_cmd("az login") run_cmd(f"az acr login --name {container_registry}") From bf957808c7548029d10c584c6f01ae089b915562 Mon Sep 17 00:00:00 2001 From: Matthew Harris Date: Mon, 13 May 2024 11:49:04 -0400 Subject: [PATCH 4/4] A few notes on credentials generation for Azure dpeloyment --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fe763c68..191035f1 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,8 @@ Note: :warning: *This is very much a work in progress, deployment will be automated with fewer compose files soon* +You will need to set key environment variables, see your local `.env` for examples. The exceptions are the tokens needed for authetication, do not use the defaults for these. You can generate them on [this page](https://www.librechat.ai/toolkit/creds_generator). + ## Databases When running in Azure it is useful to use remote databases, at least for the mongodb instance so that user logins are retained with each release. For example, a databse can be configured by following [these instructions](https://docs.librechat.ai/install/configuration/mongodb.html). If doing this, then docker-compose-azure.yml in Azure can have the mongo DB section removed, and any instance of the Mongo URL used by other containers updated with the cloud connection string accordingly. \ No newline at end of file