Contains the image for the TrueCommerce Translation Microservice
610
This repository contains images for the TrueCommerce Translation MiddleTier Service
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.
There are two images which should be executed, the main image and one suffixed with "-Providers". The Providers image should be run if Alerts, Scheduled tasks and other additional Foundry functionality is required.
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 and Nginx for load balancing and reverse proxying calls to the appropriate middle tier instance. 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 along with a basic config for nginx to facilitate the load balancing and proxy.
This is an example of a full production deployment docker-compose file including multiple nodes for both the Middle Tiers and Providers:
version: '3.4' services: nginx: image: nginx:alpine container_name: nginx_translation restart: unless-stopped ports: - ${NGINX_PORT}:80 volumes: - ${NGINX_CONFIG_FILE}:/etc/nginx/nginx.conf:ro links: - translation_primary - translation_secondary - translation_providers_primary - translation_providers_secondary redis: image: redis:6.0-alpine container_name: Translation_Redis restart: unless-stopped ports: - 6379:6379 translation_primary: image: truecommerce/tc.microservices.translation:${IMAGE_VERSION} container_name: Translation restart: unless-stopped environment: - ASPNETCORE_ENVIRONMENT=Production - MiddleTier__Registration__ProviderHost=${NGINX_HOST}:${NGINX_PORT} - MiddleTier__Registration__MiddleTierHost=${NGINX_HOST}:${NGINX_PORT} - MiddleTier__InitializationCertificate=${INITIALIZATION_CERT} - MiddleTier__CorsOriginAllowed=http://localhost:30000;http://${NGINX_HOST}:${NGINX_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} - Logging__ElasticSearch__nodeUris=${ELASTICSEARCH_URI} - MiddleTier__Caching__Provider=${CACHE_PROVIDER} - MiddleTier__Caching__Redis_Configuration__Connection=redis:6379 - MiddleTier__Caching__Redis_Configuration__InstanceName=${REDIS_INSTANCE} - MiddleTier__Caching__Redis_Configuration__UseWithNHibernate=${USE_REDIS_NHIBERNATE} - 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__Registration__AgentName=System Agent - MiddleTier__Registration__UseHttps=false - MiddleTier__Registration__SupportsAlerts=true - MiddleTier__Registration__SupportsMetadata=true - MiddleTier__Registration__SupportScheduledTasks=true - MiddleTier__Registration__RegisterGlobalTenant=true ports: - 12905:80 links: - redis translation_secondary: image: truecommerce/tc.microservices.translation:${IMAGE_VERSION} container_name: Translation_2 restart: unless-stopped environment: - ASPNETCORE_ENVIRONMENT=Production - MiddleTier__InitializationCertificate=${INITIALIZATION_CERT} - MiddleTier__CorsOriginAllowed=http://localhost:30000;http://${NGINX_HOST}:${NGINX_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} - MiddleTier__Caching__Provider=${CACHE_PROVIDER} - MiddleTier__Caching__Redis_Configuration__Connection=redis:6379 - MiddleTier__Caching__Redis_Configuration__InstanceName=${REDIS_INSTANCE} - MiddleTier__Caching__Redis_Configuration__UseWithNHibernate=${USE_REDIS_NHIBERNATE} - 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__Registration__RegisterGlobalTenant=false ports: - 12904:80 links: - redis translation_providers_primary: image: truecommerce/tc.microservices.translation:${IMAGE_VERSION}-Providers container_name: Translation_Providers restart: unless-stopped environment: - ASPNETCORE_ENVIRONMENT=Production - MiddleTier__InitializationCertificate=${INITIALIZATION_CERT} - MiddleTier__CorsOriginAllowed=http://localhost:30000;http://${NGINX_HOST}:${NGINX_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} - MiddleTier__Caching__Provider=${CACHE_PROVIDER} - MiddleTier__Caching__Redis_Configuration__Connection=redis:6379 - MiddleTier__Caching__Redis_Configuration__InstanceName=${REDIS_INSTANCE} - MiddleTier__Caching__Redis_Configuration__UseWithNHibernate=${USE_REDIS_NHIBERNATE} - Foundry__RabbitMQ__Timeout=${RABBIT_TIMEOUT} - MiddleTier__CertificateLife=${MT_ADMIN_CERT_LIFE} - MiddleTier__RenewCertificatesOlderThan=${MT_ADMIN_CERT_RENEWAL} - MiddleTier__AuthenticationMessageLife=${MT_ADMIN_CERT_MESSAGE_LIFE} ports: - 12906:80 links: - redis translation_providers_secondary: image: truecommerce/tc.microservices.translation:${IMAGE_VERSION}-Providers container_name: Translation_Providers_2 restart: unless-stopped environment: - ASPNETCORE_ENVIRONMENT=Production - MiddleTier__InitializationCertificate=${INITIALIZATION_CERT} - MiddleTier__CorsOriginAllowed=http://localhost:30000;http://${NGINX_HOST}:${NGINX_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} - MiddleTier__Caching__Provider=${CACHE_PROVIDER} - MiddleTier__Caching__Redis_Configuration__Connection=redis:6379 - MiddleTier__Caching__Redis_Configuration__InstanceName=${REDIS_INSTANCE} - MiddleTier__Caching__Redis_Configuration__UseWithNHibernate=${USE_REDIS_NHIBERNATE} - Foundry__RabbitMQ__Timeout=${RABBIT_TIMEOUT} - MiddleTier__CertificateLife=${MT_ADMIN_CERT_LIFE} - MiddleTier__RenewCertificatesOlderThan=${MT_ADMIN_CERT_RENEWAL} - MiddleTier__AuthenticationMessageLife=${MT_ADMIN_CERT_MESSAGE_LIFE} ports: - 12907:80 links: - redis
| Variable Name | Description | Example |
|---|---|---|
| IMAGE_VERSION | Version component of the tag | 1.0.200.0014 |
| INITIALIZATION_CERT | Initialization certificate generated by security tools | |
| COREODATA_HOST | Location of the Core OData (MSI) services | https://localhost:30000 |
| SECURITY_MICROSERVICE_HOST | Location of the Security Microservice | https://localhost:30100 |
| CACHE_PROVIDER | Mechanism to use for distributed caching. One of 'Redis' or 'InMemory' | Redis |
| REDIS_INSTANCE | Name of the instance used for Redis when CACHE_PROVIDER is Redis | Translation |
| USE_REDIS_NHIBERNATE | 'true' if Redis should be used for 2nd level caching in NHibernate and 'false' otherwise | true |
| ELASTICSEARCH_URI | Location of ElasticSearch | http://localhost:9200 |
| RABBIT_CONNECTION | Connection string for RabbitMQ instance used by Foundry | rabbitmq://localhost |
| RABBIT_USER | The username for the Foundry RabbitMQ connection | tc |
| RABBIT_PASSWORD | The password for the Foundry RabbitMQ connection | tc |
| RABBIT_TIMEOUT | A default timeout for RabbitMQ messages | 0.00:00:05 |
| MT_ADMIN_CERT_LIFE | When the Middle Tiers generate an internal certificate for admin access, this is used to determine the expiry | 7.00:00:00 |
| MT_ADMIN_CERT_RENEWAL | Frequency at which the internal admin certificate should be refreshed. Should be a value less than MT_ADMIN_CERT_LIFE | 3.00:00:00 |
| MT_ADMIN_CERT_MESSAGE_LIFE | Lifespan 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 attacks | 0.00:00:30 |
| NGINX_HOST | External name or IP where nginx will be run | localhost |
| NGINX_PORT | External port used to load balance and proxy for this middle tier | 12900 |
| NGINX_CONFIG_FILE | Physical path relative to the docker-compose (or an absolute path) to the nginx config for this middle tier | /home/username/translation/nginx.conf |
The following is a sample nginx configuration based on the above example docker-compose. Save this to location used as the NGINX_CONFIG_FILE to use with the supplied compose.
events {}
http {
upstream soap {
least_conn;
server translation_providers_primary:80;
server translation_providers_secondary:80;
}
upstream core {
least_conn;
server translation_primary:80;
server translation_secondary:80;
}
server {
listen 80;
server_name _ "";
underscores_in_headers on;
proxy_pass_request_headers on;
proxy_set_header Host "$host:$server_port";
proxy_set_header X-Forwarded-Proto "$scheme";
proxy_set_header X-Real-IP "$remote_addr";
proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
proxy_set_header 'Connection' 'keep-alive';
location = /favicon.ico { proxy_pass http://soap; }
location = /clientaccesspolicy.xml { proxy_pass http://soap; }
location = /crossdomain.xml { proxy_pass http://soap; }
location ^~ /AlertProvider {
proxy_pass http://soap;
}
location ^~ /ApplicationMetadataProvider {
proxy_pass http://soap;
}
location ^~ /odata/AlertDescriptorModels {
proxy_pass http://soap;
}
location ^~ /odata/ValidateAlertQuery {
proxy_pass http://soap;
}
location ^~ /odata/ApplicationEntityDescriptorModels {
proxy_pass http://soap;
}
location /providers/odata/ {
rewrite ^/providers/odata /odata break;
proxy_pass http://core;
}
location / {
proxy_pass http://core;
}
}
}
Content type
Image
Digest
Size
114.1 MB
Last updated
about 6 years ago
docker pull truecommerce/tc.microservices.translation