New TC Deployment Guide

Introduction

The New TC is an upgraded version of current TC, where the Global concept of applications such as the Global gateway, etc. are used.

The document details the settings and customization for the deployment of New TC.

Note: This document considers the user to be a novice, so detailed instructions can be found in some sections.

Audience

Scope

In Scope

All items listed in the following sections comes under the scope of this document. The maintenance aspect of the product is mainly focused over here.

Out of Scope

The following systems are out of scope for this document:

  • Development aspects

  • Testing aspects

1. Database/Server Environment

CentOS 7 (Linux) Server Configuration

CentOS 7 is a Linux distribution that provides a community-supported computing platform. The CentOS 7 machine need to be configured for binding with UI, hosting and other purposes. Some prerequisites to be catered prior to configuring the Linux machine are:

  • Maria DB Server/Client is required for MySQL.

  • Using webserver Nginx or Apache, per preference.

  • Install PHP v5.6, PHP-FPM, and all the below listed modules.

Modules

Modules

Modules

Modules

bz2

hash

pdo_dblib

sysvmsg

calendar

iconv

pdo_mysql

sysvsem

Core

igbinary

pdo_sqlite

sysvshm

ctype

json

Phar

tokenizer

curl

libxml

posix

wddx

date

mbstring

readline

xml

dom

mcrypt

redis

xmlreader

ereg

mhash

Reflection

xmlwriter

exif

mssql

session

xsl

fileinfo

mysql

shmop

Zend OPcache

filter

mysqli

SimpleXML

zip

ftp

openssl

sockets

zlib

geoip

pcntl

SPL

gettext

pcre

sqlite3

gmp

PDO

standard

  • Allow windows IP in IP tables or Firewall.

  • A separate user needs to be created for Web-server, Document Root and PHP.

Note: For more information on prerequisite specification, refer to the References section.

MySQL Configuration

Once MySQL is installed, create a database and separate users for website and application with remote login for windows and local login for UI.

Create database site_db;
Create user ‘localuser’@’localhost’ identified by ‘password’;
Grant all privileges on site_db.* to ‘localuser’@’localhost’;
Create user ‘remoteuser’@’%’ identified by ‘password’;
Grant all privileges on site_db.* to ‘remoteuser’@’%’;
Flush privileges;

Once the above configuration is completed, logout from MySQL and restore the schema provided below.

mysql -u localuser -p password site_db < /location/of/schema.sql

Web-server Configuration (Nginx or Apache)

Based on preference, you can use Nginx or Apache for web-server configuration.

  1. Create a user for Web-service and deploy the Site; e.g., adduser siteuser.

  2. Change the password; e.g., passwd siteuser.

  3. Create a document root for web service; e.g., mkdir /var/www/html/site_document_root/.

  4. List the ownership for doc root; e.g., chown -R siteuser:siteuser /var/www/html/site_document_root/.

  5. Modify the user in web-service; e.g., vi /etc/nginx/nginx.conf, modify user = nginx to user = siteuser.

  6. Create a nginx profile for site with an SSL certificate; e.g., vi /etc/nginx/conf.d/alpha_site.conf.

Note: Required fields to be changed in the above attachment are server_name (website name), root, SSL_certificate, and SSL_certificate_key.

7. Create SSL profile; e.g., vi /etc/nginx/conf.d/ssl.inc.

8. Restart the nginx service to apply changes.

Configuring PHP v5.6, PHP-FPM

  • Allow the short open tag in the php.ini file; i.e., short_open_tag=On.

  • Modify the user in PHP; e.g -vi /etc/php-fpm.d/www.conf, modify user = apache to user = siteuser, modify group = apache to group = siteuser.

  • Restart the PHP-FPM service; i.e., service php-fpm restart.

UI-Backend Configuration

  • Create connection profile for UI to connect with DB.

 vi /var/www/html/site_document_root/master_config.php
  • Edit the following lines in the above file, and press Save.

 DB Configuration – Live

 define("MASTER_MYSQLDB_SRVER",'IP Address Of Linux Machine');
 define("MASTER_MYSQLDB_USER",'localuser');
 define("MASTER_MYSQLDB_PASS",'password');
 define("MASTER_MYSQLDB_DBNAME",'site_db');
 
 define("SLAVE_MYSQLDB_SRVER",'IP Address Of Linux Machine');
 define("SLAVE_MYSQLDB_USER",''localuser');
 define("SLAVE_MYSQLDB_PASS",'password');
 define("SLAVE_MYSQLDB_DBNAME",'site_db');

Site Entry In DB

The following entries are required in Database for the website functioning:

  • user_profiles

  • broker_detail_info

Cron Jobs

  • php-cgi /var/www/html/webdocument/trade/tcwebservices/htca_ws_shell.php broker_id=2 AccountID=1244

Note: The broker ID and Account ID values are acquired from the broker_detail_info and MT 4 Servers tables, respectively in MySQL.

  • php-cgi/var/www/html/webdocument/newTC_realdata_insertion_updation.php? mt4_id=4331

Note: The MT 4 ID values are acquired from the MT 4 Servers table in MySQL.

2. Windows Server Configuration

Windows Server 2012 R2 has an IP address management role for discovering, monitoring, auditing, and managing the IP address space used on a corporate network. Some prerequisites to be catered prior to configuring the Windows machine are:

  • MS SQL Server Standard 2014

  • Configure IIS Web-server.

  • Allow Linux server IP Address in firewall both Internal and External.

  • Install Dot net framework 3.5.

  • Install Microsoft Visual C++ Redistributable 2012, 2015 x86 and x64 bit.

Note: For more information on above prerequisite specification, refer to the References section.

MS SQL Configuration

Following are the steps for MS SQL configuration:

  • Create a new database on MS SQL, and restore schema provided.

  • Create user to access the DB with all privileges.

IIS Configuration

Refer to the section 3.1, for more information on IIS configuration.

MySQL ODBC Connection

  • Install MySQL ODBC Connector 5.3 in windows both 32-bit and 64-bit.

  • Create DSN (MySQL_Test) for the connection from Windows to MySQL DB.

Note: For information on how to create an ODBC, proceed to References section.

Application Configuration

Refer to the section 3.3, for information on configuration of components in the API environment.

UI Communication

For UI to communicate with the Applications, some web services are required to be created.

Note: For information on how to create a website, proceed to References section.

Communication Between Windows & Linux

  • Install Netcat for Windows in the windows machine.

  • Install Netcat for Linux in the Linux machine.

Note: For information on where to download Netcat for Windows and Linux, refer to the References section.

  • In Windows, run to listen:

Note: The port credentials will vary per the server used for communication testing.

nc -lvs <IP Adress of Windows> -p <TCP Port >
  • In Linux, run to connect:

nc -v <IP Address of Windows> <TCP Port>

3. API Environment

The New TC Deployment in the API environment is performed in 6 steps:

  • IIS Configuration

  • MSMQ Configuration

  • Application Configuration

  • Connection Settings

IIS Configuration

The following steps provides a workaround for the process.

  1. From the home screen, navigate to Control Panel, and click Uninstall a Program.

  2. Click Turn Windows features on or off and check the Internet Information Services checkbox.

Note: Expand the sub-folders and check all its sub-folders. The list of items that need to be checked are:

  1. .Net Framework 3.5 Features (All)

  2. .Net FrameWork 4.5 Features (All)

  3. WCF Services (All)

  4. IIS Hostable Web Core

  5. Message Queing (All)

  6. Windows Process Activation Services

  7. WebSocket protocol

  8. Applications Initialization

  9. ASP.Net 3.5

  10. ASP

  11. CGI

3. From the home screen, enter IIS in the search bar, and click the IIS icon.

4. In the Internet Information Services (IIS) Manager, right-click Sites under the Connections ribbon.

Figure 1:IIS Manager

5. Click Add Website.

6. In the Add Website page, enter the following details:

  • Site name

  • Physical path: Path for STTC Coverage Service.

  • Port: Enter port as 5000.

Figure 2: IIS Manager: Add Website Dialog-box

7. Proceed to the MSMQ Configuration.

MSMQ Configuration

The following steps provides a workaround for the process.

  1. From the home screen, navigate to Control Panel, and click Uninstall a Program.

  2. Click Turn Windows features on or off and check the Microsoft Message Queue (MSMQ) Server checkbox.

Note: Expand the subfolders and check all its subfolders.

3. From the home screen, enter Computer Management in the search bar, and click the Computer Management icon.

Computer Management for MSMQ Configuration

4. Access MSMQ under Services and Applications.

5. Under Private Queue, create two queues:

  • accountinfo

  • tradeinfo

Note: The nomenclature of both the queues are case-sensitive per the developer package.

6. To enable permissions to a specific queue, right-click the queue for which permissions are to be assigned.

7. Click Properties, and navigate to the Security tab.

8. Click Everyone and select Full Control.

9. Consecutively, click Apply and Save to save the changes made.

10. Proceed to Database/Server configuration.

Application Configuration

Database Configuration

The MS SQL Server is used for database or server configurations. The following components are the participators in the configuration process:

  • Gateway

  • Gateway Client

  • Gateway Client 2

  • TradeCopier

  • Health Monitor

Note: Installation of MS SQL Standard 2014 and MySQL ODBC Connector is a pre-requisite before performing the database/server configuration.

HTCA Configuration

HTCA is a server application that measures historical trade performance. The current version in use is HTCA 3.0. The HTCA can request symbol’s OHLC data directly from IQ feed App.

HTCA_Server.ini

The HTCA.ini file must contain the parameters as provided in the below ini file.

Trace Logs

The Trace Logs (through xlogger.ini) can be configured by specifying the location, name, size and comments for the logs.

Deployment Path & Binaries

Deployment Path: svn://185.62.85.23:6634/C:/HTCAServer/

The HTCA becomes functional on a server by migrating the HTCA binaries across servers. Following are the binaries:

  • HTCA_Server.exe

  • IQConnect.exe

  • Iqfeed_client.exe

  • ProtocolLib.dll

  • Socket.dll

  • TradeBO.dll

  • alayer.dll

  • Database.dll

  • xLogger.dll

  • HTCA_SERVER.ini

  • xLogger.ini

  • Utilities.dll

  • cpprest140_2_9.dll

Launch Service

Method = "GET"

URLTemplate =

"ProcessHTCAData/{AccountID}/{Currency}/{TimeZoneOffSet}/{USDConvParam}/{DSTStartMonth}/{DSTEndMonth}/{DSTStartWeek}/{DSTEndWeek}/{BrokerEODTime}/{DeleteCurrentData}"

Example:

http://185.62.85.23:5000/sttc_CoverageService.svc/ProcessHTCAData/15005/USD/1/1.0/3/11/3/2/17:00:00/0

Input Parameters:

  • AccountID: Account's PK_AccountID

  • DeleteCurrentData: 0/1 Note: To delete existing trade records, it should be set 1; else 0.

  • Rest of the parameters are same as previous versions.

Output Parameter:

  • RequestID: Request ID generated by service (0).

  • Message: In case of error, message parameter will contain error details.

  • Result: 0 = Success; non-zero = Failure Code

Web Service for UI Notification: http://new.fxsocio.com/trade/tcwebservices/htca_ws.php

The UI will receive HTCA execution on:

http://new.fxsocio.com/trade/tcwebservices/htca_ws.php?

Note: The web service may vary per the deployment.

Master Tables

Master tables is the first step during database design; i.e., it holds basic information of the system. For Master tables used in for the New TC are listed in the below txt file.

Component-Port Configuration

Configuration of ports is an important aspect of New TC deployment. A relation between the different components, and their respective IP and port information is derived below and is also available in the GatewayComponents and Gateways tables in MS SQL.

Figure 4: Assignation of Ports

Logic behind port assignation:

  • Gateway: Gateways are assigned the 10xxx port. Suppose the gateway 1 in PVP markets (system 1) is assigned port 10101, then gateway 2 will be 10102, gateway 3 will be 10103, and so on. If the system changes to system 2 (i.e., exclusive market per the example provided in Figure 4: Assignation of Ports), the assigned port for its gateway 1 will be 10201, for gateway 2 it will be 10202, for gateway 3 it will be 10203, and so on.

  • TC: TC are assigned the 20xxx port. Suppose the TC 1 in PVP markets (system 1) is assigned port 20101, then TC 2 will be 20102, TC 3 will be 20103, and so on. If the system changes to system 2 (i.e., exclusive market per the example provided in Figure 4: Assignation of Ports), the assigned port for its TC 1 will be 20201, for TC 2 it will be 20202, for TC 3 it will be 20203, and so on.

  • GC1: GC1 are assigned the 100x port. Suppose the GC1 in PVP markets (system 1) is assigned port 1001. If the system changes to system 2 (i.e., exclusive market per the example provided in Figure 4: Assignation of Ports), the assigned port for its GC1 will be 1002.

  • GC2: GC2 are assigned the 200x port. Suppose the GC2 in PVP markets (system 1) is assigned port 2001. If the system changes to system 2 (i.e., exclusive market per the example provided in Figure 4: Assignation of Ports), the assigned port for its GC2 will be 2002.

  • Health Monitor: Health Monitor are assigned the 300x port. Suppose the health monitor in PVP markets (system 1) is assigned port 3001. If the system changes to system 2 (i.e., exclusive market per the example provided in Figure 4: Assignation of Ports), the assigned port for its health monitor will be 3002.

Stunnel

Stunnel is an open-source application used to provide secure encrypted connections for clients or servers that do not follow SSL. Here, the stunnel acts as a secured port which receives information from the client system and further transmits it at application-level.

Logic behind port assignation:

  • GC1: GC1 are assigned the 150x port. Suppose the GC1 in PVP markets (system 1) is assigned port 1501. If the system changes to system 2 (i.e., exclusive market per the example provided in Figure 4: Assignation of Ports), the assigned port for its GC1 will be 1502.

  • GC2: GC2 are assigned the 250x port. Suppose the GC2 in PVP markets (system 1) is assigned port 2501. If the system changes to system 2 (i.e., exclusive market per the example provided in Figure 4: Assignation of Ports), the assigned port for its GC2 will be 2502.

  • Health Monitor: Health Monitor are assigned the 350x port. Suppose the health monitor in PVP markets (system 1) is assigned port 3501. If the system changes to system 2 (i.e., exclusive market per the example provided in Figure 4: Assignation of Ports), the assigned port for its health monitor will be 3502.

Examples:

Gateway Client:

  • [mamfeeder-newtcmam]

  • accept = 0.0.0.0:5001 (External Port)

  • connect = 127.0.0.1:5003 (Application-level Port)

  • cert = godaddy.pem

  • TIMEOUTbusy = 30

  • TIMEOUTclose = 0

  • TIMEOUTconnect = 30

Gateway Client 2:

  • [mamfeederV2-newtcmam]

  • accept = 0.0.0.0:5004 (External Port)

  • connect = 127.0.0.1:10051 (Application-level Port)

  • cert = godaddy.pem

  • TIMEOUTbusy = 30

  • TIMEOUTclose = 0

  • TIMEOUTconnect = 30.

Dependencies From UI: Web Services URL

These are a certain set of URLs which is sent back to UI as a response of the UI requests (or client requests).

  • StopCopyURL

  • RFDUrl

  • GenerateReportNotifyURL

  • UpdateUrl

  • RejectedCoverageWSUrl

  • CloseByMultipleCloseByWSUrl

Security Mapping

Following steps are required for mapping of securities:

  1. Run the Group Symbol Info tool, and acquire the securities corresponding to the connection for which mapping is done.

  2. In the MT4 Manager, identify the Group.

  3. From Group, identify the Securities. Example: Forex1

  4. Under Securities, identify the type of security. Example: Forex1 has an index 1. (Index is also known as External Asset Type in DB.)

  5. In DB, manually insert external securities with respect to the connection in the ExternalSecurity table.

Securities Mapping SQL Queries

6. Use AddTSExternalSecurityMap WS to create a mapping between internal and external securities.

New TC Binaries Deployment

Following are the steps to be performed for New TC binaries deployment:

  1. In the MS SQL query pad, query using select * from Gateways.

  2. Under the Gateways folder of the Coverage Service setup, open xlogger.ini.

  3. Mention the URL where logs are to be placed under Path.

  4. Open gateway.ini, and enter the following details:

  • Source

  • Catalog

  • Username

  • Password

Note: Verify other information such as port and ID by querying select * from GatewayComponents in MS SQL.

5. Follow the same process for all the other folders. The folders are Gateway Client, Gateway Client 2, Trade Copier, and Health Monitor.

Setting Up a Connection

Following steps are required for setting up a connection:

  1. Get client’s login credentials.

  2. Identify the MT4 Manager and the Group Name through which connection is to be made.

  3. Use AddMetatraderConnection WS. Enter values for all the below parameters:

  • Login

  • Password

  • IP

  • Port

  • ServerName

  • Active

  • ServerAPIIP

  • ServerAPIPort

  • BrokerID

  • Gateway

  • MaxLot

  • isAccountDisabledForTCSL

  • BrokerCalculationTime

  • IsStopCopyTriggerDisabled

  • isReadOnly

  • DateOfSnapShot

  • TimeOfSnapShot

  • MgmtFeeDateOfSnapShot

  • MgmtFeeTimeOfSnapShot

4. UI Environment

Module Settings

Module settings are used to enable or disable different modules such as NewTC/Current TC, Index fund, and PSP, and is based on the Broker requirements. Following are the steps for module setting:

  1. From the homepage header, click on the User.

  2. Access Super Admin.

Super Admin Login

3. Input Super Admin Login Password, and click Sign In.

4. Click the Settings icon on the header.

Settings Icon of Super Admin Site

5. Under SuperAdmin, click Module Setting.

Module Setting

6. Select the broker for whom setting need to be done and click the Settings tab corresponding to the broker under Action.

Module Setting - Brokers

7. Enable or disable the specific flag of New TC or Index fund and click Update.

Module Setting - Broker Setting

Gateway Connection List

The Gateway Connection List is used to allocate broker to specific connection as listed in the MySQL. Following are the steps to configure the server settings:

  1. From the homepage header, click on the User.

  2. Access Super Admin.

Super Admin Login

3. Input Super Admin Login Password, and click Sign In.

4. Click the Settings icon on the header.

Settings Icon of Super Admin Site

5. Under MT4 Settings, click Gateway connection list.

Gateway Connection List

6. From the connections list, select the connection for which the broker needs to be allocated by clicking the Select broker dropdown.

Broker Allocation Through Connections List

Server Setting

The server setting is performed to allow connection with the site for the manager. Following are the steps to configure the server settings:

  1. From the homepage header, click on the User.

  2. Access Super Admin.

Super Admin Login

3. Input Super Admin Login Password, and click Sign In.

4. Click the Settings icon on the header.

Settings Icon of Super Admin Site

5. Under MT4 Settings, click MT4 Server Settings.

MT4 Server Settings

6. Enable the server settings for specific broker. Example: PVPMarketsMT4 and PVPMarketOneZero are assigned a server and PVPMarketsMT4 is assigned as a read-only. (PVPMarketsMT4 is assigned read-only, since the coverage account will not be created for it.)

PVPMarkets Server

Assigning

7. Click Edit tab for each manager and input the Broker Name.

8. Perform further detail-level settings of:

  • Coverage Settings

  • Risk Profile

  • Commission Profile

  • Rebate Profile

  • Feed Profile

  • Management Fee Settings

  • Performance Fee Settings

  • Fixed Fee Settings

  • Revenue Settings

  • Asset Security Mapping

  • Asset Symbol Mapping

Site (API) Configuration

Through site configuration, a link between Domain and Connection ID is established. Following are the steps for site configuration:

8. From the homepage header, click on the User.

9. Access Super Admin.

Super Admin Login

10. Input Super Admin Login Password, and click Sign In.

11. Click the Settings icon on the header.

Settings Icon of Super Admin Site

12. Under SuperAdmin, click Site Configuration.

Site Configuration

13. Enter the following details as shown in figure 13 and click Update:

  • MAM Feed GC1 and GC2 for URL

  • New TC webservice URL

Site Configuration Settings

References

Last updated

Was this helpful?