Skip to content

Latest commit

 

History

History
171 lines (116 loc) · 4.84 KB

compile_guide.md

File metadata and controls

171 lines (116 loc) · 4.84 KB

Introduction

There are dev method and release method to build and run Board. This guide provides instructions for developers to build and run Board by dev method.

Step 1: Prepare for a build environment for Board

Board is deployed as several Docker containers and most of the code is written in Go language. The build environment requires Python, Docker, Docker Compose and golang development environment. Please install the below prerequisites:

Software Required Version
docker-ce 17.03 +
docker-compose 1.14.0 +
python 2.7 +
git 1.8.3 +
make 3.81 +
golang 1.9.6 +

Step 2: Getting the source code

   $ git clone http://10.110.18.40:10080/inspursoft/board.git

Step 3: Building and installing Board

Configuration

Edit the file make/board.cfg and make necessary configuration changes such as hostname, admin password ,mysql server and so on. Refer to Installation and Configuration Guide for more info.

   $ cd board
   $ vi make/board.cfg

Compiling and Running in development

You can compile and running by the approache:

I. Prepare configuration and env

   $ make prepare

Ⅱ. Compile UI

   $ make compile_ui

Ⅲ. Building and Running Board

   $ make -e DEVFLAG=dev start

Step 4: Verify the Board

Refer to View and test Board REST API via Swagger for testing the Board REST API.

Step 5: Stop Board Instance

When you want to stop Board instance, run:

   $ make -e DEVFLAG=dev down

Appendix

  • Using the Makefile

The Makefile contains predefined targets:

Target Description
all Check board source file by fmt vet golint and compile
prepare Prepare configuration and env
compile Check board source file by fmt vet golint and compile
compile_ui Building ui
start Building images containers and running
test Runs the tests
fmt Formats board source files
vet Examines board source code and reports suspicious constructs
golint Linter for source code
clean Print help infomation about clean
cleanall Clean binary and images
cleanbinary Clean binary
cleanimage Clean images
down Stop and remove board instance
install Compile board binary
build Build board images
package Pack offline package of board project
packageonestep Generate offline package of board project by one step
prepare_swagger Prepare swagger environment
container/$IMG_build Build $IMG image
container/$IMG_rmi Clean $IMG image
src/$PACKAGE_clean Clean $PACKAGE binary
src/$PACKAGE_fmt Formats $PACKAGE source files
src/$PACKAGE_install Compile $PACKAGE binary
src/$PACKAGE_vet Examines $PACKAGE source code and reports suspicious constructs
src/$PACKAGE_compile Check $PACKAGE source file by fmt vet golint and compile
src/$PACKAGE_golint Linter for $PACKAGE source code
src/$PACKAGE_test Runs $PACKAGE tests

Note: IMG's value is one of apiserver, tokenserver, log, collector, gitserver, jenkins, mysql and nginx. PACKAGE's value is one of apiserver, tokenserver and collector/cmd.

EXAMPLE:

Compile apiserver,tokenserver and collector/cmd binary

   $ make install

Build apiserver image

   $ make container/apiserver_build 

Clean apiserver image

   $ make container/apiserver_rmi 

Formats apiserver source files

   $ make src/apiserver_fmt 

Examines apiserver source code and reports suspicious constructs

   $ make src/apiserver_vet 

Linter for apiserver source code

   $ make src/apiserver_golint

Compile apiserver binary

   $ make src/apiserver_install

Check apiserver source file by fmt vet golint and compile

   $ make src/apiserver_compile 

Clean apiserver binary

   $ make src/apiserver_clean

Note: the board file path:$GOPATH/src/git/inspursoft/