Skip to main content

Development Environment

Setup prerequisites

You should install the following prerequisites:

  • docker (Tested version 18.09.7)
  • docker-compose (Tested version: 1.25.4, build 8d51620a)
  • Python 3.8
  • Golang (version 1.17.5)
  • AWS CLI (version latest)
  • Azure CLI (version latest)
  • GCP CLI (version latest)
  • Kubectl (stable version)
  • copper (version latest)
  • yq (version latest)
  • kubescore in /bin (version latest)
  • kube-linter (version latest)
  • Kubebench (version latest)

For more details, please reference to backend's dockerfile. There is a full dependence packages installation guideline.

Quick Start

ENV=dev make init
# Add ENV=dev to .env
# Update config/app.yaml
make db # Start databases

Frontend

Frontend code is located in ./web/ folder.

Requirements:

  • Nodejs
  • pnpm

To install nodejs, see nodejs.org To install pnpm, see pnpm.io

Start the frontend:

make ui

Backend

Backend code is located in ./ (root) folder.

Requirements:

  • Golang
  • GoLand or VSCode (optional)
  • Docker
  • Docker Compose
  • MongoDB Compass (optional)
  • Postman (optional)
  • curl
  • jq
  • make
  • go mod

To install backend dependencies, run the following commands:

make run

or

# setup air for hot reloading
go install github.com/cosmtrek/air@latest

# run backend
make run-air
# OR, to run manually
# air

MongoDB Local Setup

To setup MongoDB locally for developing backend, run the following commands:

ENV=dev make init
# Update .env file
make db

Then, to execute commands in the container, run the following commands:

make exec-mongodb # Run with normal user
make exec-mongodb-root # Run with root user

Develop Documentation

To develop documentation, run the following commands:

make docs

Documentation is in ./docs/ folder.

Generate API Documentation

To generate API documentation, run the following commands:

make build/api-docs

OR, to run manually:

# Generate swagger documentation
swag init
# Format swagger code comments
swag fmt

Release

Running the command below will build and release the project to github release page.

goreleaser release --clean

OR

make release

Test Release Locally

To test the release locally, run the following command:

goreleaser release --clean --snapshot