AMT Help Files

Running An AMT Application

To run an AMT application, you can deploy it using a web server such as Nginx for hosting the frontend, while the backend runs as a Java application. AMT applications can be run locally or containerized using Docker.

Running as a Standalone Application

To run the AMT application as a standalone Java application without Docker:

  1. Ensure Java 21 or higher is installed on your system. See System Requirements for details.
  2. Set up a PostgreSQL database and create the application schema. See Creating Databases for instructions.
  3. Configure the amt-config.yaml file with your database connection details. See Application Config File for configuration guidance.
  4. Run the backend application using the java command with the appropriate jar file, config file, and license file.
  5. Configure Nginx or another web server to serve the frontend and proxy API requests to the backend.
  6. Access the application through your web browser at the configured URL (e.g., http://localhost/amt-app).

Configuring the Frontend

In the example below, Nginx is used and configured to access the AMT application.

Follow the steps below to configure Nginx to host the AMT application frontend.

  1. Navigate to the Nginx/conf folder and open the nginx.conf configuration file in a text editor.
  2. Add the following blocks:
    http {
      ...
    
      server {
        ...
    
        #AMT Application Frontend
        location /amt-app {
          alias C:\AMT\AMT-Java\Binaries\application-frontend;
          try_files $uri $uri/ /index.html =404;
        }
    
        #API requests from the AMT Application
        location /amt-app/api {
          rewrite ^/amt-app(.*)$ $1 break;
          proxy_pass https://127.0.0.1:8443;
        }
        ...
      }
      ...
    }
    (Change the alias path to point to the AMT application frontend in your AMT environment).
  3. Save the file.

Starting the Back and Frontend

  1. Open PowerShell and run the following command to start the backend:
    java -jar C:\AMT\AMT-Java\Binaries\application-backend\amt-application-server-x.x.x.jar -cf "C:\AMT\AMT-Java-Client\Config\amt-config.yaml" -lf "C:\AMT\AMT-Java\Config\AmtRuntime.lic"
  2. Open another PowerShell window and run the following command from the Nginx folder to start the frontend:
    nginx start

Running the AMT Application through Docker

We will be using Rancher in our examples to manage the Docker container for the AMT application.

  1. To install Rancher, visit the Rancher website and follow their download instructions.
    • warning Rancher requires WSL: aka.ms/wslinstall.
    • info Running the following in PowerShell installs WSL2: wsl --install.
  2. Start Rancher and set runtime to "dockerd (moby)".
    • Using Kubernetes is optional. Enable Kubernetes if it's required to dynamically scale your deployment. This can be enabled later in Rancher's preferences.

The container will be a composite of the AMT application backend, frontend (through Nginx), and a system database (through PostgreSQL).

An image of the AMT application backend and frontend is necessary.

Pulling the AMT Image

Pull the image provided by Avanade using the following command:

docker pull <address>/amt-application-server-java

Setting Up the Folder Structure

Set up a folder structure for the Docker container to contain the Docker compose.yaml, configuration file, and license file.

C:\AMT\amt-java-docker\
    compose.yaml
C:\AMT\amt-java-docker\config\
    amt-config.yaml
    AmtRuntime.lic

Configuring amt-config.yaml

Simple configuration file for the AMT application. This is a minimal local solution serving as an example, not suited for production environments.

Note the usage of host.docker.internal instead of localhost.

---
name: AMT Application Java Config
environment: DEV
node:
  host: 0.0.0.0
  restPort: 8443
systemDatabase:
  type: POSTGRES
  settings:
    name: amtapplication
    schema: amtapplication
    username: <username>
    password: <password>
    driverClassname: org.postgresql.Driver
    url: jdbc:postgresql://host.docker.internal:5432/amtapplication
    hibernateDialect: org.hibernate.dialect.PostgreSQLDialect
    connectionPoolSize: 200
authentication:
  type: OIDC
  clients:
    rest:
      settings:
        issuerURL: http://localhost:8080/realms/AMTRealm
        clientID: AMT
        returnUrl: http://localhost:4200/amt-app
...

Configuring compose.yaml

Simple configuration for the Docker Compose file.

services:
  # PostgreSQL Database
  postgres:
    image: postgres:15
    container_name: amt-postgres
    environment:
      POSTGRES_DB: amtapplication
      POSTGRES_USER: <username>
      POSTGRES_PASSWORD: <password>
    ports:
      - "5432:5432"
    volumes:
      - postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

  # AMT Application Backend
  amt-application-backend:
    image: amt-java/amt-application-server-java
    container_name: amt-application-backend
    depends_on:
      postgres:
        condition: service_healthy
    ports:
      - "8443:8443"
    volumes:
      - ./config:/config:ro
    environment:
      - JAVA_OPTS=
    command: >
      java
      -jar /.../amt-application-server/amt-application-server-pekko.jar
      -cf /config/amt-config.yaml
      -lf /config/AmtRuntime.lic
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8443/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

  # AMT Application Frontend
  amt-application-frontend:
    image: amt-java/amt-application-frontend-angular
    container_name: amt-application-frontend
    ports:
      - "4200:80"
    depends_on:
      - amt-application-backend

volumes:
  postgres-data:

Starting the Container

With the image pulled and the folder structure set up, run the following command from the folder containing the compose.yaml file to start the container:

docker compose up -d

To stop the container, run the following command from the same folder:

docker compose down

Contents