bedrock-access-gateway icon indicating copy to clipboard operation
bedrock-access-gateway copied to clipboard

Documentation for locally running

Open aaronbolton opened this issue 1 year ago • 7 comments

I would like to locally host the docker container and pass the relevant environment variables, is this possible and do you have a list of the variables names which would be needed to allow access to AWS and any other mandatory config?

aaronbolton avatar Aug 02 '24 19:08 aaronbolton

I tried to run it locally too, but without success.

lucasopedroso avatar Aug 07 '24 12:08 lucasopedroso

@aaronbolton @lucasopedroso

You can successfully run the Bedrock Access Gateway by setting the necessary AWS and environment variables when launching the Docker container. Here's how I got it to work: First off, note that the application uses the boto3 library (AWS SDK for Python). Boto3 employs a credential discovery mechanism, searching for credentials in the following order: a) Environment variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY b) Shared credential file (~/.aws/credentials) c) AWS config file (~/.aws/config)

Running the Docker Container: To ensure proper credential access, launch the Docker container with the required environment variables as shown:

docker run -d --name bedrock_proxy \
  -e AWS_ACCESS_KEY_ID=your_access_key \
  -e AWS_SECRET_ACCESS_KEY=your_secret \
  -e AWS_REGION=aws_region \
  -p 8081:80 \
  bedrock-proxy

Remember to change your environmental variable accordingly, port and all.

Integration with Open-WebUI: When configuring the model in Open-WebUI or similar interfaces, use the following endpoint: http://YOUR_IP:8081/api/v1

Replace 'YOUR_IP' with the appropriate IP address or hostname of your server.

Authentication: Use 'bedrock' as the password when prompted for authentication.

I hope this helps.

oscarfrank avatar Aug 14 '24 08:08 oscarfrank

perfect thankyou

aaronbolton avatar Aug 14 '24 10:08 aaronbolton

You're welcome. Remember to add the --restart flag to keep the docker container persistent when the server is rebooted. For example, docker run -d --restart always --name bedrock and so on.

oscarfrank avatar Aug 14 '24 10:08 oscarfrank

Thank you for the help, I've put it in a compose file next to my OpenWebUI container so I don't need to expose the port externally as well

aaronbolton avatar Aug 14 '24 11:08 aaronbolton

Trying to run this locally.

Cloned the repo and build the _ecs Dockerfile.

Tryed to docker run it with the above parameters:

docker run -d --name bedrock_proxy \
  -e AWS_ACCESS_KEY_ID=your_access_key \
  -e AWS_SECRET_ACCESS_KEY=your_secret \
  -e AWS_REGION=aws_region \
  -p 8081:80 \
  bedrock-proxy

but for some reason when trying to curl I get:

curl http://localhost:8000/api/v1 curl: (56) Recv failure: Connection reset by peer

Logs are not very helpful:

INFO] (rapid) exec '/var/runtime/bootstrap' (cwd=/var/task, handler=)

laurentiu-danielg avatar Oct 24 '24 13:10 laurentiu-danielg

Your mapping port 8081 to 80 and then curling port 8000 you will need to curl 8081

aaronbolton avatar Oct 24 '24 14:10 aaronbolton