# Entaxy features install

### Alternative languages

[Russian](README.ru.md)

### Introduction

You need several steps for Entaxy features installation.
Use Java 11+.

### Build
You will need to compile this example first:

	mvn install

### Run

To run the example on Apache Karaf 4.x or newer

#### Step 1: Karaf

Launch the server

	karaf / karaf.bat


#### Step 2: DB, artemis and artefact manager Setup

If use docker run Artemis

	sudo docker run --rm -p 8161:8161 -p 61616:61616 -e ARTEMIS_USERNAME=entaxy -e ARTEMIS_PASSWORD=entaxy --name=artemis1 -d vromero/activemq-artemis

And run postgres

	sudo docker run --name entaxy_db -p 5432:5432 -v /etc/timezone:/etc/timezone:ro -e POSTGRES_PASSWORD=entaxy -e POSTGRES_USER=entaxy -e POSTGRES_DB=cache -d postgres

or mssql

	sudo docker run --name mssql -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=entaxy' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-CU8-ubuntu

`By default project use two db: cache и esb_entaxy,`
`Name of db wrote in org.ops4j.datasource-entaxy.esb.*.cfg`

and run nexus, if do you want to use it(necessary for system-management to work)

	sudo docker run -d -p 8081:8081 --name nexus sonatype/nexus3

Now we look at the admin password through the command:

    docker exec nexus cat /nexus-data/admin.password
And then we go to the admin panel through the browser on http://localhost:8081/.
By default, it needs to create a user entaxy / entaxy and a maven repository called entaxy to work.

On Docker Toolbox, errors may occur due to insufficient memory, solved by changing the memory allocation at startup`

    docker run -d -p 8081:8081 --name nexus -e INSTALL4J_ADD_VM_PARAMS="-Xms2g -Xmx2g -XX:MaxDirectMemorySize=3g" sonatype/nexus3

#### Step 3: Preparing and launching karaf

Copy the following files from the entaxy-framework\features\src\main\cfg\ repository to etc karaf

	jre.properties 
	org.apache.karaf.cellar.groups.cfg


Also, the local nexus repository must be added to the standard repositories in the file org.ops4j.pax.url.mvn.cfg property org.ops4j.pax.url.mvn.repositories.`

`The user and the name of the repository are specified in the ru.entaxy.esb.deployer.nexus.cfg configuration file.`


Running Apache Karaf 4.x or newer

	karaf

Or starting karaf with cleaning to its original state

	karaf clean

## Step 4: Installing all features in one go using the karaf command line

	shell:source <project-directory>/entaxy-framework/features/src/main/script/install.karaf

- After that you need to check the configurations of connections to the database in the files org.ops4j.datasource-entaxy.esb. *. Cfg
- Check the address of the broker in the file ru.entaxy.esb.cfg property ru.entaxy.esb.jms.url
- Check broker address in init/entaxy-platform-connections.json file "name": "entaxy-broker" connection in which property url
- Replace org.apache.karaf.cellar.groups.cfg file

#### Step 4a: Add features

Add features required

	feature:repo-add mvn:ru.entaxy.esb/karaf-features/$ESB_ENTAXY_VERSION/xml/features

Install entaxy

	feature:install entaxy-all

Add base feature required

	feature:repo-add mvn:ru.entaxy.esb.platform.runtime/base/$ESB_ENTAXY_VERSION/xml/features

Install base

	feature:install base

Add core feature required

	feature:repo-add mvn:ru.entaxy.esb.platform.runtime/core/$ESB_ENTAXY_VERSION/xml/features

Install core

	feature:install core

Add entaxy-uniform-service feature required

	feature:repo-add mvn:ru.entaxy.esb.platform.runtime.modules/uniform-service/$ESB_ENTAXY_VERSION/xml/features

Install entaxy-uniform-service

	feature:install entaxy-uniform-service
	
Useful comand for dev

	bundle:watch mvn:ru.entaxy.esb/esb/1.8

#### Step 5: Verify that your service is available using the following url in the browser.

We assume you're using Karaf's default PAX Web configuration which uses port `8181` for http. If you would like to use another port or https, change the configuration in `${KARAF_HOME}/etc/org.ops4j.pax.web.cfg`. The immediate extension after the hostname and port ("cxf" in the below URL) is configured via the org.apache.cxf.osgi.cfg file (Please see [http://team.ops4j.org/wiki//display/paxweb/Pax+Web](http://team.ops4j.org/wiki//display/paxweb/Pax+Web) for more information on PAX Web).

[http://localhost:8181/cxf/system-management?wsdl](http://localhost:8181/cxf/system-management?wsdl)

#### Step 6: Start SOAPUI or Postman

POST request to 

    http://localhost:8181/cxf/system-management

Send test request:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sys="http://www.entaxy.ru/system-management-service/">
		<soapenv:Header/>
		<soapenv:Body>
			<sys:listTemplateRequest/>
		</soapenv:Body>
	</soapenv:Envelope>

### Forum, Help, etc

If you hit an problems please let us know on the Camel Forums
	<http://camel.apache.org/discussion-forums.html>

Please help us make Apache Camel better - we appreciate any feedback you may
have.  Enjoy!


The Camel riders!



## Reinstall
    bin/karaf clean
    shell:source install.karaf


## Tests

<https://learning.getpostman.com/docs/postman/collection_runs/command_line_integration_with_newman/>

#### Install

    npm install -g newman

#### Run
    
    cd test
    newman run "Entaxy Integration Tests.postman_collection.json" -e "entaxy dev proxy.postman_environment.json"
    
or
    
    newman run "Entaxy Integration Tests.postman_collection.json" --env-var base_url=http://localhost:8181/cxf

#### CXF logging messages

    config:property-set -p org.apache.cxf.features.logging enabled true
    
and after restart bundle with cxf service
