mirror of
https://github.com/kerberos-io/agent.git
synced 2026-03-09 20:52:07 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be0277432b | ||
|
|
a3006f3b9f | ||
|
|
d4e10083c4 | ||
|
|
898a11868e |
3
.github/workflows/docker-dev.yml
vendored
3
.github/workflows/docker-dev.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Docker Development build
|
||||
name: Docker development build
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -35,7 +35,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
architecture: [arm64, arm/v7, arm/v6]
|
||||
#architecture: [arm64, arm/v7]
|
||||
steps:
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
|
||||
4
.github/workflows/docker-nightly.yml
vendored
4
.github/workflows/docker-nightly.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Docker Nightly build
|
||||
name: Docker nightly build
|
||||
|
||||
on:
|
||||
# Triggers the workflow every day at 9PM (CET).
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
architecture: [arm64, arm/v7]
|
||||
architecture: [arm64, arm/v7, arm/v6]
|
||||
steps:
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
|
||||
14
.github/workflows/docker.yml
vendored
14
.github/workflows/docker.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Docker Production build
|
||||
name: Docker master build
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
- name: Run Buildx with output
|
||||
run: docker buildx build --platform linux/$(echo ${{matrix.architecture}} | tr - /) -t $REPO-arch:arch-$(echo ${{matrix.architecture}} | tr / -)-${{steps.short-sha.outputs.sha}} --output type=tar,dest=output-${{matrix.architecture}}.tar .
|
||||
- name: Strip binary
|
||||
run: mkdir -p output/ && tar -xf output-${{matrix.architecture}}.tar -C output && rm output-${{matrix.architecture}}.tar && cd output/ && tar -cf ../output-${{matrix.architecture}}.tar -C home/agent . && rm -rf output
|
||||
run: mkdir -p output/ && tar -xf output-${{matrix.architecture}}.tar -C output && rm output-${{matrix.architecture}}.tar && cd output/ && tar -cf ../agent-${{matrix.architecture}}.tar -C home/agent . && rm -rf output
|
||||
- uses: rickstaa/action-create-tag@v1
|
||||
with:
|
||||
tag: ${{ steps.short-sha.outputs.sha }}
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
latest: true
|
||||
name: ${{ steps.short-sha.outputs.sha }}
|
||||
tag: ${{ steps.short-sha.outputs.sha }}
|
||||
artifacts: "output-${{matrix.architecture}}.tar"
|
||||
artifacts: "agent-${{matrix.architecture}}.tar"
|
||||
build-other:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
needs: build-amd64
|
||||
strategy:
|
||||
matrix:
|
||||
architecture: [arm64, arm-v7]
|
||||
architecture: [arm64, arm-v7, arm-v6]
|
||||
steps:
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
- name: Available platforms
|
||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||
- name: Run Buildx
|
||||
run: docker buildx build --platform linux/$(echo ${{matrix.architecture}} | tr - /) -t $REP-arch:arch-${{matrix.architecture}}-${{steps.short-sha.outputs.sha}} --push .
|
||||
run: docker buildx build --platform linux/$(echo ${{matrix.architecture}} | tr - /) -t $REPO-arch:arch-${{matrix.architecture}}-${{steps.short-sha.outputs.sha}} --push .
|
||||
- name: Create new and append to manifest
|
||||
run: docker buildx imagetools create --append -t $REPO:${{ steps.short-sha.outputs.sha }} $REPO-arch:arch-${{matrix.architecture}}-${{steps.short-sha.outputs.sha}}
|
||||
- name: Create new and append to manifest latest
|
||||
@@ -89,7 +89,7 @@ jobs:
|
||||
- name: Run Buildx with output
|
||||
run: docker buildx build --platform linux/$(echo ${{matrix.architecture}} | tr - /) -t $REPO-arch:arch-$(echo ${{matrix.architecture}} | tr / -)-${{steps.short-sha.outputs.sha}} --output type=tar,dest=output-${{matrix.architecture}}.tar .
|
||||
- name: Strip binary
|
||||
run: mkdir -p output/ && tar -xf output-${{matrix.architecture}}.tar -C output && rm output-${{matrix.architecture}}.tar && cd output/ && tar -cf ../output-${{matrix.architecture}}.tar -C home/agent . && rm -rf output
|
||||
run: mkdir -p output/ && tar -xf output-${{matrix.architecture}}.tar -C output && rm output-${{matrix.architecture}}.tar && cd output/ && tar -cf ../agent-${{matrix.architecture}}.tar -C home/agent . && rm -rf output
|
||||
- name: Create a release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
@@ -97,5 +97,5 @@ jobs:
|
||||
allowUpdates: true
|
||||
name: ${{ steps.short-sha.outputs.sha }}
|
||||
tag: ${{ steps.short-sha.outputs.sha }}
|
||||
artifacts: "output-${{matrix.architecture}}.tar"
|
||||
artifacts: "agent-${{matrix.architecture}}.tar"
|
||||
|
||||
@@ -107,6 +107,7 @@ RUN apk update && apk add ca-certificates curl libstdc++ libc6-compat --no-cache
|
||||
# Try running agent
|
||||
|
||||
RUN mv /agent/* /home/agent/
|
||||
RUN cp /home/agent/mp4fragment /usr/local/bin/
|
||||
RUN /home/agent/main version
|
||||
|
||||
#######################
|
||||
|
||||
@@ -110,6 +110,7 @@ As described before a Kerberos Agent is a container, which can be deployed throu
|
||||
|
||||
We have documented the different deployment models [in the `deployments` directory](https://github.com/kerberos-io/agent/tree/master/deployments) of this repository. There you'll learn and find how to deploy using:
|
||||
|
||||
- [Static binary](https://github.com/kerberos-io/agent/tree/master/deployments#0-static-binary)
|
||||
- [Docker](https://github.com/kerberos-io/agent/tree/master/deployments#1-docker)
|
||||
- [Docker Compose](https://github.com/kerberos-io/agent/tree/master/deployments#2-docker-compose)
|
||||
- [Kubernetes](https://github.com/kerberos-io/agent/tree/master/deployments#3-kubernetes)
|
||||
|
||||
@@ -6,6 +6,7 @@ Due to it's nature, of acting as a micro service, there are many different ways
|
||||
|
||||
We will discuss following deployment models.
|
||||
|
||||
- [0. Static binary](#0-static-binary)
|
||||
- [1. Docker](#1-docker)
|
||||
- [2. Docker Compose](#2-docker-compose)
|
||||
- [3. Kubernetes](#3-kubernetes)
|
||||
@@ -14,6 +15,19 @@ We will discuss following deployment models.
|
||||
- [6. Terraform](#6-terraform)
|
||||
- [7. Salt](#7-salt)
|
||||
|
||||
## 0. Static binary
|
||||
|
||||
Kerberos Agents are now also shipped as static binaries. Within the Docker image build, we are extracting the Kerberos Agent binary and are [uploading them to the releases page](https://github.com/kerberos-io/agent/releases) in the repository. By opening a release you'll find a `.tar` with the relevant files.
|
||||
|
||||
- `main`: this is the Kerberos Agent binary.
|
||||
- `data`: the folder containing the recorded video, configuration, etc.
|
||||
- `mp4fragment`: a binary to transform MP4s to Fragmented MP4s.
|
||||
- `www`: the Kerberos Agent ui (compiled React app).
|
||||
|
||||
You can run the binary as following on port `8080`:
|
||||
|
||||
main run cameraname 8080
|
||||
|
||||
## 1. Docker
|
||||
|
||||
Leveraging `docker` is probably one of the easiest way to run and test the Kerberos Agent. Thanks to it's multi-architecture images you could run it on almost every machine. The `docker` approach is perfect for running one or two cameras in a (single machine) home deployment, a POC to verify its capabilities, or testing if your old/new IP camera is operational with our Kerberos Agent.
|
||||
|
||||
@@ -14,6 +14,8 @@ import (
|
||||
"gopkg.in/DataDog/dd-trace-go.v1/profiler"
|
||||
)
|
||||
|
||||
var VERSION = "3.0.0"
|
||||
|
||||
func main() {
|
||||
|
||||
// You might be interested in debugging the agent.
|
||||
@@ -48,7 +50,6 @@ func main() {
|
||||
}
|
||||
|
||||
// Start the show ;)
|
||||
const VERSION = "3.0"
|
||||
action := os.Args[1]
|
||||
|
||||
timezone, _ := time.LoadLocation("CET")
|
||||
|
||||
@@ -224,7 +224,8 @@ func HandleHeartBeat(configuration *models.Configuration, communication *models.
|
||||
|
||||
var object = fmt.Sprintf(`{
|
||||
"key" : "%s",
|
||||
"version" : "%s",
|
||||
"version" : "3.0.0",
|
||||
"release" : "%s",
|
||||
"cpuid" : "%s",
|
||||
"clouduser" : "%s",
|
||||
"cloudpublickey" : "%s",
|
||||
@@ -252,8 +253,6 @@ func HandleHeartBeat(configuration *models.Configuration, communication *models.
|
||||
"raspberrypi" : false
|
||||
}`, config.Key, system.Version, system.CPUId, username, key, name, isEnterprise, system.Hostname, system.Architecture, system.TotalMemory, system.UsedMemory, system.FreeMemory, system.MACs, system.IPs, "0", "0", "0", uptimeString, config.HubSite, onvifEnabled)
|
||||
|
||||
fmt.Println(object)
|
||||
|
||||
var jsonStr = []byte(object)
|
||||
buffy := bytes.NewBuffer(jsonStr)
|
||||
req, _ := http.NewRequest("POST", url, buffy)
|
||||
@@ -486,7 +485,6 @@ func VerifyPersistence(c *gin.Context) {
|
||||
|
||||
if config.Cloud == "s3" {
|
||||
|
||||
//fmt.Println("Uploading...")
|
||||
// timestamp_microseconds_instanceName_regionCoordinates_numberOfChanges_token
|
||||
// 1564859471_6-474162_oprit_577-283-727-375_1153_27.mp4
|
||||
// - Timestamp
|
||||
|
||||
@@ -4,6 +4,7 @@ type System struct {
|
||||
CPUId string `json:"cpu_idle" bson:"cpu_idle"`
|
||||
Hostname string `json:"hostname" bson:"hostname"`
|
||||
Version string `json:"version" bson:"version"`
|
||||
Release string `json:"release" bson:"release"`
|
||||
BootTime uint64 `json:"boot_time" bson:"boot_time"`
|
||||
KernelVersion string `json:"kernel_version" bson:"kernel_version"`
|
||||
MACs []string `json:"macs" bson:"macs"`
|
||||
|
||||
@@ -253,7 +253,7 @@ func CreateFragmentedMP4(fullName string, fragmentedDuration int64) {
|
||||
path, _ := os.Getwd()
|
||||
duration := fragmentedDuration * 1000
|
||||
// This timescale is crucial, as it should be the same as the one defined in JOY4.
|
||||
cmd := exec.Command("/agent/mp4fragment", "--timescale", "10000", "--fragment-duration", strconv.FormatInt(duration, 10), fullName, fullName+"f.mp4")
|
||||
cmd := exec.Command("mp4fragment", "--timescale", "10000", "--fragment-duration", strconv.FormatInt(duration, 10), fullName, fullName+"f.mp4")
|
||||
cmd.Dir = path
|
||||
log.Log.Info(cmd.String())
|
||||
var out bytes.Buffer
|
||||
|
||||
Reference in New Issue
Block a user