> ## 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 & deploying Atoti Market Risk

## Building the Project

### Maven Repositories

* From the [ActiveViam
  share](https://artifacts.activeviam.com/share/ActivePivot_stable/) page,
  download the Maven repository for the version of Atoti Server the
  application is based on. This is specified in the [release notes](../dev-release/release-notes) of
  the application you are deploying. The zip file containing the
  Maven repository will be called *maven-repository-**\<version
  number>**.zip*.
* From the [Distribution folder](https://activeviam.jfrog.io/artifactory/activeviam-accelerators-artifacts/market-risk/6.0.7/),
  download the
  Maven repository for Atoti Market Risk (this contains all dependencies
  required to build Atoti Market Risk that aren’t included in the
  Atoti Server download). A zip file containing the Maven repository
  will be called *mr-**\<version number>**-maven-repository.zip*.

Add these repositories to your existing Maven repository.

### Set up Artifactory access

In addition to the repository zips, you can download all Maven dependencies from Artifactory by setting up your Maven settings file:

```xml theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
<settings>
    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>

            <repositories>
                <repository>
                    <id>ActiveViamInternalRepository</id>
                    <name>ActiveViam Internal Repository</name>
                    <url>https://activeviam.jfrog.io/activeviam/activeviam-mvn-accelerators/</url>
                </repository>
            </repositories>
        </profile>
    </profiles>

    <servers>
        <server>
            <id>ActiveViamInternalRepository</id>
            <username>username</username>
            <password>password</password>
        </server>
    </servers>
</settings>
```

To download the dependencies for the UI, you need to set up access to Artifactory via npm:

`npm login --scope @activeviam --registry https://activeviam.jfrog.io/artifactory/api/npm/activeviam-npm-accelerators/`

The result is the following message:
`Logged in as username to scope @activeviam on https://activeviam.jfrog.io/artifactory/api/npm/activeviam-npm-accelerators/.`

If the scope isn’t mentioned in the message, change the command to the following:
`npm login --scope=@activeviam --registry=https://activeviam.jfrog.io/artifactory/api/npm/activeviam-npm-accelerators/`

### Source

From the [Distribution folder](https://activeviam.jfrog.io/artifactory/activeviam-accelerators-artifacts/market-risk/4.0.0/), download and unzip the source files. The zipped file
will be called *market-risk-**\<version number>**.zip*.

### 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 Atoti Server executable JAR file
   (mr-application/target/mr-application-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, or download the prebuilt application from the distribution folder.
5. Deploy the UI application.

## Configuration

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

## Deployment

### Atoti Server

The mr-application is a Spring Boot application that builds an executable JAR. To deploy the
executable JAR files, use the following command:

```
java -jar mr-application-exec.jar
```

To configure the port and context path of the application, two properties
are used: `server.port` and `server.servlet.context-path`. The default
values are in `resources/application.yaml`, the standard configuration
file for Spring Boot applications.

For example:

```
java -jar mr-application-exec.jar --server.port=<port>
```

This can also be changed by externalizing the properties files (see
[Externalising Properties Files](#Externalizing_Properties_Files)).

Atoti Server will be available at: http\://\<your hostname>:10010/mr-application/

### Atoti UI

Atoti UI 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
after the project has been built.

The UI should be built using Yarn or NPM. If customizations are not required, a prebuilt UI is available in the distribution folder.

### 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 two options to override default properties:

* OPTION 1: Command line arguments, for example:
  –mr.data-load.csv.dataset=/path/to/folder .

<Note>
  We are using “`--`” when providing the option after calling the jar. If the option was called first then “`-D`” is used.
</Note>

* OPTION 2: Create a properties file, for example:
  application.properties and add your
  property overrides. Then pass it to the main using the command line
  argument:
  –spring.config.additional-location=/\<path>/application.properties

  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).
