> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Building and deploying the solution

export const uiProductName = "Atoti UI";

export const fullVersion = "6.0.9";

export const coreProductName = "Atoti Server";

## Building the Project

### Maven Repositories

1. From the [ActiveViam share](https://artifacts.activeviam.com/share/ActivePivot_stable/) page,
   download the maven repository for the version of {coreProductName} the
   Solution is based on (will be specified in the release notes of
   the Solution you are deploying). The zip file containing the
   maven repository will be called *maven-repository-**\<version
   number>**.zip*.

2. On the Solution [Release Notes](../dev-release/release-notes) page, follow
   the directions to the *Distribution Files* section and download the
   maven repository for the Solution (contains all dependencies
   required to build the Solution that aren't included in the
   {coreProductName} download). A zip file containing the maven repository
   will be called *frtb-**\<version
   number>**-maven-repository.zip*.

   Add these repositories to your existing maven repository.

### Source

Download and unzip the source zip from the [Artifactory](https://activeviam.jfrog.io/artifactory/activeviam-accelerators-artifacts/frtb/\{fullVersion}/) page.

### Build

1. To compile the source code using Maven, you must set your `MAVEN_OPTS` environment variable, to pass Java options, like so: `MAVEN_OPTS="-Xss8m"`.

<Tip>
  You may need to change the stack size with this option. Here are some useful parameters:

  ```
  -Xms<size>        set initial Java heap size
  -Xmx<size>        set maximum Java heap size
  -Xss<size>        set java thread stack size
  ```
</Tip>

2. Once you have added all the maven repositories and extracted the
   source code, run `mvn install` on the parent pom file to build the
   entire project.

   This will build the executable JAR files for {coreProductName}
   (frtb-stater/target/frtb-starter-exec.jar).

3. When the build is complete, you must deploy it. See
   [Deployment](#Deployment).

4. Build the standalone UI application using npm or yarn.

5. Deploy the UI application.

## Configuration

See [Project configuration](./dev-configure-solution/configuration-project).

## <span id="Deployment" />Deployment

### {coreProductName}

From FRTB 2.1.0 onwards, the frtb-starter is a
Spring Boot application that builds to an executable JAR. To deploy the
executable JAR files, simply use the following commands:

```syntaxhighlighter-pre theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
java --add-opens java.base/java.util.concurrent=ALL-UNNAMED -jar frtb-starter-exec.jar
```

and

```syntaxhighlighter-pre theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
java --add-opens java.base/java.util.concurrent=ALL-UNNAMED -jar frtb-activemonitor-2.2.0-exec.jar
```

Note that the executable JAR will publish the application on a
specific port. The default port for frtb-starter is 8080.

{coreProductName} will be available at: *http\://\<your
hostname>:8080/frtb-starter/*

 

You can change the port by either of the following:

* Use the argument `server.port`.

  For example:

  ```
  java --add-opens java.base/java.util.concurrent=ALL-UNNAMED -jar frtb-starter-exec.jar --server.port=<port>
  ```

* Externalize the properties files (see [Externalizing Properties
  Files](#Externalizing_Properties_Files) )

### {uiProductName}

{uiProductName} is a static website that can be deployed in any way you see
fit. All the necessary files are to be found in the *./build* folder of
the standalone application after the project has been built.

As an example, the UI can be deployed on Tomcat using the following
instructions:

1. Build the standalone application:
   1. Use maven to build the project. You can use the
      command `mvn clean install` on the parent pom - This will build
      all the necessary modules including the Javascript UI

2. Place the deployment in the *webapps* folder of your Tomcat
   1. Find where the *webapps* folder is for your Tomcat
   2. Create a folder called *frtb-activeui* in the Tomcat *webapps*
      folder
   3. Copy the contents from the build folder into your new folder
      *webapps/frtb-activeui/*

3. Start the Tomcat server. You can now access the UI on the
   address *http\://\<your hostname>:\<port>/frtb-activeui/.*

## <span id="Externalizing_Properties_Files" />Externalizing Properties Files

In the default implementation, all the necessary properties are within
the project. A number of properties files have been externalized and can
be overridden with an external file using JVM variables. You may wish to
use this functionality if you are running the project in different
environments. Below is a list of the files together with their
respective variable names:

There are three options to override default properties:

* OPTION 1: Command line arguments, e.g.` --csv-source.dataset=/path/to/folder` .<br />
  <Note>
    **Note:**<br />  Here we use "`--`"
    when providing the option after calling the jar.<br /> If the option was called first, then "`-D`" is used.
  </Note>

* OPTION 2: Create a properties file (e.g. `application.properties)` and add your property
  overrides. Then pass it to the main using the command line argument `--spring.config.additional-location=/&lt;path&gt; application.properties`

* OPTION 3: Change the path to the default properties file using the
  appropriate variable specified below:

  \| File | Variable Name |
  \| --- | --- |
  \| application.properties | app.env.properties.file.path |
  \| hibernate.properties | hibernate.env.properties.file.path |

If any of the above variables are not set, the default properties
files will be used.

Example values for these properties files include:

* `classpath:<filename>`;
* `file:/home/etc/<filename>`; - Unix Environment
* `file:///C:/Users/john/config/<filename>`; - Windows
  environment

For more details, see the [Spring Boot documentation](https://docs.spring.io/spring-boot/docs/2.1.9.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files).     

<Tip>
  Options 1 and 2 are recommended because they only override the
  properties you specify and use the defaults for other ones.
  Additionally, they can be used to override any property.

  Option 3 only works for specific properties files (i.e. the ones
  specified in the table above), and replaces the default file completely,
  meaning you need to make a copy of the default file and have all
  properties in your external custom file even if they have the same value
  as the default file.
</Tip>
