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.
Audience
This document is intended for Support professionals who are involved in providing back-end assistance 24×7. This document will also help business decision makers who are involved in the planning, design, and implementation of future releases or builds to better understand the deployment aspects of New TC.The intended audience includes the following business roles:
Database Administrators
Support analysts
UI Analysts
Business decision makers
Consultants, business partners, and other technical staffs who work for its development.
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.
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.
Once the above configuration is completed, logout from MySQL and restore the schema provided below.
Web-server Configuration (Nginx or Apache)
Based on preference, you can use Nginx or Apache for web-server configuration.
Create a user for Web-service and deploy the Site; e.g.,
adduser siteuser.
Change the password; e.g.,
passwd siteuser.
Create a document root for web service; e.g.,
mkdir /var/www/html/site_document_root/
.List the ownership for doc root; e.g.,
chown -R siteuser:siteuser /var/www/html/site_document_root/.
Modify the user in web-service; e.g.,
vi /etc/nginx/nginx.conf, modify user = nginx to user = siteuser.
Create a nginx profile for site with an SSL certificate; e.g.,
vi /etc/nginx/conf.d/alpha_site.conf.
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.
Edit the following lines in the above file, and press Save.
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
php-cgi/var/www/html/webdocument/newTC_realdata_insertion_updation.php? mt4_id=4331
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.
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.
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.
Communication Between Windows & Linux
Install Netcat for Windows in the windows machine.
Install Netcat for Linux in the Linux machine.
In Windows, run to listen:
In Linux, run to connect:
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.
From the home screen, navigate to Control Panel, and click Uninstall a Program.
Click Turn Windows features on or off and check the Internet Information Services checkbox.
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.
From the home screen, navigate to Control Panel, and click Uninstall a Program.
Click Turn Windows features on or off and check the Microsoft Message Queue (MSMQ) Server checkbox.
3. From the home screen, enter Computer Management in the search bar, and click the Computer Management icon.
4. Access MSMQ under Services and Applications.
5. Under Private Queue, create two queues:
accountinfo
tradeinfo
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
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 =
Example:
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
The UI will receive HTCA execution on:
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:
Run the Group Symbol Info tool, and acquire the securities corresponding to the connection for which mapping is done.
In the MT4 Manager, identify the Group.
From Group, identify the Securities. Example: Forex1
Under Securities, identify the type of security. Example: Forex1 has an index 1. (Index is also known as External Asset Type in DB.)
In DB, manually insert external securities with respect to the connection in the ExternalSecurity table.
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:
In the MS SQL query pad, query using select * from Gateways.
Under the Gateways folder of the Coverage Service setup, open xlogger.ini.
Mention the URL where logs are to be placed under Path.
Open gateway.ini, and enter the following details:
Source
Catalog
Username
Password
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:
Get client’s login credentials.
Identify the MT4 Manager and the Group Name through which connection is to be made.
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:
From the homepage header, click on the User.
Access Super Admin.
3. Input Super Admin Login Password, and click Sign In.
4. Click the Settings icon on the header.
5. Under SuperAdmin, click Module Setting.
6. Select the broker for whom setting need to be done and click the Settings tab corresponding to the broker under Action.
7. Enable or disable the specific flag of New TC or Index fund and click Update.
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:
From the homepage header, click on the User.
Access Super Admin.
3. Input Super Admin Login Password, and click Sign In.
4. Click the Settings icon on the header.
5. Under MT4 Settings, click 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.
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:
From the homepage header, click on the User.
Access Super Admin.
3. Input Super Admin Login Password, and click Sign In.
4. Click the Settings icon on the header.
5. Under MT4 Settings, click 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.)
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.
10. Input Super Admin Login Password, and click Sign In.
11. Click the Settings icon on the header.
12. Under SuperAdmin, click 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
References
Title
Description
Mariadb
Nginx
PHP v5.6, PHP-FPM
MS SQL Server Standard 2014
IIS Webserver
Dot Net Framework
Microsoft Visual C++ Redistributable 2012, 2015x86 and x64 bit
MS SQL Create Users
MySQL ODBC Connector 5.3 (32-bit)
MySQL ODBC Connector 5.3 (64-bit)
Create Website in IIS
Setting up ODBC
Netcat
Last updated
Was this helpful?