Salmanap/fix config generator (#124)

* fixed environment variables issue with build. Now llm provider access keys are being written correctly

* fixed and verified that keys are being properly set when archgw is booted up

* removing leaf reference to a staged config file. not needed anymore

* minor fixes to get the build in more stable state

* minor fixes based on feedback

---------

Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-261.local>
This commit is contained in:
Salman Paracha 2024-10-05 10:49:47 -07:00 committed by GitHub
parent 5ba7db21d0
commit 0e5ea3d6db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 127 additions and 52 deletions

View file

@ -5,7 +5,7 @@ import pkg_resources
import select
from utils import run_docker_compose_ps, print_service_status, check_services_state
def start_arch(arch_config_file, log_timeout=120, check_interval=1):
def start_arch(arch_config_file, env, log_timeout=120, check_interval=1):
"""
Start Docker Compose in detached mode and stream logs until services are healthy.
@ -14,16 +14,13 @@ def start_arch(arch_config_file, log_timeout=120, check_interval=1):
log_timeout (int): Time in seconds to show logs before checking for healthy state.
check_interval (int): Time in seconds between health status checks.
"""
# Set the ARCH_CONFIG_FILE environment variable
env = os.environ.copy()
env['ARCH_CONFIG_FILE'] = arch_config_file
compose_file = pkg_resources.resource_filename(__name__, 'docker-compose.yaml')
compose_file = pkg_resources.resource_filename(__name__, 'config/docker-compose.yaml')
try:
# Run the Docker Compose command in detached mode (-d)
subprocess.run(
["docker-compose", "up", "-d"],
["docker", "compose", "-p", "arch", "up", "-d",],
cwd=os.path.dirname(compose_file), # Ensure the Docker command runs in the correct path
env=env, # Pass the modified environment
check=True # Raise an exception if the command fails
@ -67,8 +64,8 @@ def start_arch(arch_config_file, log_timeout=120, check_interval=1):
break
#check to see if the status of one of the services has changed from prior. Print and loop over until finish, or error
for service_name in services_status.item():
if services_status[service_name]['status'] != current_services_status[service_name]['status']:
for service_name in services_status.keys():
if services_status[service_name]['State'] != current_services_status[service_name]['State']:
print("One or more Arch services have changed state. Printing current state")
print_service_status(current_services_status)
break
@ -86,12 +83,12 @@ def stop_arch():
Args:
path (str): The path where the docker-compose.yml file is located.
"""
compose_file = pkg_resources.resource_filename(__name__, 'docker-compose.yaml')
compose_file = pkg_resources.resource_filename(__name__, 'config/docker-compose.yaml')
try:
# Run `docker-compose down` to shut down all services
subprocess.run(
["docker-compose", "down"],
["docker", "compose", "-p", "arch", "down"],
cwd=os.path.dirname(compose_file),
check=True,
)