Sign inSign up

truecommerce/tc.forecastmanager.middletier

By truecommerce

Updated over 5 years ago

Forecast Manager Middle Tier Microservice

Image
0

519

truecommerce/tc.forecastmanager.middletier repository overview

TrueCommerce Forecast Manager Middle Tier

This repository contains images for the TrueCommerce Forecast Manager Middle Tier

Usage

Prior to running the container the application requires an Administrator Certificate from Foundry Platform. One way this can be obtained is by running the associated tool from the Foundry Security Tools. Follow the steps in the "Generate authentication certificate" and save the output.

This certificate is only used to initialize the Middle Tiers and is needed every time a Middle Tier comes online. The exception would be if another instance of the same middle tier has cached an application specific version in a distributed cache which is still running and valid. As such the value should either be a long lived certificate (years) or be regularly updated to ensure issues don't exist when starting up the Middle Tier.

The Middle Tier supports running multiple instances simultaneously and is recommended for high volume production environments.

The recommended configuration also includes using Redis as a cache provider. As such, for a Docker deployment a docker-compose file combined with a .env or secrets is the recommended approach and is what will be detailed below.

Docker Compose Example

This is an example of a full production deployment docker-compose file including multiple nodes for both the Middle Tiers and Providers:

version: '2.4'
services:
  redis:
    image: redis:6.0-alpine
    container_name: ForecastManager-Redis
    restart: unless-stopped
  forecastmanagercore:
    image: truecommerce/tc.forecastmanager.middletier:${IMAGE_VERSION}
    container_name: ForecastManager-Core
    restart: unless-stopped
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - MiddleTier__InitializationCertificate=${INITIALIZATION_CERT}
      - MiddleTier__CorsOriginAllowed=http://localhost:30000;http://${MT_HOST}:${MT_PORT}
      - Foundry__Security__RootUrl=${SECURITY_MICROSERVICE_HOST}
      - Foundry__CoreOData__RootUrl=${COREODATA_HOST}
      - Foundry__RabbitMQ__Host=${RABBIT_CONNECTION}
      - Foundry__RabbitMQ__Username=${RABBIT_USER}
      - Foundry__RabbitMQ__Password=${RABBIT_PASSWORD}
      - Foundry__RabbitMQ__Timeout=${RABBIT_TIMEOUT}
      - MiddleTier__Caching__Provider=${CACHE_PROVIDER}
      - MiddleTier__Caching__Redis_Configuration__Connection=ForecastManager-Redis:6379
      - MiddleTier__Caching__Redis_Configuration__InstanceName=${REDIS_INSTANCE}
      - MiddleTier__Caching__Redis_Configuration__UseWithNHibernate=${USE_REDIS_NHIBERNATE}
      - MiddleTier__CertificateLife=${MT_ADMIN_CERT_LIFE}
      - MiddleTier__RenewCertificatesOlderThan=${MT_ADMIN_CERT_RENEWAL}
      - MiddleTier__AuthenticationMessageLife=${MT_ADMIN_CERT_MESSAGE_LIFE}
      - MiddleTier__Registration__MiddleTierHost=${MT_HOST}:${MT_PORT}
      - MiddleTier__Registration__ProviderHost=${PROVIDER_HOST}:${PROVIDER_PORT}
      - MiddleTier__Registration__AgentName=System Agent
      - MiddleTier__Registration__UseHttps=false
      - MiddleTier__Registration__SupportsAlerts=false
      - MiddleTier__Registration__SupportsMetadata=false
      - MiddleTier__Registration__SupportScheduledTasks=true
      - MiddleTier__Registration__RegisterGlobalTenant=true
      - MiddleTier__Registration__MobileApplication__AlwaysDeploy=true
      - MiddleTier__Registration__MobileApplication__PackagePath=/Deploy/MobileUi.a1pkg
      - ForecastEngine__CoreOData__RootUrl=${FORECASTENGINE_ODATA_HOST}
      - DataHub__CoreOData__RootUrl=${DATAHUB_ODATA_HOST}
    ports:
      - "${MT_PORT}:80"
    links:
      - redis

  forecastmanagerproviders:
    image: truecommerce/tc.forecastmanager.providers:${IMAGE_VERSION}
    container_name: ForecastManager-Providers
    restart: unless-stopped
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - MiddleTier__InitializationCertificate=${INITIALIZATION_CERT}
      - MiddleTier__CorsOriginAllowed=http://localhost:30000;http://${PROVIDER_HOST}:${PROVIDER_PORT}
      - Foundry__Security__RootUrl=${SECURITY_MICROSERVICE_HOST}
      - Foundry__CoreOData__RootUrl=${COREODATA_HOST}
      - Foundry__RabbitMQ__Host=${RABBIT_CONNECTION}
      - Foundry__RabbitMQ__Username=${RABBIT_USER}
      - Foundry__RabbitMQ__Password=${RABBIT_PASSWORD}
      - Foundry__RabbitMQ__Timeout=${RABBIT_TIMEOUT}
      - MiddleTier__CertificateLife=${MT_ADMIN_CERT_LIFE}
      - MiddleTier__RenewCertificatesOlderThan=${MT_ADMIN_CERT_RENEWAL}
      - MiddleTier__AuthenticationMessageLife=${MT_ADMIN_CERT_MESSAGE_LIFE}
      - MiddleTier__Caching__Provider=Redis
      - MiddleTier__Caching__Redis_Configuration__Connection=ForecastManager-Redis:6379
      - MiddleTier__Caching__Redis_Configuration__InstanceName=${REDIS_INSTANCE}
      - MiddleTier__Caching__Redis_Configuration__UseWithNHibernate=${USE_REDIS_NHIBERNATE}
    ports:
      - "${PROVIDER_PORT}:80"

Environment Variables Used (.env file)

Variable NameDescriptionExample
IMAGE_VERSIONVersion component of the tag1.0.200.0003
INITIALIZATION_CERTInitialization certificate generated by security tools
COREODATA_HOSTLocation of the Core OData (MSI) serviceshttps://localhost:30000
SECURITY_MICROSERVICE_HOSTLocation of the Security Microservicehttps://localhost:30100
RABBIT_CONNECTIONConnection string for RabbitMQ instance used by Foundryrabbitmq://localhost
RABBIT_USERThe username for the Foundry RabbitMQ connectiontc
RABBIT_PASSWORDThe password for the Foundry RabbitMQ connectiontc
RABBIT_TIMEOUTA default timeout for RabbitMQ messages0.00:00:15
CACHE_PROVIDERMechanism to use for distributed caching. One of 'Redis' or 'InMemory'Redis
REDIS_INSTANCEName of the instance used for Redis when CACHE_PROVIDER is RedisForecastManagerCache
USE_REDIS_NHIBERNATE'true' if Redis should be used for 2nd level caching in NHibernate and 'false' otherwisetrue
MT_ADMIN_CERT_LIFEWhen the Middle Tiers generate an internal certificate for admin access, this is used to determine the expiry7.00:00:00
MT_ADMIN_CERT_RENEWALFrequency at which the internal admin certificate should be refreshed. Should be a value less than MT_ADMIN_CERT_LIFE3.00:00:00
MT_ADMIN_CERT_MESSAGE_LIFELifespan of authentication messages used to sign authentication tickets generated by internal admin ticket. Should be a value just long enough to ensure successful handshake between MT and Security Microservice to prevent MITM attacks0.00:00:30
MT_HOSTExternal name or IP where nginx will be runlocalhost
MT_PORTExternal port used to load balance and proxy for this middle tier13100
PROVIDER_HOSTExternal name or IP where provider microservice will be runlocalhost
PROVIDER_PORTExternal port used to load balance and proxy for provider microservice middle tier13101
FORECASTENGINE_ODATA_HOSTForecast Engine OData URLhttp://localhost:13020/odata
DATAHUB_ODATA_HOSTData Hub OData URLhttp://localhost:12540/odata

Tag summary

Content type

Image

Digest

Size

116.9 MB

Last updated

over 5 years ago

docker pull truecommerce/tc.forecastmanager.middletier