Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Latest commit

 

History

History
119 lines (79 loc) · 2.55 KB

DEVELOPMENT.md

File metadata and controls

119 lines (79 loc) · 2.55 KB

Development

Clone or download the codebase from GitHub to your local machine and install the following prerequisites.

cd ~/workspace
git clone [email protected]:hexa-org/policy-orchestrator.git

Install via Homebrew Formulae

brew install go buildpacks/tap/pack opa docker docker-compose postgresql golang-migrate

Run the migration

Install postgresql via homebrew.

Create a test database.

create database orchestrator_test;
create user orchestrator with password 'orchestrator';
grant all privileges on database orchestrator_test to orchestrator;

Run the migrations.

migrate -verbose -path ./databases/orchestrator -database "postgres://orchestrator:orchestrator@localhost:5432/orchestrator_test?sslmode=disable" up

Run the tests

Ensure the test suite passes.

go test  ./.../

Use the following command to clean up your test cache when needed.

go clean -testcache

Run the hexa applications

Create a development database similar to test.

Source the .env_development file.

source .env_development

Run the Hexa Policy Admin web application.

go run cmd/admin/admin.go

Run the Hexa Policy Orchestrator server.

go run cmd/orchestrator/orchestrator.go

Run the demo applications

Run the demo web application locally.

OPA_SERVER_URL=http://opa-agent:8887/v1/data/authz/allow go run cmd/demo/demo.go

Run the demo web application locally.

go run cmd/democonfig/democonfig.go 

Run the open policy agent server locally.

HEXA_DEMO_URL=http://localhost:8889 opa run --server --addr :8887 -c deployments/opa-server/config/config.yaml

CodeQL locally

Install via Homebrew Formulae

brew install codeql

Note - the below command references a local clone of the codeql-go repo.

Be sure to install codeql-go dependencies. From the codeql-go directory, run scripts/install-deps.sh.

Create a local database.

CODEQL_EXTRACTOR_GO_BUILD_TRACING=on codeql database create .codeql --language=go

Analyze the results.

codeql database analyze .codeql --off-heap-ram=0 --format=csv --output=codeql-results.csv ../codeql-go/ql/src/codeql-suites/go-code-scanning.qls