Skip to content

Jacobbishopxy/cyberbrick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CYBER BRICK

Menu

  1. Port occupation

  2. Prerequisites

  3. Environment

  4. Configuration

  5. Start Project

  6. Project Structure

  7. Details

Port occupation

Server Port
Web (Typescript) 8000
Api gateway (Golang) 8010
Py API (Python) 8020
Biz-v1 (NodeJs) 8030
Biz API (Golang) 8040
FS server (Golang) -
DGraph server (Golang) -
Auth server (Rust) 8050
Data server (Rust) 8051

Prerequisites

Server Py [Prerequisites]

  1. Flask Web framework

  2. SqlAlchemy Database ORM

  3. Pandas Data Analysis Library

Server Go [Prerequisites]

  1. [Mux]

  2. [Mongo]

Web [Prerequisites]

  1. Typescript Typed JavaScript

  2. NestJS NodeJS framework

  3. Typeorm Database ORM

  4. React JavaScript library

  5. Ant design pro UI solution

Environment

Database [Environment]

Use PostgreSql as default project database (storing config etc.)

  • PostgreSql = 10.0, docker commands:

    1. cd docker/docker-database

    2. bash start.sh

    3. bash create_database.sh

Use MongoDB for default non-schema data persistence

  • MongoDB, docker commands:

    1. cd docker-mongodb

    2. bash start.sh

    3. bash create_unique_index.sh

Server [Environment]

versions:

  • Python >= 3.8

commands:

  1. cd server
  2. pip install -r requirements.txt

Web [Environment]

versions:

  • Node >= 12.13
  • npm >= 6.12
  • yarn >= 1.22

commands:

  1. cd web
  2. npm i or yarn

Configuration

In resources folder, new config.json (see config.template.json). In resources folder, new go.env (see go.template.env. In resources folder, if mongodb is running in another machine, new mongo.connection.env (see mongo.connection.template.env.

ubiquitous-alchemy submodule

If you haven't initialized the submodule before, run make submodule-init. Otherwise, update submodule by running make submodule-update. Then, config the lura.json and ua.auth.env based on ua.auth.template.env (you can simply copy template and rename it). In ua.auth.env, Make sure DATABASE_URL is your database connection string. If the database is also running in docker and share the same network with auth-server container, rename the hostname to database's container name. Make sure INVITATION_PAGE is the link of cyberbrick frontend link (hostname is localhost in dev mode and the ip-address of server in production mode). In lura.json, rename the endpoints-backends host to the real ip-address.

Server [Configuration]

todo

Web [Configuration]

todo

Start Project

Server Py [Start Project]

Please cd server-py first then run the following commands.

  1. development:

    • python wsgi.py debug mode

    • python wsgi.py debug=false no-debug mode

  2. production:

    • python wsgi.py --env=prod
  3. production (docker):

    • setup python image, only for the first time:

      cd docker/docker-python
      bash setup.sh
    • setup dependencies installed image, rerun if dependencies updated:

      cd docker/docker-base-server
      bash setup.sh
    • setup built app image and start a container:

      cd docker/docker-app-server
      bash setup.sh
      bash start.sh

Server Go [Start Project]

Please cd server-go first then run the following commands.

  1. development:

    • go mod tidy download deps

    • go run . start server

  2. production (docker):

    • make sure you have a running mongoDB and have executed the bash file create_unique_index.sh inside docker-mongodb; a base image built from docker-go, a resources/go.env file with config similar to go.template.env; and a resources/mongo.connection.env file with similar config as mongo.connection.template.env.
    • You can simply run make docker-biz-server-setup and then make docker-biz-server-start or:
      • cd docker/docker-biz-server
      • ./setup.sh
      • ./start.sh

Web [Start Project]

Please cd web first then do the following commands.

  1. development:

    • yarn serve:dev for server side then in another terminal yarn dev for frontend
  2. production:

    • yarn build then yarn serve
  3. production (docker):

    • setup node image, only for the first time:

      cd docker/docker-node
      bash setup.sh
    • setup dependencies installed image, rerun if dependencies updated:

      cd docker/docker-base-web
      bash setup.sh
    • setup built app image and start a container:

      cd docker/docker-app-web
      bash setup.sh
      bash start.sh
    • yarn build:backend & yarn build:frontend building up web's server & client respectively

Project Structure

TODO: updating...

Detail

Server [Detail]

README

Web [Detail]

README