Skip to content

Commit

Permalink
rename sub projects to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricve committed Dec 29, 2020
1 parent 7d5f662 commit ca99054
Show file tree
Hide file tree
Showing 67 changed files with 45 additions and 44 deletions.
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ 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:
- image: cimg/node:15.5.0
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
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
6 changes: 3 additions & 3 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
frontend/node_modules
frontend/build
web/node_modules
web/build
.idea
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ go:
- tip

before_install:
- cd backend
- cd machinery
- go mod download

script:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 - && \
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion backend/go.mod → machinery/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/kerberos-io/opensource/backend
module github.com/kerberos-io/opensource/machinery

go 1.15

Expand Down
1 change: 1 addition & 0 deletions backend/go.sum → machinery/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions backend/main.go → machinery/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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()

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion frontend/package.json → web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ca99054

Please sign in to comment.