<commit_before># Developing EnMasse

## Build requirements

To build EnMasse, you need

   * [JDK](http://openjdk.java.net/) >= 11
   * [Apache Maven](https://maven.apache.org/) >= 3.5.4
   * [Docker](https://www.docker.com/)
   * [GNU Make](https://www.gnu.org/software/make/)
   * [Asciidoctor](https://asciidoctor.org/) >= 1.5.7
   * [Go](https://golang.org/) > 1.10.0

*Note*: On OSX, make sure you have [Coreutils](https://www.gnu.org/software/coreutils/) installed, e.g. `brew install coreutils`

The EnMasse java and node modules are built using maven. All docker images are built using make.

## Runtime requirements

To run EnMasse you need a Kubernetes cluster. Most EnMasse developers use [OKD](https://www.okd.io/)
for running tests on their machine.

## Checking out for Go

If you want to work with the Go parts of this repository, you will need to perform the
following steps.

### Create a Go workspace

Create a new directory and set the `GOPATH` environment variable:

    export GOPATH=/home/user/my-enmasse-gobase
    mkdir -p $GOPATH/src/github.com/enmasseproject

### Clone the git repository into this workspace

    cd $GOPATH/src/github.com/enmasseproject
    git clone https://github.com/enmasseproject/enmasse

## Building

### Pre-installation

*Note*: Make sure docker daemon is in running state.

#### Full build, run unit tests

    make

This can be run at the top level or within each module. You can also run the 'build', 'test', and 'package' targets individually.

#### Building docker images

    make docker_build

#### Full build and pushing docker images to a registry

    export DOCKER_ORG=myorg
    export DOCKER_REGISTRY=quay.io
    export TAG=v1.0.3 # Optional: 'latest' by default

    docker login -u myuser -p mypassword $DOCKER_REGISTRY

    make buildpush

*Note*: If you are using OKD and 'oc cluster up', you can push images directly to the builtin registry
by setting `DOCKER_ORG=myproject` and `DOCKER_REGISTRY=172.30.1.1:5000` instead.

#### Deploying to a Kubernetes instance assuming already logged in with cluster-admin permissions

*Note*: This assumes you have [OpenSSL](https://www.openssl.org) installed.

```
kubectl create namespace enmasse-infra
kubectl config set-context $(kubectl config current-context) --namespace=enmasse-infra

mkdir -p api-server-cert
openssl req -new -x509 -batch -nodes -days 11000 -subj "/O=io.enmasse/CN=api-server.enmasse-infra.svc.cluster.local" -out api-server-cert/tls.crt -keyout api-server-cert/tls.key
kubectl create secret tls api-server-cert --cert=api-server-cert/tls.crt --key=api-server-cert/tls.key

kubectl apply -f templates/build/enmasse-latest/install/bundles/enmasse
kubectl apply -f templates/build/enmasse-latest/install/components/example-plans
kubectl apply -f templates/build/enmasse-latest/install/components/example-authservices
```

#### Deploying to an OKD instance assuming already logged in with cluster-admin permissions

```
oc new-project enmasse-infra || oc project enmasse-infra
oc apply -f templates/build/enmasse-latest/install/bundles/enmasse
oc apply -f templates/build/enmasse-latest/install/components/example-plans
oc apply -f templates/build/enmasse-latest/install/components/example-authservices
```

#### Running smoketests against a deployed instance

    make SYSTEMTEST_ARGS=SmokeTest systemtests

### Running full systemtest suite

#### Running the systemtests

    make systemtests<commit_msg>Add note about SKIP_UNINSTALL<commit_after># Developing EnMasse

## Build requirements

To build EnMasse, you need

   * [JDK](http://openjdk.java.net/) >= 11
   * [Apache Maven](https://maven.apache.org/) >= 3.5.4
   * [Docker](https://www.docker.com/)
   * [GNU Make](https://www.gnu.org/software/make/)
   * [Asciidoctor](https://asciidoctor.org/) >= 1.5.7
   * [Go](https://golang.org/) > 1.10.0

*Note*: On OSX, make sure you have [Coreutils](https://www.gnu.org/software/coreutils/) installed, e.g. `brew install coreutils`

The EnMasse java and node modules are built using maven. All docker images are built using make.

## Runtime requirements

To run EnMasse you need a Kubernetes cluster. Most EnMasse developers use [OKD](https://www.okd.io/)
for running tests on their machine.

## Checking out for Go

If you want to work with the Go parts of this repository, you will need to perform the
following steps.

### Create a Go workspace

Create a new directory and set the `GOPATH` environment variable:

    export GOPATH=/home/user/my-enmasse-gobase
    mkdir -p $GOPATH/src/github.com/enmasseproject

### Clone the git repository into this workspace

    cd $GOPATH/src/github.com/enmasseproject
    git clone https://github.com/enmasseproject/enmasse

## Building

### Pre-installation

*Note*: Make sure docker daemon is in running state.

#### Full build, run unit tests

    make

This can be run at the top level or within each module. You can also run the 'build', 'test', and 'package' targets individually.

#### Building docker images

    make docker_build

#### Full build and pushing docker images to a registry

    export DOCKER_ORG=myorg
    export DOCKER_REGISTRY=quay.io
    export TAG=v1.0.3 # Optional: 'latest' by default

    docker login -u myuser -p mypassword $DOCKER_REGISTRY

    make buildpush

*Note*: If you are using OKD and 'oc cluster up', you can push images directly to the builtin registry
by setting `DOCKER_ORG=myproject` and `DOCKER_REGISTRY=172.30.1.1:5000` instead.

#### Deploying to a Kubernetes instance assuming already logged in with cluster-admin permissions

*Note*: This assumes you have [OpenSSL](https://www.openssl.org) installed.

```
kubectl create namespace enmasse-infra
kubectl config set-context $(kubectl config current-context) --namespace=enmasse-infra

mkdir -p api-server-cert
openssl req -new -x509 -batch -nodes -days 11000 -subj "/O=io.enmasse/CN=api-server.enmasse-infra.svc.cluster.local" -out api-server-cert/tls.crt -keyout api-server-cert/tls.key
kubectl create secret tls api-server-cert --cert=api-server-cert/tls.crt --key=api-server-cert/tls.key

kubectl apply -f templates/build/enmasse-latest/install/bundles/enmasse
kubectl apply -f templates/build/enmasse-latest/install/components/example-plans
kubectl apply -f templates/build/enmasse-latest/install/components/example-authservices
```

#### Deploying to an OKD instance assuming already logged in with cluster-admin permissions

```
oc new-project enmasse-infra || oc project enmasse-infra
oc apply -f templates/build/enmasse-latest/install/bundles/enmasse
oc apply -f templates/build/enmasse-latest/install/components/example-plans
oc apply -f templates/build/enmasse-latest/install/components/example-authservices
```

#### Running smoketests against a deployed instance

    make SYSTEMTEST_ARGS=SmokeTest systemtests

### Running full systemtest suite

By default the test suite tears down the EnMasse deployment and namespace after the test run.  To suppress this behaviour set environment variable `SKIP_UNINSTALL`.  This is important if relying on local built images pushed into the in-built registry.

#### Running the systemtests

    make systemtests
{'fraction_non_alphanumeric': 0.10673763832469534, 'fraction_numerical': 0.009525143577531868, 'mean_word_length': 4.140388768898488, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 18, 'lorem ipsum': 0, 'www.': 10, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5338372', 'n_tokens_mistral': 2339, 'n_tokens_neox': 2205, 'n_words': 720}