blue

building from repo

git cloning

It is recommended that you fork from the blue repo: https://github.com/rit-git/blue and clone your forked repository.

configuration

Most of blue scripts require configuration of environment variables.

Below is the list of environment varibles and brief descriptions:

installation

build

deployment servers
deployment spec
deployment platform, registries
deployment access control
shared services

A default value for these environment variable is in localhost.envrc. You can update them for your own configuration and simply set them by source localhost.envrc. Alternatively you can use utilities such as direnv is to help management environment variables and save your configuration as .envrc

setup

Refer to Local Installation for software and hardware requirements. Make sure you have docker already setup on your development environment.

builders

If you plan to use multi-platform builds (as specified in BLUE_BUILD_PLATFORM). It is recommended that you create a multi-platform builder in your environment. Please refer to docker buildx for more details.

Below is a quick builder setup:

$ docker buildx create --name multi_platform_builder --platform $BLUE_BUILD_PLATFORM
$ docker buildx use multi_platform_builder
$ docker buildx ls

If occasionally you run into disk space problems you can clean up your builder, and check disk usage:

$ docker buildx prune
$ docker buildx du
data volume setup

A data volume is added to several services (agents, API, etc.) where common data such as models can be stored within a platform (e.g. default). To create a data volume on your development environment, run:

$ cd platform/scripts
$ ./create_data_volume.sh --platform default

This will create a directory called default under the $BLUE_DATA_DIR directory, and create a volume on that directory.

data volume contents

In the default configuration some of the components of blue require data and models, stored in the data volume. Below are the steps to put them into the volume you just created:

$ cd $BLUE_INSTALL_DIR/platform/setup
$ ./build_setup.sh
$ cd $BLUE_INSTALL_DIR/platform/scripts
# ./setup_data_volume.sh

build

building libs

Many of the blue components, including agents, platform api server, etc. use blue-platform library. blue-platform library can be built in lib directory by running the scripts:

$ cd lib
$ ./scripts/build.sh
$ ./scripts/publish.sh

publish.sh uses the pypi configuration in ~/.pypirc. Ideally, during development you should use your own pypiserver and add your configuration in the .pypirc file: e.g.

[distutils] 
index-servers = 
   pypi
   mypypi

[pypi]
repository = https://upload.pypi.org/legacy/ 

[mypypi]
repository = http://1.2.3.4:8888/

And set BLUE_BUILD_LIB_SERVER to mypypi. Contact your local administrator if your organization already has a pypi server.

building agents

Even when running blue locally during development, many components of blue should be run as docker containers. As such it is important to build the various docker images first.

To build docker images for all agents, run:

$ cd agents
$ ./docker_build_all_agents.sh

Or if you can also build images for certain agents, you can do so by first changing to the directory for the agent, for example, to build user agent only:

$ cd agents/user
$ ./docker_build_agent.sh
building services

To build docker images for all services that agents use, run:

$ cd services
$ ./docker_build_all_services.sh

Or if you can also build images for certain services, you can do so by first changing to the directory for the service, for example, to build openai service only:

$ cd services/openai
$ ./docker_build_service.sh
building platform components

The key components in platform that require building are the API and the frontend.

building API

Run:

$ cd platform/api
$ ./docker_build_api.sh
building frontend

Before building the frontend you need to update secrets/fa.token, please contact eser@megagon.ai or rafael@megagon.ai to get the token.

Run:

$ cd platform/frontend
$ ./docker_build_frontend.sh

deployment

To deploy blue locally, with the default options, run:

$ cd platform/scripts
$ ./deploy_platform.sh

To test your deployment you can run:

$ docker ps

and the list should contain three containers running: redis, api , and frontend

If you want to see it in action on the web, you can bring up the frontend by browsing to http://localhost:3000 and the API documentation on http://localhost:5050/docs#/

</br> </br>