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

# LAT Packaging and Installation

export const Ocient = "Ocient®";

export const JVM = "JVM®";

export const Java = "Java®";

export const Docker = "Docker®";

export const Debian = "Debian®";

export const CentOS = "CentOS®";

<Warning>
  Data Pipelines are now the preferred method for loading data into the {Ocient} System. For details, see [Load Data](/load-data).
</Warning>

The Ocient LAT supports multiple types of packages for deployment and installation:

* {Debian} `.deb` package
* {CentOS} `.rpm` package
* Raw `.tar.gz` tar folder
* Direct .jar
* {Docker} container

Contact Ocient Support for the latest package for a deployment method.

## Prerequisites

* {Java} 17 or greater
  * Can either be system-level Java, or installed somewhere accessible by the user.

<Warning>
  The LAT must run on Ocient Loader Nodes where you installed the Ocient RPM to provide access to numerical libraries, ensuring the correct loading of geospatial data types. If this condition is not met, some geospatial objects might load inaccurately.
</Warning>

## Debian/CentOS Packages

**1. Install/Upgrade**

Debian: `sudo dpkg -i lat_$VERSION_all.deb`

CentOS: `sudo rpm -i lat-$VERSION-1.noarch.rpm`

**2. Setup Java**

If the default system Java is version 17 or greater, no action is required. If not, edit the service file to contain a `JAVA_HOME` environment variable pointing to a Java version 17 or greater installation.

1. Run: `systemctl edit lat`
2. Insert the following

```shell Shell theme={null}
[Service]
Environment=JAVA_HOME="PATH_TO_JAVA_HOME"
```

**3. Configure**

Modify the [LAT Source Configuration](/lat-source-configuration)  and [LAT Log4J Configuration](/lat-log4j-configuration)  (see [Package Contents](#package-contents)  for file locations).

<Info>
  It is recommended to use the `.conf` file for most LAT configuration. However, `LAT_MEMORY` and `LAT_MEMORY_DIRECT` can only be set by using environment variable. For these use the same process as setting `JAVA_HOME` as detailed in step 2.
</Info>

**4. Start/Stop**

Start: `systemctl start lat`

Stop: `systemctl stop lat`

### Package Contents

* Jar: `/opt/lat/lat-$VERSION.jar`
* Service File: `/usr/lib/systemd/system/lat.service`
* Configuration: `/etc/lat/`
  * Server Configuration: `lat.conf`
  * Logging Configuration: `log4j2.xml`
* Logs: `/var/log/lat/lat.log`
* LAT data directory: `/opt/lat/.lat-data`

## Tar Folder

**1. Extract file in your preferred location**

Run: `tar -xzf lat-$VERSION.tar.gz`

**2. Setup Java**

If the default system Java is version 17 or greater, no action is required. If not, set the `$JAVA_HOME` environment variable to a Java installation with version 17 or greater:

`export JAVA_HOME="PATH_TO_JAVA_HOME"`

**3. Configure**

Modify the [LAT Source Configuration](/lat-source-configuration)  and [LAT Log4J Configuration](/lat-log4j-configuration) (see [Folder Contents](#folder-contents) for file locations).

<Info>
  It is recommended to use the `.conf` file for most LAT configuration. However, `LAT_MEMORY` and `LAT_MEMORY_DIRECT` can only be set using environment variable. For these use the same process as setting `JAVA_HOME` as detailed in step 2.
</Info>

**4. Start/Stop**

Start: `./lat.sh [path]`, where `path` is an optional parameter for the path to a server configuration file (e.g., `lat.conf`). If `path` is not present, it will default to `config/lat.conf`.

Stop: Stop the running `lat.sh` script with `ctrl-c`.

### Folder Contents

* Jar: `lat-$VERSION.jar`
* Configuration: `config/`
  * Server Configuration: `lat.conf`
  * Logging Configuration: `log4j2.xml`
* Start Script: `lat.sh`
* LAT data directory: `.lat-data`

## Jar Direct

The LAT is a Java jar that can be deployed on any machine running Java 17+.

To run the LAT use the following command line statement:

```shell Shell theme={null}
java [options] -Dlog4j.configurationFile=<log4j-config-path> -jar <lat-jar-path> [lat-config-path]
```

* `log4j-config-path`: REQUIRED : path to the log4j configuration file
* `lat-jar-path`: REQUIRED : path to the LAT jar
* `lat-config-path`: OPTIONAL : path to a LAT service configuration file

### Recommended Java Command Line Options

See the [Java command line documentation](https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html#overview-of-java-options) for options.

### Max Direct Memory Size

| Option:      | -XX:MaxDirectMemorySize     |
| ------------ | --------------------------- |
| Recommended: | 32G                         |
| Example:     | -XX:MaxDirectMemorySize=32G |

### Minimum Heap Size

| Option:      | -Xms     |
| ------------ | -------- |
| Recommended: | 32G      |
| Example:     | -Xms=32G |

### Maximum Heap Size

| Option:      | -Xmx     |
| ------------ | -------- |
| Recommended: | 32G      |
| Example:     | -Xmx=32G |

### Example Java Command Line

```shell Shell theme={null}
java \
  -Dlog4j.configurationFile=config/log4j2.xml \
  -XX:MaxDirectMemorySize=32G \
  -Xms32G \
  -Xmx32G \
  -jar lat-[VERSION NUMBER].jar \
  config/lat.conf
```

## Docker Container

Ocient provides a Docker container for the LAT for testing workloads.

<Info>
  The container is not recommended for production workloads and should be used for testing only.
</Info>

### Configuration

The only mode of configuring the LAT within a Docker container is by using the service configuration environment variables. A `lat.conf` file is not supported.

See [LAT Service Configuration](/lat-service-configuration) for the list of supported environment variables.

It is not recommended to override the following environment variables.

* `LAT_DATA_PATH`
* `LAT_API_PORT`

### Logging

Within the Docker container the LAT logs `stdout`. The user can use the `docker logs ...` command to view the LAT logs.

The following environment variables are available to modify the log level of various loggers. See [LAT Log4J Configuration](/lat-log4j-configuration) for descriptions of the loggers and log levels.

### `ROOT_LOG_LEVEL`

| Logger:  | root  |
| -------- | ----- |
| Default: | debug |

### `BINDERS_LOG_LEVEL`

| Logger:  | com.ocient.lat.sink.ocient.Binders.Binder |
| -------- | ----------------------------------------- |
| Default: | info                                      |

### `HTTP_LOG_LEVEL`

| Logger:  | org.eclipse.jetty.server.HttpChannel |
| -------- | ------------------------------------ |
| Default: | debug                                |

### `KAFKA_LOG_LEVEL`

| Logger:  | org.apache.kafka |
| -------- | ---------------- |
| Default: | info             |

### Java

The `JAVA_OPTS` environment variable is available for controlling {JVM} settings. Container defaults to default JVM settings.

See the [Java command line documentation](https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html#overview-of-java-options) for detail on the command line options.

Example:

```shell Shell theme={null}
JAVA_OPTS="-XX:MaxDirectMemorySize=32G -Xms32G -Xmx32G"
```

### Data Volumes

The LAT in the docker container writes persistent data to `/lat/data`. It is recommended to mount a volume to this path so that the data can outlive the container instance. The [Error Log File](/lat-advanced-topics#error-log-file) is also written to this path if configured. If viewing this error file is necessary, a volume must be used.

Do not use the `LAT_DATA_PATH` configuration to override the data path inside the docker container. It will cause the LAT to write data and error logs into different locations and will require two volumes.

If using the Local File Source, the user must mount the data directory as a bind mount inside the container. It is recommended to mount to a location under the `/lat/` directory. When configuring the local file source the bind mount path should be configured with a file group.

### Ports

By default the LAT API listens on port `8080`. It is not recommended to override the `LAT_API_PORT` environment variable and instead use Docker’s port mapping functionality.

### Examples

### Docker

```shell Shell theme={null}
docker run --rm --name lat \
  --env ROOT_LOG_LEVEL=info \
  --env JAVA_OPTS="-XX:MaxDirectMemorySize=32G -Xms32G -Xmx32G" \
  -p 8080:8080 \
  --mount source=lat-data,target=/lat/data \
  lat:2.0.0
```

### Docker Compose

```yaml YAML theme={null}
---
version: '3.9'
services:
  lat:
    image: lat:2.0.0
    ports:
      - "8080:8080"
    restart: on-failure
    volumes:
      - lat-data:/lat/data
    environment:
      JAVA_OPTS: "-XX:MaxDirectMemorySize=32G -Xms32G -Xmx32G"
      ROOT_LOG_LEVEL: info

volumes:
  lat-data:
```

## Related Links

[Install an Ocient System](/install-an-ocient-system)

[Ingest Data with Legacy LAT Reference](/ingest-data-with-legacy-lat-reference)
