refactor: Update Copilot configuration for local development

This commit updates the Copilot configuration for local development. It adds environment variables and services to the docker-compose.base.yml and package.json files to support running Copilot locally. The changes include adding the "copilot" service to the docker-compose.base.yml file with the necessary environment variables for Copilot functionality. Additionally, it adds new npm scripts in the package.json file to start, build, and force-build Copilot. These updates enable developers to easily run and build Copilot locally for testing and development purposes.
This commit is contained in:
Simon Larsen 2024-07-08 12:11:52 +01:00
parent 00b48b16ce
commit e4bf81fcc1
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
4 changed files with 54 additions and 1 deletions

View File

@ -243,3 +243,10 @@ NOTIFICATION_WEBHOOK_ON_CREATED_USER=
# This is the OneUptime Server URL LLM container will use to validate requests. It should be the url where you host the server.
LLM_ONEUPTIME_SERVER_URL=https://localhost
# Copilot Environment Variables
COPILOT_ONEUPTIME_URL=http://localhost
COPILOT_ONEUPTIME_REPOSITORY_SECRET_KEY=
COPILOT_GITHUB_TOKEN=
COPILOT_GITHUB_USERNAME=
COPILOT_ONEUPTIME_LLAMA_SERVER_URL=

View File

@ -365,6 +365,20 @@ services:
options:
max-size: "1000m"
copilot:
networks:
- oneuptime
restart: always
environment:
ONEUPTIME_URL: ${COPILOT_ONEUPTIME_URL}
ONEUPTIME_REPOSITORY_SECRET_KEY: ${COPILOT_ONEUPTIME_REPOSITORY_SECRET_KEY}
GITHUB_TOKEN: ${COPILOT_GITHUB_TOKEN}
GITHUB_USERNAME: ${COPILOT_GITHUB_USERNAME}
ONEUPTIME_LLAMA_SERVER_URL: ${COPILOT_ONEUPTIME_LLAMA_SERVER_URL}
logging:
driver: "local"
options:
max-size: "1000m"
e2e:
restart: "no"

View File

@ -0,0 +1,29 @@
services:
copilot:
volumes:
- ./Copilot:/usr/src/app
# Use node modules of the container and not host system.
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/node_modules/
- ./Common:/usr/src/Common
- ./Model:/usr/src/Model
- ./CommonServer:/usr/src/CommonServer
- ./CommonUI:/usr/src/CommonUI
- /usr/src/Common/node_modules/
- /usr/src/CommonUI/node_modules/
- /usr/src/CommonServer/node_modules/
- /usr/src/Model/node_modules/
ports:
- '9985:9229' # Debugging port.
extends:
file: ./docker-compose.base.yml
service: copilot
build:
network: host
context: .
dockerfile: ./Copilot/Dockerfile
networks:
oneuptime:
driver: bridge

View File

@ -45,6 +45,9 @@
"start-llm": "npm run prerun && export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.llm.yml up --remove-orphans -d $npm_config_services",
"build-llm": "npm run prerun && export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.llm.yml build $npm_config_services",
"force-build-llm": "npm run prerun && export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.llm.yml build --no-cache $npm_config_services",
"start-copilot": "npm run prerun && export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.copilot.yml up --remove-orphans -d $npm_config_services",
"build-copilot": "npm run prerun && export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.copilot.yml build $npm_config_services",
"force-build-copilot": "npm run prerun && export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.copilot.yml build --no-cache $npm_config_services",
"ps": "export $(grep -v '^#' config.env | xargs) && docker compose ps",
"save-logs": "export $(grep -v '^#' config.env | xargs) && docker compose logs --tail=100000 $npm_config_services > logs.txt",
"logs": "export $(grep -v '^#' config.env | xargs) && docker compose logs --tail=100 -f $npm_config_services",