diff --git a/.circleci/config.yml b/.circleci/config.yml index e3308a3..29dc4b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 \ No newline at end of file + - machinery + - web \ No newline at end of file diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7dd442e..3c375e2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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 ./... diff --git a/.github/workflows/react.yml b/.github/workflows/react.yml index 7f8164f..b24879e 100644 --- a/.github/workflows/react.yml +++ b/.github/workflows/react.yml @@ -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 diff --git a/.gitignore b/.gitignore index c27f774..0b72224 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -frontend/node_modules -frontend/build +web/node_modules +web/build .idea \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 3b19c60..1f5f12c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ go: - tip before_install: - - cd backend + - cd machinery - go mod download script: diff --git a/Dockerfile b/Dockerfile index a6d65ec..b8072ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 - && \ diff --git a/README.md b/README.md index a0dffb4..174f527 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@
Build Status -PkgGoDev +PkgGoDev Coverage Status License: Commons Clause @@ -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 diff --git a/backend/LICENSE b/machinery/LICENSE similarity index 100% rename from backend/LICENSE rename to machinery/LICENSE diff --git a/backend/README.md b/machinery/README.md similarity index 100% rename from backend/README.md rename to machinery/README.md diff --git a/backend/data/config/config.json b/machinery/data/config/config.json similarity index 100% rename from backend/data/config/config.json rename to machinery/data/config/config.json diff --git a/backend/data/config/user.json b/machinery/data/config/user.json similarity index 100% rename from backend/data/config/user.json rename to machinery/data/config/user.json diff --git a/backend/docs/docs.go b/machinery/docs/docs.go similarity index 100% rename from backend/docs/docs.go rename to machinery/docs/docs.go diff --git a/backend/docs/swagger.json b/machinery/docs/swagger.json similarity index 100% rename from backend/docs/swagger.json rename to machinery/docs/swagger.json diff --git a/backend/docs/swagger.yaml b/machinery/docs/swagger.yaml similarity index 100% rename from backend/docs/swagger.yaml rename to machinery/docs/swagger.yaml diff --git a/backend/go.mod b/machinery/go.mod similarity index 93% rename from backend/go.mod rename to machinery/go.mod index c68365e..131087b 100644 --- a/backend/go.mod +++ b/machinery/go.mod @@ -1,4 +1,4 @@ -module github.com/kerberos-io/opensource/backend +module github.com/kerberos-io/opensource/machinery go 1.15 diff --git a/backend/go.sum b/machinery/go.sum similarity index 99% rename from backend/go.sum rename to machinery/go.sum index 64adc43..53afef7 100644 --- a/backend/go.sum +++ b/machinery/go.sum @@ -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= diff --git a/backend/main.go b/machinery/main.go similarity index 84% rename from backend/main.go rename to machinery/main.go index 6c53e80..9585c6a 100644 --- a/backend/main.go +++ b/machinery/main.go @@ -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" ) diff --git a/backend/src/components/Config.go b/machinery/src/components/Config.go similarity index 92% rename from backend/src/components/Config.go rename to machinery/src/components/Config.go index bf89968..4e8982e 100644 --- a/backend/src/components/Config.go +++ b/machinery/src/components/Config.go @@ -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 { diff --git a/backend/src/components/ONVIF.go b/machinery/src/components/ONVIF.go similarity index 100% rename from backend/src/components/ONVIF.go rename to machinery/src/components/ONVIF.go diff --git a/backend/src/components/ONVIF_test.go b/machinery/src/components/ONVIF_test.go similarity index 100% rename from backend/src/components/ONVIF_test.go rename to machinery/src/components/ONVIF_test.go diff --git a/backend/src/models/api.go b/machinery/src/models/api.go similarity index 100% rename from backend/src/models/api.go rename to machinery/src/models/api.go diff --git a/backend/src/models/config.go b/machinery/src/models/config.go similarity index 100% rename from backend/src/models/config.go rename to machinery/src/models/config.go diff --git a/backend/src/models/user.go b/machinery/src/models/user.go similarity index 100% rename from backend/src/models/user.go rename to machinery/src/models/user.go diff --git a/backend/src/routers/http/Cors.go b/machinery/src/routers/http/Cors.go similarity index 100% rename from backend/src/routers/http/Cors.go rename to machinery/src/routers/http/Cors.go diff --git a/backend/src/routers/http/JWTMiddleware.go b/machinery/src/routers/http/JWTMiddleware.go similarity index 96% rename from backend/src/routers/http/JWTMiddleware.go rename to machinery/src/routers/http/JWTMiddleware.go index 6ec1979..4e92add 100644 --- a/backend/src/routers/http/JWTMiddleware.go +++ b/machinery/src/routers/http/JWTMiddleware.go @@ -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" ) diff --git a/backend/src/routers/http/Routes.go b/machinery/src/routers/http/Routes.go similarity index 83% rename from backend/src/routers/http/Routes.go rename to machinery/src/routers/http/Routes.go index 30d534e..ecc540c 100644 --- a/backend/src/routers/http/Routes.go +++ b/machinery/src/routers/http/Routes.go @@ -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 diff --git a/backend/src/routers/http/Server.go b/machinery/src/routers/http/Server.go similarity index 93% rename from backend/src/routers/http/Server.go rename to machinery/src/routers/http/Server.go index b86cf88..b34a566 100644 --- a/backend/src/routers/http/Server.go +++ b/machinery/src/routers/http/Server.go @@ -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 diff --git a/backend/src/routers/mqtt/Listener.go b/machinery/src/routers/mqtt/Listener.go similarity index 100% rename from backend/src/routers/mqtt/Listener.go rename to machinery/src/routers/mqtt/Listener.go diff --git a/backend/swag.sh b/machinery/swag.sh similarity index 100% rename from backend/swag.sh rename to machinery/swag.sh diff --git a/backend/www/asset-manifest.json b/machinery/www/asset-manifest.json similarity index 100% rename from backend/www/asset-manifest.json rename to machinery/www/asset-manifest.json diff --git a/backend/www/favicon.ico b/machinery/www/favicon.ico similarity index 100% rename from backend/www/favicon.ico rename to machinery/www/favicon.ico diff --git a/backend/www/index.html b/machinery/www/index.html similarity index 100% rename from backend/www/index.html rename to machinery/www/index.html diff --git a/backend/www/logo192.png b/machinery/www/logo192.png similarity index 100% rename from backend/www/logo192.png rename to machinery/www/logo192.png diff --git a/backend/www/logo512.png b/machinery/www/logo512.png similarity index 100% rename from backend/www/logo512.png rename to machinery/www/logo512.png diff --git a/backend/www/manifest.json b/machinery/www/manifest.json similarity index 100% rename from backend/www/manifest.json rename to machinery/www/manifest.json diff --git a/backend/www/robots.txt b/machinery/www/robots.txt similarity index 100% rename from backend/www/robots.txt rename to machinery/www/robots.txt diff --git a/backend/www/static/css/main.8c8b27cf.chunk.css b/machinery/www/static/css/main.8c8b27cf.chunk.css similarity index 100% rename from backend/www/static/css/main.8c8b27cf.chunk.css rename to machinery/www/static/css/main.8c8b27cf.chunk.css diff --git a/backend/www/static/css/main.8c8b27cf.chunk.css.map b/machinery/www/static/css/main.8c8b27cf.chunk.css.map similarity index 100% rename from backend/www/static/css/main.8c8b27cf.chunk.css.map rename to machinery/www/static/css/main.8c8b27cf.chunk.css.map diff --git a/backend/www/static/js/2.5077aee4.chunk.js b/machinery/www/static/js/2.5077aee4.chunk.js similarity index 100% rename from backend/www/static/js/2.5077aee4.chunk.js rename to machinery/www/static/js/2.5077aee4.chunk.js diff --git a/backend/www/static/js/2.5077aee4.chunk.js.LICENSE.txt b/machinery/www/static/js/2.5077aee4.chunk.js.LICENSE.txt similarity index 100% rename from backend/www/static/js/2.5077aee4.chunk.js.LICENSE.txt rename to machinery/www/static/js/2.5077aee4.chunk.js.LICENSE.txt diff --git a/backend/www/static/js/2.5077aee4.chunk.js.map b/machinery/www/static/js/2.5077aee4.chunk.js.map similarity index 100% rename from backend/www/static/js/2.5077aee4.chunk.js.map rename to machinery/www/static/js/2.5077aee4.chunk.js.map diff --git a/backend/www/static/js/3.7d3b22ba.chunk.js b/machinery/www/static/js/3.7d3b22ba.chunk.js similarity index 100% rename from backend/www/static/js/3.7d3b22ba.chunk.js rename to machinery/www/static/js/3.7d3b22ba.chunk.js diff --git a/backend/www/static/js/3.7d3b22ba.chunk.js.map b/machinery/www/static/js/3.7d3b22ba.chunk.js.map similarity index 100% rename from backend/www/static/js/3.7d3b22ba.chunk.js.map rename to machinery/www/static/js/3.7d3b22ba.chunk.js.map diff --git a/backend/www/static/js/main.dc5ea753.chunk.js b/machinery/www/static/js/main.dc5ea753.chunk.js similarity index 100% rename from backend/www/static/js/main.dc5ea753.chunk.js rename to machinery/www/static/js/main.dc5ea753.chunk.js diff --git a/backend/www/static/js/main.dc5ea753.chunk.js.map b/machinery/www/static/js/main.dc5ea753.chunk.js.map similarity index 100% rename from backend/www/static/js/main.dc5ea753.chunk.js.map rename to machinery/www/static/js/main.dc5ea753.chunk.js.map diff --git a/backend/www/static/js/runtime-main.d0ac5cd7.js b/machinery/www/static/js/runtime-main.d0ac5cd7.js similarity index 100% rename from backend/www/static/js/runtime-main.d0ac5cd7.js rename to machinery/www/static/js/runtime-main.d0ac5cd7.js diff --git a/backend/www/static/js/runtime-main.d0ac5cd7.js.map b/machinery/www/static/js/runtime-main.d0ac5cd7.js.map similarity index 100% rename from backend/www/static/js/runtime-main.d0ac5cd7.js.map rename to machinery/www/static/js/runtime-main.d0ac5cd7.js.map diff --git a/backend/www/static/media/logo.6ce24c58.svg b/machinery/www/static/media/logo.6ce24c58.svg similarity index 100% rename from backend/www/static/media/logo.6ce24c58.svg rename to machinery/www/static/media/logo.6ce24c58.svg diff --git a/frontend/.eslintcache b/web/.eslintcache similarity index 100% rename from frontend/.eslintcache rename to web/.eslintcache diff --git a/frontend/.gitignore b/web/.gitignore similarity index 100% rename from frontend/.gitignore rename to web/.gitignore diff --git a/frontend/README.md b/web/README.md similarity index 100% rename from frontend/README.md rename to web/README.md diff --git a/frontend/package.json b/web/package.json similarity index 92% rename from frontend/package.json rename to web/package.json index d7250c9..2ec71b8 100644 --- a/frontend/package.json +++ b/web/package.json @@ -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" }, diff --git a/frontend/public/favicon.ico b/web/public/favicon.ico similarity index 100% rename from frontend/public/favicon.ico rename to web/public/favicon.ico diff --git a/frontend/public/index.html b/web/public/index.html similarity index 100% rename from frontend/public/index.html rename to web/public/index.html diff --git a/frontend/public/logo192.png b/web/public/logo192.png similarity index 100% rename from frontend/public/logo192.png rename to web/public/logo192.png diff --git a/frontend/public/logo512.png b/web/public/logo512.png similarity index 100% rename from frontend/public/logo512.png rename to web/public/logo512.png diff --git a/frontend/public/manifest.json b/web/public/manifest.json similarity index 100% rename from frontend/public/manifest.json rename to web/public/manifest.json diff --git a/frontend/public/robots.txt b/web/public/robots.txt similarity index 100% rename from frontend/public/robots.txt rename to web/public/robots.txt diff --git a/frontend/src/App.css b/web/src/App.css similarity index 100% rename from frontend/src/App.css rename to web/src/App.css diff --git a/frontend/src/App.js b/web/src/App.js similarity index 100% rename from frontend/src/App.js rename to web/src/App.js diff --git a/frontend/src/App.test.js b/web/src/App.test.js similarity index 100% rename from frontend/src/App.test.js rename to web/src/App.test.js diff --git a/frontend/src/index.css b/web/src/index.css similarity index 100% rename from frontend/src/index.css rename to web/src/index.css diff --git a/frontend/src/index.js b/web/src/index.js similarity index 100% rename from frontend/src/index.js rename to web/src/index.js diff --git a/frontend/src/logo.svg b/web/src/logo.svg similarity index 100% rename from frontend/src/logo.svg rename to web/src/logo.svg diff --git a/frontend/src/reportWebVitals.js b/web/src/reportWebVitals.js similarity index 100% rename from frontend/src/reportWebVitals.js rename to web/src/reportWebVitals.js diff --git a/frontend/src/setupTests.js b/web/src/setupTests.js similarity index 100% rename from frontend/src/setupTests.js rename to web/src/setupTests.js diff --git a/frontend/yarn.lock b/web/yarn.lock similarity index 100% rename from frontend/yarn.lock rename to web/yarn.lock