mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
chore: Disable Copilot in development environment
This commit is contained in:
@@ -60,12 +60,6 @@ alias nrb="npm run build"
|
|||||||
alias nrfb="npm run force-build"
|
alias nrfb="npm run force-build"
|
||||||
alias nrps="npm run ps-dev"
|
alias nrps="npm run ps-dev"
|
||||||
|
|
||||||
# OneUptime Copilot
|
|
||||||
alias nrfbc="npm run force-build-copilot"
|
|
||||||
alias nrdc="npm run dev-copilot"
|
|
||||||
alias nrlc="npm run logs-copilot"
|
|
||||||
alias nrbc="npm run build-copilot"
|
|
||||||
|
|
||||||
# OneUptime LLM Server
|
# OneUptime LLM Server
|
||||||
alias nrfbl="npm run force-build-llm"
|
alias nrfbl="npm run force-build-llm"
|
||||||
alias nrdl="npm run dev-llm"
|
alias nrdl="npm run dev-llm"
|
||||||
|
|||||||
@@ -1,20 +1,86 @@
|
|||||||
## Setting up Custom Probes
|
## Setting up Custom Probes
|
||||||
|
|
||||||
You can set up custom probes inside your network to monitor resources in your private network or resources that are behind your firewall.
|
You can set up custom probes inside your network to monitor resources in your private network or resources that are behind your firewall.
|
||||||
|
|
||||||
To begin with you need to create a custom probe in your Project Settings > Probe. Once you have created the custom probe on your OneUptime Dashboard. You should have the `PROBE_ID` and `PROBE_KEY`
|
To begin with you need to create a custom probe in your Project Settings > Probe. Once you have created the custom probe on your OneUptime Dashboard. You should have the `PROBE_ID` and `PROBE_KEY`
|
||||||
|
|
||||||
|
### Deploy Probe
|
||||||
|
|
||||||
### Run the probe
|
#### Docker
|
||||||
|
|
||||||
To run a probe, please make sure you have docker installed. You can run custom probe by:
|
To run a probe, please make sure you have docker installed. You can run custom probe by:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run --name oneuptime-probe --network host -e PROBE_KEY=<probe-key> -e PROBE_ID=<probe-id> -e ONEUPTIME_URL=https://oneuptime.com -d oneuptime/probe:release
|
docker run --name oneuptime-probe --network host -e PROBE_KEY=<probe-key> -e PROBE_ID=<probe-id> -e ONEUPTIME_URL=https://oneuptime.com -d oneuptime/probe:release
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are self hosting OneUptime, you can change `INGESTOR_URL` to your custom self hosted instance.
|
If you are self hosting OneUptime, you can change `ONEUPTIME_URL` to your custom self hosted instance.
|
||||||
|
|
||||||
### Verify
|
#### Docker Compose
|
||||||
|
|
||||||
|
You can also run the probe using docker-compose. Create a `docker-compose.yml` file with the following content:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
oneuptime-probe:
|
||||||
|
image: oneuptime/probe:release
|
||||||
|
container_name: oneuptime-probe
|
||||||
|
environment:
|
||||||
|
- PROBE_KEY=<probe-key>
|
||||||
|
- PROBE_ID=<probe-id>
|
||||||
|
- ONEUPTIME_URL=https://oneuptime.com
|
||||||
|
network_mode: host
|
||||||
|
restart: always
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are self hosting OneUptime, you can change `ONEUPTIME_URL` to your custom self hosted instance.
|
||||||
|
|
||||||
|
#### Kubernetes
|
||||||
|
|
||||||
|
You can also run the probe using Kubernetes. Create a `oneuptime-probe.yaml` file with the following content:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: oneuptime-probe
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: oneuptime-probe
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: oneuptime-probe
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
image: oneuptime/probe:release
|
||||||
|
env:
|
||||||
|
- name: PROBE_KEY
|
||||||
|
value: "<probe-key>"
|
||||||
|
- name: PROBE_ID
|
||||||
|
value: "<probe-id>"
|
||||||
|
- name: ONEUPTIME_URL
|
||||||
|
value: "https://oneuptime.com"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl apply -f oneuptime-probe.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are self hosting OneUptime, you can change `ONEUPTIME_URL` to your custom self hosted instance.
|
||||||
|
|
||||||
|
|
||||||
|
### Verify
|
||||||
|
|
||||||
If the probe is running successfully. It should show as `Connected` on your OneUptime dashboard. If it does not show as connected. You need to check logs of the container. If you're still having trouble. Please create an issue on [GitHub](https://github.com/oneuptime/oneuptime) or [contact support](https://oneuptime.com/support)
|
If the probe is running successfully. It should show as `Connected` on your OneUptime dashboard. If it does not show as connected. You need to check logs of the container. If you're still having trouble. Please create an issue on [GitHub](https://github.com/oneuptime/oneuptime) or [contact support](https://oneuptime.com/support)
|
||||||
@@ -5,6 +5,10 @@ type GetStringFunction = () => string;
|
|||||||
type GetStringOrNullFunction = () => string | null;
|
type GetStringOrNullFunction = () => string | null;
|
||||||
type GetURLFunction = () => URL;
|
type GetURLFunction = () => URL;
|
||||||
|
|
||||||
|
export const GetIsCopilotDisabled: () => boolean = () => {
|
||||||
|
return process.env["DISABLE_COPILOT"] === "true";
|
||||||
|
}
|
||||||
|
|
||||||
export const GetOneUptimeURL: GetURLFunction = () => {
|
export const GetOneUptimeURL: GetURLFunction = () => {
|
||||||
return URL.fromString(
|
return URL.fromString(
|
||||||
process.env["ONEUPTIME_URL"] || "https://oneuptime.com",
|
process.env["ONEUPTIME_URL"] || "https://oneuptime.com",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import logger from "CommonServer/Utils/Logger";
|
|||||||
import CopilotActionUtil from "./Utils/CopilotAction";
|
import CopilotActionUtil from "./Utils/CopilotAction";
|
||||||
import CopilotActionType from "Common/Types/Copilot/CopilotActionType";
|
import CopilotActionType from "Common/Types/Copilot/CopilotActionType";
|
||||||
import CopilotAction from "Model/Models/CopilotAction";
|
import CopilotAction from "Model/Models/CopilotAction";
|
||||||
import { FixNumberOfCodeEventsInEachRun } from "./Config";
|
import { FixNumberOfCodeEventsInEachRun, GetIsCopilotDisabled } from "./Config";
|
||||||
import CopiotActionTypeOrder from "./Types/CopilotActionTypeOrder";
|
import CopiotActionTypeOrder from "./Types/CopilotActionTypeOrder";
|
||||||
import CopilotActionService, {
|
import CopilotActionService, {
|
||||||
CopilotExecutionResult,
|
CopilotExecutionResult,
|
||||||
@@ -25,6 +25,13 @@ import CopilotActionProcessingException from "./Exceptions/CopilotActionProcessi
|
|||||||
let currentFixCount: number = 1;
|
let currentFixCount: number = 1;
|
||||||
|
|
||||||
const init: PromiseVoidFunction = async (): Promise<void> => {
|
const init: PromiseVoidFunction = async (): Promise<void> => {
|
||||||
|
|
||||||
|
// check if copilot is disabled.
|
||||||
|
if(GetIsCopilotDisabled()) {
|
||||||
|
logger.info("Copilot is disabled. Exiting.");
|
||||||
|
haltProcessWithSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
await CodeRepositoryUtil.setAuthorIdentity({
|
await CodeRepositoryUtil.setAuthorIdentity({
|
||||||
email: "copilot@oneuptime.com",
|
email: "copilot@oneuptime.com",
|
||||||
name: "OneUptime Copilot",
|
name: "OneUptime Copilot",
|
||||||
@@ -170,6 +177,7 @@ const init: PromiseVoidFunction = async (): Promise<void> => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(e);
|
logger.error(e);
|
||||||
currentRetryCount++;
|
currentRetryCount++;
|
||||||
|
CodeRepositoryUtil.discardAllChangesOnCurrentBranch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,6 +185,11 @@ If you have any feedback or suggestions, please let us know. We would love to h
|
|||||||
isActionComplete = await this.isActionComplete(data);
|
isActionComplete = await this.isActionComplete(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data = await this.onAfterExecute(data);
|
||||||
|
|
||||||
|
// write to disk.
|
||||||
|
await this.writeToDisk({ data });
|
||||||
|
|
||||||
const onAfterExecuteActionScript: string | null =
|
const onAfterExecuteActionScript: string | null =
|
||||||
await CodeRepositoryUtil.getRepoScript({
|
await CodeRepositoryUtil.getRepoScript({
|
||||||
scriptType: RepoScriptType.OnAfterCopilotAction,
|
scriptType: RepoScriptType.OnAfterCopilotAction,
|
||||||
@@ -204,7 +209,7 @@ If you have any feedback or suggestions, please let us know. We would love to h
|
|||||||
logger.info("on-after-copilot-action script executed successfully");
|
logger.info("on-after-copilot-action script executed successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
return await this.onAfterExecute(data);
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async _getPrompt(
|
protected async _getPrompt(
|
||||||
@@ -240,6 +245,30 @@ If you have any feedback or suggestions, please let us know. We would love to h
|
|||||||
return data.input.files[data.input.currentFilePath]?.fileContent as string;
|
return data.input.files[data.input.currentFilePath]?.fileContent as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async writeToDisk(data: { data: CopilotProcess }): Promise<void> {
|
||||||
|
// write all the modified files.
|
||||||
|
|
||||||
|
const processResult: CopilotProcess = data.data;
|
||||||
|
|
||||||
|
for (const filePath in processResult.result.files) {
|
||||||
|
const fileCommitHash: string =
|
||||||
|
processResult.result.files[filePath]!.gitCommitHash;
|
||||||
|
|
||||||
|
logger.info(`Writing file: ${filePath} ${fileCommitHash}`);
|
||||||
|
|
||||||
|
const code: string = processResult.result.files[filePath]!.fileContent;
|
||||||
|
|
||||||
|
await CodeRepositoryUtil.writeToFile({
|
||||||
|
filePath: filePath,
|
||||||
|
content: code,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async discardAllChanges(): Promise<void> {
|
||||||
|
await CodeRepositoryUtil.discardAllChangesOnCurrentBranch();
|
||||||
|
}
|
||||||
|
|
||||||
public async splitInputCode(data: {
|
public async splitInputCode(data: {
|
||||||
copilotProcess: CopilotProcess;
|
copilotProcess: CopilotProcess;
|
||||||
itemSize: number;
|
itemSize: number;
|
||||||
|
|||||||
@@ -94,24 +94,8 @@ export default class CopilotActionService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// write all the modified files.
|
// write all the modified files.
|
||||||
|
|
||||||
const filePaths: string[] = Object.keys(processResult.result.files);
|
const filePaths: string[] = Object.keys(processResult.result.files);
|
||||||
|
|
||||||
for (const filePath in processResult.result.files) {
|
|
||||||
const fileCommitHash: string =
|
|
||||||
processResult.result.files[filePath]!.gitCommitHash;
|
|
||||||
|
|
||||||
logger.info(`Writing file: ${filePath}`);
|
|
||||||
logger.info(`Commit Hash: ${fileCommitHash}`);
|
|
||||||
|
|
||||||
const code: string = processResult.result.files[filePath]!.fileContent;
|
|
||||||
|
|
||||||
await CodeRepositoryUtil.writeToFile({
|
|
||||||
filePath: filePath,
|
|
||||||
content: code,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// run on before commit script. This is the place where we can run tests.
|
// run on before commit script. This is the place where we can run tests.
|
||||||
|
|
||||||
const onBeforeCommitScript: string | null =
|
const onBeforeCommitScript: string | null =
|
||||||
|
|||||||
@@ -375,6 +375,7 @@ services:
|
|||||||
CODE_REPOSITORY_PASSWORD: ${COPILOT_CODE_REPOSITORY_PASSWORD}
|
CODE_REPOSITORY_PASSWORD: ${COPILOT_CODE_REPOSITORY_PASSWORD}
|
||||||
CODE_REPOSITORY_USERNAME: ${COPILOT_CODE_REPOSITORY_USERNAME}
|
CODE_REPOSITORY_USERNAME: ${COPILOT_CODE_REPOSITORY_USERNAME}
|
||||||
ONEUPTIME_LLAMA_SERVER_URL: ${COPILOT_ONEUPTIME_LLAMA_SERVER_URL}
|
ONEUPTIME_LLAMA_SERVER_URL: ${COPILOT_ONEUPTIME_LLAMA_SERVER_URL}
|
||||||
|
DISABLE_COPILOT: ${DISABLE_COPILOT}
|
||||||
logging:
|
logging:
|
||||||
driver: "local"
|
driver: "local"
|
||||||
options:
|
options:
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
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
|
|
||||||
environment:
|
|
||||||
- LOG_LEVEL=INFO
|
|
||||||
build:
|
|
||||||
network: host
|
|
||||||
context: .
|
|
||||||
dockerfile: ./Copilot/Dockerfile
|
|
||||||
|
|
||||||
networks:
|
|
||||||
oneuptime:
|
|
||||||
driver: bridge
|
|
||||||
@@ -337,6 +337,32 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: ./E2E/Dockerfile
|
dockerfile: ./E2E/Dockerfile
|
||||||
|
|
||||||
|
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
|
||||||
|
environment:
|
||||||
|
- LOG_LEVEL=INFO
|
||||||
|
build:
|
||||||
|
network: host
|
||||||
|
context: .
|
||||||
|
dockerfile: ./Copilot/Dockerfile
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres:
|
postgres:
|
||||||
clickhouse:
|
clickhouse:
|
||||||
|
|||||||
@@ -46,10 +46,6 @@
|
|||||||
"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",
|
"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",
|
"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",
|
"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",
|
||||||
"dev-copilot": "npm run prerun && export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.copilot.yml up --remove-orphans -d $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",
|
"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",
|
"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",
|
"logs": "export $(grep -v '^#' config.env | xargs) && docker compose logs --tail=100 -f $npm_config_services",
|
||||||
|
|||||||
Reference in New Issue
Block a user