rename sub projects to avoid confusion

This commit is contained in:
cedricve
2020-12-29 08:28:23 +01:00
parent 7d5f662648
commit ca990543df
67 changed files with 45 additions and 44 deletions

View File

@@ -9,9 +9,9 @@ jobs:
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
steps:
- checkout
- run: cd backend && go mod download
- run: cd backend && go test -v ./...
- run: cd backend && go vet
- run: cd machinery && go mod download
- run: cd machinery && go test -v ./...
- run: cd machinery && go vet
frontend:
docker:
@@ -19,14 +19,14 @@ jobs:
steps:
- checkout
- run: node --version
- run: cd frontend && yarn
- run: cd frontend && yarn test
- run: cd frontend && yarn build
- run: cd web && yarn
- run: cd web && yarn test
- run: cd web && yarn build
workflows:
version: 2
build:
jobs:
- backend
- frontend
- machinery
- web

View File

@@ -22,10 +22,10 @@ jobs:
uses: actions/checkout@v2
- name: Get dependencies
run: cd backend && go mod download
run: cd machinery && go mod download
- name: Build
run: cd backend && go build -v ./...
run: cd machinery && go build -v ./...
- name: Test
run: cd backend && go test -v ./...
run: cd machinery && go test -v ./...

View File

@@ -25,8 +25,8 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Yarn install
run: cd frontend && yarn
run: cd web && yarn
- name: Yarn test
run: cd frontend && yarn test
run: cd web && yarn test
- name: Yarn build
run: cd frontend && yarn build
run: cd web && yarn build

4
.gitignore vendored
View File

@@ -1,3 +1,3 @@
frontend/node_modules
frontend/build
web/node_modules
web/build
.idea

View File

@@ -8,7 +8,7 @@ go:
- tip
before_install:
- cd backend
- cd machinery
- go mod download
script:

View File

@@ -10,8 +10,8 @@ ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH
ENV GOSUMDB=off
RUN mkdir -p /go/src/github.com/kerberos-io/opensource
COPY backend /go/src/github.com/kerberos-io/opensource/backend
COPY frontend /go/src/github.com/kerberos-io/opensource/frontend
COPY machinery /go/src/github.com/kerberos-io/opensource/backend
COPY web /go/src/github.com/kerberos-io/opensource/frontend
# Build react
RUN apt-get install curl && curl -sL https://deb.nodesource.com/setup_14.x | bash - && \

View File

@@ -5,7 +5,7 @@
<br>
<a href="https://circleci.com/gh/kerberos-io/opensource"><img src="https://circleci.com/gh/kerberos-io/opensource.svg?style=svg"/></a>
<a href="https://travis-ci.org/kerberos-io/opensource"><img src="https://travis-ci.org/kerberos-io/opensource.svg?branch=master" alt="Build Status"></a>
<a href="https://pkg.go.dev/github.com/kerberos-io/opensource/backend"><img src="https://pkg.go.dev/badge/github.com/kerberos-io/opensource/backend" alt="PkgGoDev"></a>
<a href="https://pkg.go.dev/github.com/kerberos-io/opensource/machinery"><img src="https://pkg.go.dev/badge/github.com/kerberos-io/opensource/machinery" alt="PkgGoDev"></a>
<a href="https://codecov.io/gh/kerberos-io/opensource"><img src="https://codecov.io/gh/kerberos-io/opensource/branch/master/graph/badge.svg" alt="Coverage Status"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/License-Commons Clause-yellow.svg" alt="License: Commons Clause"></a>
@@ -60,35 +60,35 @@ Kerberos Open Source **will ship in different formats**: Docker, binary, snap, K
## Run
Kerberos Open Source is divided in two parts a `backend` and `frontend`. Both parts live in this repository in their relative folders.
Kerberos Open Source is divided in two parts a `machinery` and `web`. Both parts live in this repository in their relative folders.
### Backend
### Machinery
The `backend` is a **Golang** project which delivers two functions: it acts as the Kerberos Agent, and does the camera processing, on the other hand it acts as a webserver that communicaties directly with the front-end.
The `machinery` is a **Golang** project which delivers two functions: it acts as the Kerberos Agent, and does the camera processing, on the other hand it acts as a webserver that communicates directly with the web (React).
You can simply run the `backend` using following command.
You can simply run the `machinery` using following command.
git clone https://github.com/kerberos-io/opensource
cd backend
go run main.go run mycamername 8080
cd machinery
go run main.go run mycameraname 8080
This will launch the Kerberos Agent and run a webserver on port `8080`. You can change the port by your own preference.
---
### Frontend
### Web
The `frontend` is a **React** project which is the main entry point for an end user to view recordings, a livestream, and modify the configuration of the `backend`
The `web` is a **React** project which is the main entry point for an end user to view recordings, a livestream, and modify the configuration of the `machinery`.
git clone https://github.com/kerberos-io/opensource
cd frontend
cd web
yarn start
This will start a webserver on port `3000`.
#### Build
After making changes you can run the `yarn build` command, this will create a build artifact and move it to the `backend/www` folder. By restarting the backend and navigating to `8080` you will see the React webpage (including your changes) visualised.
After making changes you can run the `yarn build` command, this will create a build artifact and move it to the `machinery/www` folder. By restarting the `machinery` and navigating to `8080` you will see the React webpage (including your changes) visualised.
## FAQ

View File

@@ -1,4 +1,4 @@
module github.com/kerberos-io/opensource/backend
module github.com/kerberos-io/opensource/machinery
go 1.15

View File

@@ -64,6 +64,7 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kerberos-io/opensource v0.0.0-20201228190050-88e6b9a00cf6 h1:bEFRmpDesRc7pflEflUDpYzS8/2euE1i4JHYSC6OAAo=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=

View File

@@ -2,8 +2,8 @@ package main
import (
"fmt"
"github.com/kerberos-io/opensource/backend/src/routers/http"
"github.com/kerberos-io/opensource/backend/src/routers/mqtt"
"github.com/kerberos-io/opensource/machinery/src/routers/http"
"github.com/kerberos-io/opensource/machinery/src/routers/mqtt"
"log"
"os"
)

View File

@@ -6,7 +6,7 @@ import (
"time"
"io/ioutil"
"encoding/json"
"github.com/kerberos-io/opensource/backend/src/models"
"github.com/kerberos-io/opensource/machinery/src/models"
)
func ReadUserConfig() models.User {

View File

@@ -3,7 +3,7 @@ package http
import (
jwt "github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
"github.com/kerberos-io/opensource/backend/src/models"
"github.com/kerberos-io/opensource/machinery/src/models"
"time"
)

View File

@@ -3,15 +3,15 @@ package http
import (
"github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
"github.com/kerberos-io/opensource/backend/src/components"
"github.com/kerberos-io/opensource/backend/src/models"
"github.com/kerberos-io/opensource/machinery/src/components"
"github.com/kerberos-io/opensource/machinery/src/models"
)
func AddRoutes(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware ) {
api := r.Group("/api")
{
api.GET("/install", GetInstallaton)
api.GET("/install", GetInstallation)
api.POST("/install", UpdateInstallation)
api.Use(authMiddleware.MiddlewareFunc())
@@ -24,12 +24,12 @@ func AddRoutes(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware ) {
// GetInstallation godoc
// @Router /api/install [get]
// @ID installation
// @Tags frontend
// @Tags web
// @Summary Get to know if the system was installed before or not.
// @Description Get to know if the system was installed before or not.
// @Success 200 {object} models.APIResponse
func GetInstallaton(c *gin.Context) {
func GetInstallation(c *gin.Context) {
// Get the user configuration
userConfig := components.ReadUserConfig()
@@ -41,7 +41,7 @@ func GetInstallaton(c *gin.Context) {
// UpdateInstallation godoc
// @Router /api/install [post]
// @ID update-installation
// @Tags frontend
// @Tags web
// @Summary If not yet installed, initiate the user configuration.
// @Description If not yet installed, initiate the user configuration.
// @Success 200 {object} models.APIResponse

View File

@@ -5,7 +5,7 @@ import (
"github.com/gin-contrib/pprof"
"github.com/gin-gonic/contrib/static"
"github.com/gin-gonic/gin"
_ "github.com/kerberos-io/opensource/backend/docs"
_ "github.com/kerberos-io/opensource/machinery/docs"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"log"
@@ -40,7 +40,7 @@ func StartServer(name string, port string){
// Setup CORS
r.Use(CORS())
// Serve frontend static files
// Serve web static files
r.Use(static.Serve("/", static.LocalFile("./www", true)))
// Add Swagger

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -13,7 +13,7 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && mv build ../backend/www",
"build": "react-scripts build && mv build ../machinery/www",
"test": "react-scripts test",
"eject": "react-scripts eject"
},

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB