Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 92 additions & 28 deletions bun.lock

Large diffs are not rendered by default.

146 changes: 95 additions & 51 deletions docs/Components/Iglu Builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_position: 1
The **Iglu Builder** is the component of the Iglu Project that can build [nix derivations](https://nix.dev/manual/nix/2.25/language/derivations) and push it to [cachix](https://www.cachix.org/) compatible nix caches like our [Iglu Cache](/docs/Components/Iglu%20Cache).

## Websocket
This is the documentation to the [`/api/v1/build` Websocket](/docs/API/Iglu%20Builder/build)
This is the documentation of the [`/api/v1/build` Websocket](/docs/Developer/API/Iglu%20Builder/build)

:::info
This Endpoint accepts only **one** connection simultaneously!
Expand All @@ -23,53 +23,79 @@ To start a build job you have to send a json with this schema:
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"git": {
"git_config": {
"type": "object",
"properties": {
"repository": { "type": "string" },
"builder_id": { "type": "number" },
"id": {"type": "number"},
"branch": { "type": "string" },
"gitUsername": { "type": "string" },
"gitKey": { "type": "string" },
"requiresAuth": { "type": "boolean" },
"noClone": { "type": "boolean" }
"gitusername": { "type": "string" },
"gitkey": { "type": "string" },
"requiresauth": { "type": "boolean" },
"noclone": { "type": "boolean" }
},
"required": ["noClone"],
"required": ["noclone"],
"additionalProperties": false
},
"buildOptions": {
"builder" : {
"type": "object",
"properties": {
"id": {"type": "number"},
"cache_id": {"type": "number"},
"name":{"type": "string"},
"description": {"type": "string"},
"enabled": {"type": "boolean"},
"trigger": {"type": "string"},
"cron": {"type": "string"},
"arch": {"type": "string"},
"webhookurl": {"type": "string"}
},
"additionalProperties": false
},
"cachix_config": {
"type": "object",
"properties": {
"id":{"type": "number"},
"builder_id":{"type": "number"},
"push":{"type": "boolean"},
"target": {"type": "string"},
"apikey": {"type": "string"},
"signingkey": {"type": "string"},
"buildoutputdir": {"type": "string"}
},
"additionalProperties": false
},
"build_options": {
"type": "object",
"properties": {
"id": {"type": "number"},
"builder_id": {"type": "number"},
"cores": { "type": "number" },
"maxJobs": { "type": "number" },
"maxjobs": { "type": "number" },
"keep_going": { "type": "boolean" },
"extraArgs": { "type": "string" },
"extraargs": { "type": "string" },
"substituters": {
"type": "array",
"items": { "type": "string" }
"items": {
"type": "object",
"properties":{
"url": {"type": "string"},
"public_signing_keys": {
"type": "array",
"items": {"type": "string"}
}
} }
},
"trustedPublicKeys": {
"type": "array",
"items": { "type": "string" }
},
"command": { "type": "string" },
"cachix": {
"type": "object",
"properties": {
"push": { "type": "boolean" },
"target": { "type": "string" },
"apiKey": { "type": "string" },
"signingKey": { "type": "string" }
},
"required": ["push"],
"additionalProperties": false
}
"parallelbuilds": {"type": "boolean"},
"command": {"type": "string"}
},
"required": ["command", "cachix"],
"required": ["command"],
"additionalProperties": false
}
},
"required": ["git", "buildOptions"],
"additionalProperties": true
"required": ["git_config", "build_options", "cachix_config"],
"additionalProperties": true
}
```
</details>
Expand All @@ -79,18 +105,27 @@ For example:
This will clone `https://github.com/iglu-sh/builder` and build the derivation `iglu-builder`. This derivation will be pushed to `https://cache.example.com/default`
```json
{
"git": {
"noClone": false
"repository": "https://github.com/iglu-sh/builder"
"git_config": {
"noclone": false,
"repository": "https://github.com/Svenum/holynix.git"
},
"build_options": {
"command": "nix build .#nixosConfigurations.srv-raspi5.config.system.build.toplevel",
"substituters": [
{
"url": "https://nix-community.cachix.org",
"public_signing_keys": [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
]
}
]
},
"buildOptions": {
"command": "nix build .#iglu-builder",
"cachix": {
"push": true,
"target": "http://cache.example.com/default",
"apiKey": "0197178f-b4f3-7000-acai-fec951e85504",
"signingKey": "SgykdnDTu9iRkZZQhaif81C22fUERBiagMvD2oeMBUaE/4yAPYL3PJHinFVWkuvwUwp1MhSSKQ7pVlO4FGGCSQ=="
}
"cachix_config":{
"push": true,
"target": "https://example.com/default",
"apikey": "xxxxxxxx-xxxx-xxxx-xxxxxxxx",
"signingkey": "xxxx"

}
}
```
Expand All @@ -112,9 +147,10 @@ Every response has this schema:
"type": "string",
"enum": ["failed", "success", "starting", "running"]
},
"childExitCode": { "type": "number" }
"childExitCode": { "type": "number" },
"timestamp": { "type": "number" }
}
"required": [ "jobStatus" ],
"required": [ "jobStatus", "timestamp" ],
"additionalProperties": false
}
```
Expand All @@ -125,7 +161,8 @@ Every response has this schema:
```json
{
"error": "A build job is already running.",
"jobStatus": "running"
"jobStatus": "running",
"timestamp": TIMESTAMP
}
```
</details>
Expand All @@ -135,7 +172,8 @@ Every response has this schema:
```json
{
"msg": "Start Building",
"jobStatus": "starting"
"jobStatus": "starting",
"timestamp": TIMESTAMP
}
```
</details>
Expand All @@ -145,7 +183,8 @@ Every response has this schema:
```json
{
"stdout": "SOME_OUTPUT",
"jobStatus": "running"
"jobStatus": "running",
"timestamp": TIMESTAMP
}
```
</details>
Expand All @@ -156,7 +195,8 @@ Every response has this schema:
{
"error": "Invalid command: 'YOUR_COMMAND'",
"buildExitCode": 2,
"jobStatus": "failed"
"jobStatus": "failed",
"timestamp": TIMESTAMP
}
```
</details>
Expand All @@ -167,7 +207,8 @@ Every response has this schema:
{
"error": "Something went wrong while building. Builder exited with error code CHILD_EXIT_CODE",
"buildExitCode": CHILD_EXIT_CODE,
"jobStatus": "failed"
"jobStatus": "failed",
"timestamp": TIMESTAMP
}
```
</details>
Expand All @@ -178,7 +219,8 @@ Every response has this schema:
{
"msg": "Build was successfull",
"buildExitCode": 0,
"jobStatus": "success"
"jobStatus": "success",
"timestamp": TIMESTAMP
}
```
</details>
Expand All @@ -188,7 +230,8 @@ Every response has this schema:
```json
{
"error": "JSON schema is not valid.",
"jobStatus": "failed"
"jobStatus": "failed",
"timestamp": TIMESTAMP
}
```
</details>
Expand All @@ -198,7 +241,8 @@ Every response has this schema:
```json
{
"error": "Not a valid JSON",
"jobStatus": "failed"
"jobStatus": "failed",
"timestamp": TIMESTAMP
}
```
</details>
11 changes: 11 additions & 0 deletions docs/Components/Iglu Cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ sidebar_position: 2

## Introduction
The **Iglu Cache** is the component of the Iglu Project that stores [nix derivations](https://nix.dev/manual/nix/2.25/language/derivations). This Cache is compatible with the [cachix](https://www.cachix.org/) client.

## Metrics
The **Iglu Cache** has its own [Prometheus](https://prometheus.io/) endpoint (default: `http://localhost:9464/metrics`).
This endpoint can be disabled by setting the env `PROM_ENABLE` to `false`.

It provides the following metrics **per** cache:
|name|description|example|
|-|-|-|
|`iglu_cache_derivation_count`|Number of derivations in the cache|`iglu_cache_derivation_count{cache="test",uri="http://localhost:3000"} 6`|
|`iglu_cache_size`|Size of the cache in byte|`iglu_cache_size{cache="default",uri="http://localhost:3000"} 11640438`|
|`iglu_cache_requests_total`|Request count per cache|`iglu_cache_requests_total{cache="default",uri="http://localhost:3000"} 6`|
65 changes: 65 additions & 0 deletions docs/Developer/API/Iglu Builder/build.api.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
id: build
title: "/api/v1/build"
description: "Create a websocket to start a build job."
sidebar_label: "/api/v1/build"
hide_title: true
hide_table_of_contents: true
api: eJzNWOtu2zYUfhVCw4B2iHzZuqALsB+Oe0vStFnTrFuzIKCkY4mJRKq8JE6CAHuHvcKeob/6L2+yJ9k5lKxYtls7wTYMMRCbIr+P5/A7F/EqSMDEWpRWKBlsBEMN3ALj7Bwio+JTsMwqZizXFgcjJ/KEnaiow36Tu0oDE3KkdMFpNeORcjg9A/auWXyhHIu5ZCMhE3aYgYajB91ExaY7VEWpJEhrultp7r7+trdJ6KC/alY/DNYCVYL28FsJbs9vAEc1GFxswAQbV0G/16d/bUP2z4WNMyFTtqeVVbHKDfvr9z9oa/vV1s6FThh3oxQi7mwHUcdhYzUBFmAMT4G+GpD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CkrQ/SmaR0hT8DG+Lq1AtMvHouA5sJqx5JrnOeRITG8Sn+N4jBynAOVxqkhGy6P1mdLWAPaOkkUg2DPIkKKVJCdtFYyt5hiwZoV078zNn/aSmrTJiQ506grs5dqhG4bowkgZHxPGRQa16Cwdzy0H15pfzFG8xHoL7IxaCCE5vmL40GL70xjY61soFkq3rdH7lBoqMaSuGcb52uJzU0eKsTIdpX1klS5C3xzX6eUY88tdDL75OBqhJ713JZvKMYssboy53djMhsL+xvqr4Yvkyfc//PLou77qpe8uymhXDw7enEbb/fX3e7s/PXtuyvjJfnby64+YT65vc8aU9T7RTGRa5567VItG4Qt6jrpeTJLMUgEOnLl0mCexRZRNuxZuwgjl3fIFeqG6xbhjua8T1BdW0ZZvF3kODNzKexpiEGew4JYCNAZEOJAW6wndIJwLoNsEfB1cYy9Vapgic6oo7RAYwRVgM0XXIVRM6QzoRSvoTi5HjAfFLR3WSl/Y9mDl7J71g2tM4HSJ431cb57uY5qOF8vjfPOaYVnCD931JCr2gV51J2rkB2cROswvmYzg15JulOrZh346OpOC9ejBgssCgRNCkz2kCxWyrdpGr9Pr9H18KWNRKGRD9b4S1OY1Ppl52WguZf5/F1610C2m3y725NUFQZ2wqpM+rK/B8OQyNJwGrq4ibuBA59fXNPzBAV3aHOJXbA4EvfTQr2npPH/6FuX0N3haBL4=
sidebar_class_name: "get api-method"
info_path: docs/Developer/API/Iglu Builder/iglu-builder-api
custom_edit_url: null
hide_send_button: true
---

import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import ParamsDetails from "@theme/ParamsDetails";
import RequestSchema from "@theme/RequestSchema";
import StatusCodes from "@theme/StatusCodes";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";
import Heading from "@theme/Heading";

<Heading
as={"h1"}
className={"openapi__heading"}
children={"/api/v1/build"}
>
</Heading>

<MethodEndpoint
method={"get"}
path={"/build"}
context={"endpoint"}
>

</MethodEndpoint>



Create a websocket to start a build job.
More information about the Websocket can be found [here](/docs/Components/Iglu%20Builder#Websocket)

<ParamsDetails
parameters={undefined}
>

</ParamsDetails>

<RequestSchema
title={"Body"}
body={undefined}
>

</RequestSchema>

<StatusCodes
id={undefined}
label={undefined}
responses={{"101":{"description":"Switching Protocols – WebSocket wird aufgebaut.","x-websocket":{"message":{"send":{"description":"JSON zum Starten eines Build-Jobs.","content":{"application/json":{"type":"object","required":["git_config","build_options","cachix_config"],"properties":{"git_config":{"type":"object","required":["noclone"],"properties":{"repository":{"type":"string","description":"Git Repository URL","example":"https://github.com/user/repo.git"},"builder_id":{"type":"number","description":"ID des zugehörigen Builders","example":1},"id":{"type":"number","description":"Eindeutige ID der Git-Konfiguration","example":1},"branch":{"type":"string","description":"Git Branch Name","example":"main"},"gitusername":{"type":"string","description":"Git Benutzername für Authentifizierung","example":"username"},"gitkey":{"type":"string","format":"password","description":"Git Authentifizierungsschlüssel"},"requiresauth":{"type":"boolean","description":"Gibt an, ob Authentifizierung erforderlich ist","example":false},"noclone":{"type":"boolean","description":"Verhindert das Klonen des Repositories","example":false}},"additionalProperties":false,"title":"GitConfig"},"builder":{"type":"object","properties":{"id":{"type":"number","description":"Eindeutige Builder ID","example":1},"cache_id":{"type":"number","description":"ID des zugehörigen Caches","example":1},"name":{"type":"string","description":"Name des Builders","example":"Production Builder"},"description":{"type":"string","description":"Beschreibung des Builders","example":"Hauptbuilder für Production"},"enabled":{"type":"boolean","description":"Gibt an, ob der Builder aktiviert ist","example":true},"trigger":{"type":"string","description":"Trigger-Typ für den Build","example":"manual","enum":["manual","webhook","cron"]},"cron":{"type":"string","description":"Cron-Expression für geplante Builds","example":"0 0 * * *"},"arch":{"type":"string","description":"Ziel-Architektur","example":"x86_64-linux"},"webhookurl":{"type":"string","format":"uri","description":"Webhook URL für Benachrichtigungen","example":"https://example.com/webhook"}},"additionalProperties":false,"title":"Builder"},"cachix_config":{"type":"object","properties":{"id":{"type":"number","description":"Eindeutige Cachix-Konfiguration ID","example":1},"builder_id":{"type":"number","description":"ID des zugehörigen Builders","example":1},"push":{"type":"boolean","description":"Aktiviert Push zu Cachix","example":true},"target":{"type":"string","description":"Cachix Cache-Name","example":"my-cache"},"apikey":{"type":"string","format":"password","description":"Cachix API Key"},"signingkey":{"type":"string","format":"password","description":"Signing Key für Cache"},"buildoutputdir":{"type":"string","description":"Verzeichnis für Build-Outputs","example":"/var/lib/builds"}},"additionalProperties":false,"title":"CachixConfig"},"build_options":{"type":"object","required":["command"],"properties":{"id":{"type":"number","description":"Eindeutige Build-Options ID","example":1},"builder_id":{"type":"number","description":"ID des zugehörigen Builders","example":1},"cores":{"type":"number","description":"Anzahl der zu verwendenden CPU-Kerne","minimum":1,"example":4},"maxjobs":{"type":"number","description":"Maximale Anzahl paralleler Jobs","minimum":1,"example":8},"keep_going":{"type":"boolean","description":"Fortsetzen bei Fehlern","example":false},"extraargs":{"type":"string","description":"Zusätzliche Build-Argumente","example":"--verbose"},"substituters":{"type":"array","description":"Liste von Binary Cache Substituters","items":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"URL des Substituters","example":"https://cache.nixos.org"},"public_signing_keys":{"type":"array","description":"Liste von öffentlichen Signing Keys","items":{"type":"string","example":"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="}}},"title":"Substituter"}},"parallelbuilds":{"type":"boolean","description":"Aktiviert parallele Builds","example":true},"command":{"type":"string","description":"Auszuführender Build-Befehl","example":"nix build"}},"additionalProperties":false,"title":"BuildOptions"}},"additionalProperties":true,"title":"buildJob"}}},"receive":{"description":"Server-Antworten wie Status, Logs oder Fehler."}}}}}}
>

</StatusCodes>



Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
id: healthcheck
title: "healthcheck"
title: "/api/v1/healthcheck"
description: "Endpoint to check the service health of the Builder"
sidebar_label: "healthcheck"
sidebar_label: "/api/v1/healthcheck"
hide_title: true
hide_table_of_contents: true
api: eJylUsFu3CAQ/RU6p1Si603VXrhtpSjaQ6sc0tPKBx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mgMnxL7nzm8I9Cq0dxOo4qWXVgH3Z7gqN6bsZePgGlyI3WENn8Ubly237/YkU+3z3Q2vwCVuNEEw==
sidebar_class_name: "get api-method"
info_path: docs/API/Iglu Builder/iglu-builder-api
info_path: docs/Developer/API/Iglu Builder/iglu-builder-api
custom_edit_url: null
hide_send_button: true
---
Expand All @@ -23,7 +23,7 @@ import Heading from "@theme/Heading";
<Heading
as={"h1"}
className={"openapi__heading"}
children={"healthcheck"}
children={"/api/v1/healthcheck"}
>
</Heading>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ const sidebar: SidebarsConfig = {
apisidebar: [
{
type: "doc",
id: "API/Iglu Builder/iglu-builder-api",
id: "Developer/API/Iglu Builder/iglu-builder-api",
},
{
type: "category",
label: "UNTAGGED",
items: [
{
type: "doc",
id: "API/Iglu Builder/build",
label: "Start build websocket",
id: "Developer/API/Iglu Builder/build",
label: "/api/v1/build",
className: "api-method get",
},
{
type: "doc",
id: "API/Iglu Builder/healthcheck",
label: "healthcheck",
id: "Developer/API/Iglu Builder/healthcheck",
label: "/api/v1/healthcheck",
className: "api-method get",
},
],
Expand Down
Loading