From 38abb59b2f3d49b15f6721ecebc50a261062d7ab Mon Sep 17 00:00:00 2001 From: Colin DuPlantis Date: Fri, 19 May 2023 17:13:09 -0700 Subject: [PATCH 1/3] MATP-1188 Create Server Installer --- .../src/main/sample_data/bin/dare.sh | 95 +++ .../src/main/sample_data/bin/setEnv.sh | 30 + .../sample_data/bin/startServerComponents.sh | 20 + .../sample_data/bin/stopServerComponents.sh | 30 + .../sample_data/conf/application.properties | 186 +++++ .../src/main/sample_data/conf/log4j2.xml | 97 +++ .../src/main/sample_data/contrib/archive.sh | 74 ++ .../src/main/sample_data/contrib/archive.sql | 137 ++++ .../main/sample_data/contrib/crontab.root.txt | 26 + .../src/main/sample_data/contrib/crontab.txt | 24 + .../src/main/sample_data/contrib/dare.deb | 53 ++ .../src/main/sample_data/contrib/install.sh | 46 ++ .../src/main/sample_data/contrib/rollback.sh | 108 +++ .../sample_data/license/private-license.txt | 72 ++ .../src/main/sample_data/server.install4j | 725 ++++++++++++++++++ 15 files changed, 1723 insertions(+) create mode 100644 packages/dare-package/src/main/sample_data/bin/dare.sh create mode 100644 packages/dare-package/src/main/sample_data/bin/setEnv.sh create mode 100644 packages/dare-package/src/main/sample_data/bin/startServerComponents.sh create mode 100644 packages/dare-package/src/main/sample_data/bin/stopServerComponents.sh create mode 100644 packages/dare-package/src/main/sample_data/conf/application.properties create mode 100644 packages/dare-package/src/main/sample_data/conf/log4j2.xml create mode 100644 packages/dare-package/src/main/sample_data/contrib/archive.sh create mode 100644 packages/dare-package/src/main/sample_data/contrib/archive.sql create mode 100644 packages/dare-package/src/main/sample_data/contrib/crontab.root.txt create mode 100644 packages/dare-package/src/main/sample_data/contrib/crontab.txt create mode 100644 packages/dare-package/src/main/sample_data/contrib/dare.deb create mode 100644 packages/dare-package/src/main/sample_data/contrib/install.sh create mode 100644 packages/dare-package/src/main/sample_data/contrib/rollback.sh create mode 100644 packages/dare-package/src/main/sample_data/license/private-license.txt create mode 100644 packages/dare-package/src/main/sample_data/server.install4j diff --git a/packages/dare-package/src/main/sample_data/bin/dare.sh b/packages/dare-package/src/main/sample_data/bin/dare.sh new file mode 100644 index 0000000000..81132e36de --- /dev/null +++ b/packages/dare-package/src/main/sample_data/bin/dare.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +. "$(dirname $0)/../../setEnv.sh" + +app_stop() +{ + exit $1 +} + +trap app_stop EXIT INT TERM + +APPLICATION_DIR=dare + +cd ${DARE_HOME} + +THE_CLASSPATH=./conf +for file in `ls -1 ./lib/*.jar` +do + THE_CLASSPATH=${THE_CLASSPATH}:${file} +done + +rm -f dare.pid +# +# Set this to the log directory defined in the logger config file +LOGDIR=${DARE_HOME}/logs +# Set this to the name of the stderr/stdout file you want to write for each instance +LOGNAME=dareout +# Set this to a relative directory to the cluster installation +INSTANCE_DIR=instances +# +# These port values are used for day-to-day work, just make sure they are unique and leave enough room for each instance +# +# DARE RPC port +RPC_PORT=13010 +# Cluster port +CLUSTER_PORT=9800 +# +# These values are typically the ones you'll need to change +# +# This port value is what web services connect to +# DARE WS port +WS_PORT=13000 +# +# This port value is what incoming FIX sessions would connect to the DARE instance +DARE_ACCEPTOR_PORT=13020 +# This port value is what incoming FIX sessions would connect to the EXSIM instance +EXSIM_ACCEPTOR_PORT=13030 +# +# Set this to a comma-separated list of cluster hosts +CLUSTER_TCPIP_MEMBERS=127.0.0.1 +# +# Set this to the total number of instances you want to create, excluding the master instance +TOTAL_INSTANCES=1 +# +# Set this to the number of milliseconds to delay between starting instances +INSTANCE_START_DELAY=5000 +# +# Set this to the min heap size for each instance +INSTANCE_XMS=4096m +# Set this to the max heap size for each instance +INSTANCE_XMX=4096m +# +java -Xms384m -Xmx512m -Xloggc:${LOGDIR}/dare_gc.out -server -Dorg.marketcetera.appDir=${METC_HOME}/${APPLICATION_DIR}\ + -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods\ + -Dlog.configurationFile=${METC_HOME}/${APPLICATION_DIR}/conf/logback.xml\ + -cp "${THE_CLASSPATH}"\ + -Dorg.marketcetera.app=com.marketcetera.sixer.SixerApplication\ + -Dmetc.cluster.tcpip.members=${CLUSTER_TCPIP_MEMBERS}\ + -Dmetc.logdir=${LOGDIR}\ + -Dmetc.logname=${LOGNAME}\ + -Dmetc.total.instances=${TOTAL_INSTANCES}\ + -Dmetc.instance.spring.config.location=conf/application.properties\ + -Dmetc.instance.log.configurationFile=conf/logback.xml\ + -Dmetc.instance.Xms${INSTANCE_XMS}\ + -Dmetc.instance.Xmx${INSTANCE_XMX}\ + -Dmetc.start.delay=${INSTANCE_START_DELAY}\ + -Dmetc.port.metc.rpc.port=${RPC_PORT}\ + -Dmetc.port.server.port=${WS_PORT}\ + -Dmetc.port.metc.cluster.port=${CLUSTER_PORT}\ + -Dmetc.port.metc.dare.acceptor.port=${DARE_ACCEPTOR_PORT}\ + -Dmetc.port.metc.exsim.acceptor.port=${EXSIM_ACCEPTOR_PORT}\ + -Dorg.marketcetera.instanceDir=${INSTANCE_DIR}\ + -Dmetc.instance.ALL.LOG.LEVEL=${ALL_LOG_LEVEL}\ + -Dmetc.instance.METC.LOGBACK.APPENDERS=${METC_LOGBACK_APPENDERS}\ + -Dmetc.instance.METC.LOG.LEVEL=${METC_LOG_LEVEL}\ + -Dmetc.instance.XX:+UseParallelGC\ + -Dmetc.instance.XX:+AggressiveOpts\ + -Dmetc.instance.XX:+UseFastAccessorMethods\ + -Dmetc.instance.Xloggc:${LOGDIR}/dare_gc.out\ + -Dmetc.instance=0\ + org.marketcetera.core.MultiInstanceApplicationContainer $* & +retval=$? +pid=$! +[ ${retval} -eq 0 ] && [ ${pid} -eq ${pid} ] && echo ${pid} > dare.pid +exit ${retval} diff --git a/packages/dare-package/src/main/sample_data/bin/setEnv.sh b/packages/dare-package/src/main/sample_data/bin/setEnv.sh new file mode 100644 index 0000000000..e9573d7756 --- /dev/null +++ b/packages/dare-package/src/main/sample_data/bin/setEnv.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +## +## Set environment variables for the Marketcetera Platform +## +## Future: If messages are an output of this script, then those messages +## will have to be localized using resource bundles, not hard-coded. +## +## Author: klim@marketcetera.com +## Since: 1.5.0 +## Version: $Id: setEnv.sh 16121 2012-01-18 22:03:10Z colin $ +## + +# Make sure we're not the root user. +if [ "$(id -u)" = "0" ]; then + echo "This script must not be run as root." 1>&2 + exit 1 +fi + +export METC_HOME="/opt/Marketcetera" +export DATA_HOME="/opt/Marketcetera" + +export DARE_HOME=${METC_HOME}/dare +export EXSIM_HOME=${METC_HOME}/exsim +export PHOTON_HOME=${METC_HOME}/photon +export SE_HOME=${METC_HOME}/strategyengine +export UI_HOME=${METC_HOME}/ui +export UBUNTU_MENUPROXY=0 +export PATH=${METC_HOME}/jdk1.8.0_261/bin:${DARE_HOME}/bin:${EXSIM_HOME}/bin:${PHOTON_HOME}/:${SE_HOME}/bin:${PATH} +export LD_LIBRARY_PATH=${SE_HOME}/modules/lib:${LD_LIBRARY_PATH} diff --git a/packages/dare-package/src/main/sample_data/bin/startServerComponents.sh b/packages/dare-package/src/main/sample_data/bin/startServerComponents.sh new file mode 100644 index 0000000000..b4a2a6054f --- /dev/null +++ b/packages/dare-package/src/main/sample_data/bin/startServerComponents.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +## +## Start server components for the Marketcetera Platform +## +## Future: If messages are an output of this script, then those messages +## will have to be localized using resource bundles, not hard-coded. +## +## Author: klim@marketcetera.com +## Since: 1.5.0 +## Version: $Id: startServerComponents.sh 15467 2009-06-10 17:06:18Z klim $ +## + +. "$(dirname $0)/setEnv.sh" + +cd ${DARE_HOME} +./bin/dare.sh + +#cd ${UI_HOME} +#./bin/ui.sh > /dev/null 2>&1 diff --git a/packages/dare-package/src/main/sample_data/bin/stopServerComponents.sh b/packages/dare-package/src/main/sample_data/bin/stopServerComponents.sh new file mode 100644 index 0000000000..c7cf323601 --- /dev/null +++ b/packages/dare-package/src/main/sample_data/bin/stopServerComponents.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +## +## Stop server components for the Marketcetera Platform +## +## Future: If messages are an output of this script, then those messages +## will have to be localized using resource bundles, not hard-coded. +## +## Author: klim@marketcetera.com +## Since: 1.5.0 +## Version: $Id: stopServerComponents.sh 15403 2009-04-22 23:30:16Z klim $ +## + +. "$(dirname $0)/setEnv.sh" + +cd ${DARE_HOME} +if [ -f dare.pid ] +then + kill `cat dare.pid` +else + pkill -f java +fi + +#cd ${UI_HOME} +#if [ -f ui.pid ] +#then +# kill `cat ui.pid` +#else +# pkill -f java +#fi diff --git a/packages/dare-package/src/main/sample_data/conf/application.properties b/packages/dare-package/src/main/sample_data/conf/application.properties new file mode 100644 index 0000000000..b1b8b90ff2 --- /dev/null +++ b/packages/dare-package/src/main/sample_data/conf/application.properties @@ -0,0 +1,186 @@ +spring.datasource.pool-size=30 +spring.jpa.hibernate.use-new-id-generator-mappings=true +spring.jpa.show-sql=false +spring.jpa.generate-ddl=false +spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy +spring.jpa.hibernate.ddl-auto=validate +spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true +spring.flyway.enabled=true +# +# Marketcetera platform settings +# +# hostname for socket connections +metc.ws.hostname=0.0.0.0 +# interval in seconds at which to record metrics +metc.metric.service.log.reporter.interval=10 +# list of classes that can be marshaled to and from XML +metc.xml.context.path.classes=org.marketcetera.trade.Equity,org.marketcetera.trade.Future +# determines how long to delay evaluation of work units +metc.cluster.work.unit.evaluation.delay=1000 +# indicates how long, if at all, to delay FIX session creation from config +metc.fix.session.creation.delay=10000 +# +# Database Settings +# +spring.datasource.url=${metc.jdbc.url} +spring.datasource.username=${metc.jdbc.user} +spring.datasource.password=${metc.jdbc.password} +spring.datasource.driver-class-name=${metc.jdbc.driver} +spring.flyway.locations=db/migration/${metc.flyway.vendor} +# +# Security Settings +# +# number of log rounds used to compute the hash, larger is more secure but slower, min value 10 recommended +metc.security.bcrypt.strength=10 +# BCrypt version to use, one of {$2A,$2Y,$2B} +metc.security.bcrypt.version=$2A +# indicate whether client RPC calls will use SSL or not +metc.security.use.ssl=false +# public key path for SSL cert +metc.security.ssl.public.key.path= +# private key path for SSL cert +metc.security.ssl.private.key.path= +# +# Strategy Service Settings +# +# interval in ms to poll the incoming strategy directory for uploaded strategies +metc.strategy.incoming.directory.polling.intervalms=5000 +# directory to poll for incoming strategies +metc.strategy.incoming.directory=instances/strategy_incoming +# directory to store strategies +metc.strategy.storage.directory=instances/strategy_storage +# directory to temporarily store incoming strategies +metc.strategy.temporary.directory=/tmp +# general provisioning directory +metc.provisioning.directory=instances/provisioning +# +# logging settings +# +logging.config=conf/log4j2.xml +# +# FIX Session Provider +# +metc.fix.message.store.factory.class:org.marketcetera.fix.store.HibernateMessageStoreFactory +# +# initiator global session settings +# +fix.session-descriptors[0].settings.ConnectionType=initiator +fix.session-descriptors[0].settings.HeartBtInt=30 +fix.session-descriptors[0].settings.SLF4JLogHeartbeats=N +fix.session-descriptors[0].settings.StartTime=00:00:00 +fix.session-descriptors[0].settings.EndTime=00:00:00 +fix.session-descriptors[0].settings.TimeZone=US/Pacific +fix.session-descriptors[0].settings.UseDataDictionary=Y +fix.session-descriptors[0].settings.ReconnectInterval=1 +fix.session-descriptors[0].settings.ResetOnLogon=Y +fix.session-descriptors[0].settings.ResetOnLogout=Y +fix.session-descriptors[0].settings.ResetOnDisconnect=Y +fix.session-descriptors[0].settings.ResetOnError=Y +fix.session-descriptors[0].settings.ValidateUserDefinedFields=N +fix.session-descriptors[0].settings.SLF4JLogHeartbeats=N +# +# initiator sessions +# +# initiator session 1 +# +fix.session-descriptors[0].sessions[0].name=Exsim Initiator1 +fix.session-descriptors[0].sessions[0].description=Exsim initiator 1 +fix.session-descriptors[0].sessions[0].broker-id=exsim1 +fix.session-descriptors[0].sessions[0].host=exchange.marketcetera.com +fix.session-descriptors[0].sessions[0].port=7001 +fix.session-descriptors[0].sessions[0].enabled=true +fix.session-descriptors[0].sessions[0].settings.BeginString=FIXT.1.1 +fix.session-descriptors[0].sessions[0].settings.SenderCompID=MATP-colin2 +fix.session-descriptors[0].sessions[0].settings.TargetCompID=MRKTC-EXCH +fix.session-descriptors[0].sessions[0].settings.AppDataDictionary=FIX50SP2.xml +fix.session-descriptors[0].sessions[0].settings.TransportDataDictionary=FIXT11.xml +fix.session-descriptors[0].sessions[0].settings.DefaultApplVerID=9 +# +# acceptor global session settings +# +fix.session-descriptors[1].settings.ConnectionType=acceptor +fix.session-descriptors[1].settings.SLF4JLogHeartbeats=N +fix.session-descriptors[1].settings.StartTime=00:00:00 +fix.session-descriptors[1].settings.EndTime=00:00:00 +fix.session-descriptors[1].settings.TimeZone=US/Pacific +fix.session-descriptors[1].settings.UseDataDictionary=Y +fix.session-descriptors[1].settings.ReconnectInterval=1 +fix.session-descriptors[1].settings.ResetOnLogon=Y +fix.session-descriptors[1].settings.ResetOnLogout=Y +fix.session-descriptors[1].settings.ResetOnDisconnect=Y +fix.session-descriptors[1].settings.ResetOnError=Y +fix.session-descriptors[1].settings.ValidateUserDefinedFields=N +fix.session-descriptors[1].settings.SLF4JLogHeartbeats=N +# +# acceptor sessions +# +# acceptor session 1 +# +fix.session-descriptors[1].sessions[0].name=Acceptor1 +fix.session-descriptors[1].sessions[0].description=Test acceptor 1 +fix.session-descriptors[1].sessions[0].broker-id=acceptor1 +fix.session-descriptors[1].sessions[0].enabled=true +fix.session-descriptors[1].sessions[0].settings.BeginString=FIX.4.2 +fix.session-descriptors[1].sessions[0].settings.DataDictionary=FIX42.xml +fix.session-descriptors[1].sessions[0].settings.SenderCompID=TARGET1 +fix.session-descriptors[1].sessions[0].settings.TargetCompID=MATP +# +# table sorting aliases +# +metc.persistent.report.aliases={ \ + 'brokerid':'brokerID', \ + 'user':'mActor', \ + 'actor':'mActor', \ + 'fixmessage':'mFixMessage', \ + 'message':'mFixMessage', \ + 'originator':'mOriginator', \ + 'reporttype':'mReportType', \ + 'orderid':'orderID', \ + 'reportid':'reportID', \ + 'sessionid':'sessionIdValue' \ +} +metc.persistent.execution.report.aliases={ \ + 'brokerid':'report.brokerID', \ + 'user':'actor', \ + 'actor':'actor', \ + 'originator':'report.mOriginator', \ + 'reporttype':'report.mReportType', \ + 'orderid':'orderId', \ + 'originalorderid':'origOrderID', \ + 'cumulativequantity':'cumQuantity', \ + 'averageprice':'avgPrice', \ + 'executiontype':'execType', \ + 'transacttime':'report.transactTime', \ + 'instrument':'securityType,symbol,optionType,expiry,strikePrice' \ +} +# +# Exsim Market Data Adapter Configuration +# +metc.marketdata.exsim.senderCompId=unique-sendercompid +# target comp id value to use +metc.marketdata.exsim.targetCompId=MRKTC-EXCH +# hostname to connect to +metc.marketdata.exsim.hostname=exchange.marketcetera.com +# port to connect to +metc.marketdata.exsim.port=7001 +# FIX version to use for exchange traffic +metc.marketdata.exsim.fixVersion=FIX.4.4 +# FIX application version if using FIXT11 +metc.marketdata.exsim.fixAplVersion= +# interval in seconds at which to connect to the exchange +metc.marketdata.exsim.reconnectInterval=5 +# session heart beat interval +metc.marketdata.exsim.heartBtInt=30 +# session start time +metc.marketdata.exsim.startTime=00:00:00 +# session end time +metc.marketdata.exsim.endTime=22:45:00 +# session time zone +metc.marketdata.exsim.timeZone=US/Pacific +# session FIX dictionary +metc.marketdata.exsim.dataDictionary=FIX44.xml +# session FIX application data dictionary if using FIXT11 +metc.marketdata.exsim.appDataDictionary= +# number of milliseconds to wait for the feed to become available if a request is made while it is offline +metc.marketdata.exsim.feedAvailableTimeout=10000 diff --git a/packages/dare-package/src/main/sample_data/conf/log4j2.xml b/packages/dare-package/src/main/sample_data/conf/log4j2.xml new file mode 100644 index 0000000000..5305cfcf0a --- /dev/null +++ b/packages/dare-package/src/main/sample_data/conf/log4j2.xml @@ -0,0 +1,97 @@ + + + + -instance$${sys:metc.instance} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/dare-package/src/main/sample_data/contrib/archive.sh b/packages/dare-package/src/main/sample_data/contrib/archive.sh new file mode 100644 index 0000000000..881f4c5243 --- /dev/null +++ b/packages/dare-package/src/main/sample_data/contrib/archive.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +set -e + +installdir=/opt/Marketcetera +dare_contrib_dir=${installdir}/dare/contrib +archivedir="${installdir}/archive" +timestamp="`date +%Y%m%d-%H%M%S%Z`" +dumpfilename="${archivedir}/archive-${timestamp}.sql" +archivesql="${dare_contrib_dir}/archive.sql" +errorfilename="/tmp/archive-${timestamp}_error.txt" +statusfilename="/tmp/archive-${timestamp}_status.txt" +hostname=sxr-global-postgres.internal.sxr.io +user=postgres +psqldump=/usr/bin/pg_dump +psql=/usr/bin/psql +gzip=/bin/gzip +service=/usr/sbin/service +err_mailing_list=colin@marketcetera.com +status_mailing_list=colin@marketcetera.com +crontab=/usr/bin/crontab +sudo=/usr/bin/sudo +signal_file=/tmp/exchange-shutdown +export PGPASSWORD="tird2hirm.taik-LAD" + +function err_report() { + echo "Error on line $1" >> ${errorfilename} + dos2unix -o ${errorfilename} > /dev/null 2>&1 + mail -s "Daily Start/Stop/Archive Error" ${err_mailing_list} < ${errorfilename} + rm -f ${errorfilename} +} + +function clean_up { + ${sudo} ${service} dare start >> ${statusfilename} 2>> ${errorfilename} + echo "DARE restarted at `date`" >> ${statusfilename} 2>> ${errorfilename} + dos2unix -o ${statusfilename} > /dev/null 2>&1 + mail -s "Daily Start/Stop/Archive `hostname` Status" ${status_mailing_list} < ${statusfilename} + rm -f ${statusfilename} + exit +} + +function wait_to_restart { + while [ ! -f "${signal_file}" ]; do + seconds=`echo $(($(date -f - +%s- <<< $'today 20:10\nnow')0))` + if [ "$seconds" -lt "1" ]; then + echo "Must restart now" >> ${statusfilename} 2>> ${errorfilename} + break + fi + sleep 1 + done + echo "Beginning DARE archive at `date`" >> ${statusfilename} 2>> ${errorfilename} +} + +if [ -e ${installdir}/no_restart ]; +then + exit +fi + +trap 'err_report $LINENO' ERR +trap clean_up EXIT SIGHUP SIGINT SIGTERM + +touch ${statusfilename} +touch ${errorfilename} + +wait_to_restart + +${sudo} ${service} dare stop >> ${statusfilename} 2>> ${errorfilename} +echo "DARE stopped at `date`" >> ${statusfilename} 2>> ${errorfilename} + +cd ${dare_contrib_dir} + +mkdir -p ${archivedir} >> ${statusfilename} 2>> ${errorfilename} +time ${psql} -h ${hostname} -U ${user} postgres < ${archivesql} +echo "Archive complete at `date`" >> ${statusfilename} 2>> ${errorfilename} diff --git a/packages/dare-package/src/main/sample_data/contrib/archive.sql b/packages/dare-package/src/main/sample_data/contrib/archive.sql new file mode 100644 index 0000000000..549e744be1 --- /dev/null +++ b/packages/dare-package/src/main/sample_data/contrib/archive.sql @@ -0,0 +1,137 @@ +begin; +-- +select now() as archive_start; +--- +--- save ids of open orders +--- +drop table if exists tmp_ids; +select clord_id,current_message_id into tmp_ids from exchange_open_orders; +--- +--- remove non-open order records +--- +delete from exchange_closed_orders; +delete from exchange_trade_details where buy_order_id not in (select clord_id from tmp_ids) and sell_order_id not in (select clord_id from tmp_ids); +delete from exec_reports where order_id not in (select clord_id from tmp_ids); +delete from order_status where order_id not in (select clord_id from tmp_ids); +delete from reports where id not in (select report_id from exec_reports); +delete from outgoing_messages where order_id not in (select clord_id from tmp_ids); +delete from fix_messages where id not in (select current_message_id from tmp_ids) and id not in (select fix_message_id from reports) and id not in (select fix_message_id from outgoing_messages); +-- +-- sixer tables +-- +-- +-- sixer_current_position negative position check +-- +select count(*) from sixer_current_positions where position < 0; +-- +-- cleanup +-- +drop table if exists tmp_ids; +-- +select clock_timestamp() as archive_end; +-- +commit; +-- +select clock_timestamp() as va_start; +VACUUM ANALYZE exchange_closed_orders; +VACUUM ANALYZE exchange_marketdata_content; +VACUUM ANALYZE exchange_marketdata_exchanges; +VACUUM ANALYZE exchange_marketdata_instruments; +VACUUM ANALYZE exchange_marketdata_requests; +VACUUM ANALYZE exchange_open_orders; +VACUUM ANALYZE exchange_orderbook_stats; +VACUUM ANALYZE exchange_orderbooks; +VACUUM ANALYZE exchange_trade_details; +VACUUM ANALYZE exchanges; +VACUUM ANALYZE exec_reports; +VACUUM ANALYZE fix_messages; +VACUUM ANALYZE fix_session_attr_dscrptrs; +VACUUM ANALYZE fix_session_attributes; +VACUUM ANALYZE fix_sessions; +VACUUM ANALYZE flyway_schema_history; +VACUUM ANALYZE handled_messages; +VACUUM ANALYZE id_repository; +VACUUM ANALYZE incoming_fix_messages; +VACUUM ANALYZE message_store_messages; +VACUUM ANALYZE message_store_sessions; +VACUUM ANALYZE order_status; +VACUUM ANALYZE outgoing_messages; +VACUUM ANALYZE permissions; +VACUUM ANALYZE reports; +VACUUM ANALYZE roles; +VACUUM ANALYZE roles_permissions; +VACUUM ANALYZE roles_users; +VACUUM ANALYZE sixer_current_positions; +VACUUM ANALYZE sixer_events; +VACUUM ANALYZE sixer_lots; +VACUUM ANALYZE sixer_managed_orders; +VACUUM ANALYZE sixer_marketdata; +VACUUM ANALYZE sixer_marketdata_elements; +VACUUM ANALYZE sixer_order_status; +VACUUM ANALYZE sixer_placed_orders; +VACUUM ANALYZE sixer_pnl; +VACUUM ANALYZE sixer_positions; +VACUUM ANALYZE sixer_trades; +VACUUM ANALYZE sixer_user_trades; +VACUUM ANALYZE sixer_users; +VACUUM ANALYZE supervisor_permissions; +VACUUM ANALYZE supervisor_permissions_permissions; +VACUUM ANALYZE supervisor_permissions_users; +VACUUM ANALYZE user_attributes; +VACUUM ANALYZE users; +select clock_timestamp() as va_end; +-- +reindex table exchange_closed_orders; +reindex table exchange_marketdata_content; +reindex table exchange_marketdata_exchanges; +reindex table exchange_marketdata_instruments; +reindex table exchange_marketdata_requests; +reindex table exchange_open_orders; +reindex table exchange_orderbook_stats; +reindex table exchange_orderbooks; +reindex table exchange_trade_details; +reindex table exchanges; +reindex table exec_reports; +reindex table fix_messages; +reindex table fix_session_attr_dscrptrs; +reindex table fix_session_attributes; +reindex table fix_sessions; +reindex table flyway_schema_history; +reindex table handled_messages; +reindex table id_repository; +reindex table incoming_fix_messages; +reindex table message_store_messages; +reindex table message_store_sessions; +reindex table order_status; +reindex table outgoing_messages; +reindex table permissions; +reindex table reports; +reindex table roles; +reindex table roles_permissions; +reindex table roles_users; +reindex table sixer_allocations; +reindex table sixer_contract_definitions; +reindex table sixer_contract_extensions; +reindex table sixer_contracts; +reindex table sixer_current_positions; +reindex table sixer_events; +reindex table sixer_game_players; +reindex table sixer_games; +reindex table sixer_lots; +reindex table sixer_managed_orders; +reindex table sixer_marketdata; +reindex table sixer_marketdata_elements; +reindex table sixer_order_status; +reindex table sixer_placed_orders; +reindex table sixer_pnl; +reindex table sixer_positions; +reindex table sixer_trades; +reindex table sixer_user_trades; +reindex table sixer_users; +reindex table supervisor_permissions; +reindex table supervisor_permissions_permissions; +reindex table supervisor_permissions_users; +reindex table user_attributes; +reindex table users; +-- +select clock_timestamp() as reindex_end; diff --git a/packages/dare-package/src/main/sample_data/contrib/crontab.root.txt b/packages/dare-package/src/main/sample_data/contrib/crontab.root.txt new file mode 100644 index 0000000000..36d1b6ef9b --- /dev/null +++ b/packages/dare-package/src/main/sample_data/contrib/crontab.root.txt @@ -0,0 +1,26 @@ +MAILTO=colin@marketcetera.com +# Edit this file to introduce tasks to be run by cron. +# +# Each task to run has to be defined through a single line +# indicating with different fields when the task will be run +# and what command to run for the task +# +# To define the time you can provide concrete values for +# minute (m), hour (h), day of month (dom), month (mon), +# and day of week (dow) or use '*' in these fields (for 'any').# +# Notice that tasks will be started based on the cron's system +# daemon's notion of time and timezones. +# +# Output of the crontab jobs (including errors) is sent through +# email to the user the crontab file belongs to (unless redirected). +# +# For example, you can run a backup of all your user accounts +# at 5 a.m every week with: +# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ +# +# For more information see the manual pages of crontab(5) and cron(8) +# +# m h dom mon dow command +# Clear cached RAM every hour +0 0 * * * /bin/sync; echo 3 > /proc/sys/vm/drop_caches +45 0 * * * /usr/sbin/service haproxy restart diff --git a/packages/dare-package/src/main/sample_data/contrib/crontab.txt b/packages/dare-package/src/main/sample_data/contrib/crontab.txt new file mode 100644 index 0000000000..4d76db94fc --- /dev/null +++ b/packages/dare-package/src/main/sample_data/contrib/crontab.txt @@ -0,0 +1,24 @@ +MAILTO=colin@marketcetera.com +# Edit this file to introduce tasks to be run by cron. +# +# Each task to run has to be defined through a single line +# indicating with different fields when the task will be run +# and what command to run for the task +# +# To define the time you can provide concrete values for +# minute (m), hour (h), day of month (dom), month (mon), +# and day of week (dow) or use '*' in these fields (for 'any').# +# Notice that tasks will be started based on the cron's system +# daemon's notion of time and timezones. +# +# Output of the crontab jobs (including errors) is sent through +# email to the user the crontab file belongs to (unless redirected). +# +# For example, you can run a backup of all your user accounts +# at 5 a.m every week with: +# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ +# +# For more information see the manual pages of crontab(5) and cron(8) +# +# m h dom mon dow command +15 22 * * WED /bin/bash /opt/Marketcetera/dare/contrib/archive.sh diff --git a/packages/dare-package/src/main/sample_data/contrib/dare.deb b/packages/dare-package/src/main/sample_data/contrib/dare.deb new file mode 100644 index 0000000000..e046ef3e4e --- /dev/null +++ b/packages/dare-package/src/main/sample_data/contrib/dare.deb @@ -0,0 +1,53 @@ +#!/bin/sh +set -e +### BEGIN INIT INFO +# Provides: dare +# Required-Start: $local_fs $remote_fs $network $time +# Required-Stop: $local_fs $remote_fs $network $time strategyengine +# Should-Start: $syslog +# Should-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Marketcetera Deploy Anywhere Routing Engine +### END INIT INFO +# INIT Script +###################################### + +# Define some variables +# Name of app +APP=dare +# Name of the user to run as +USER=marketcetera +# Location of application's bin directory +BASE=/opt/Marketcetera +DARE_HOME=${BASE}/dare + +case "$1" in +# Start command +start) + echo "Starting $APP" + /bin/su - $USER -c "${BASE}/startServerComponents.sh" + retval=$? + pidval=$! + echo + return $retval +;; +# Stop command +stop) + echo "Stopping $APP" + /bin/su - $USER -c "${BASE}/stopServerComponents.sh" + echo "$APP stopped successfully" +;; +# Restart command +restart) + $0 stop + sleep 5 + $0 start +;; +*) + echo "Usage: /etc/init.d/$APP {start|restart|stop}" + exit 1 +;; +esac + +exit 0 diff --git a/packages/dare-package/src/main/sample_data/contrib/install.sh b/packages/dare-package/src/main/sample_data/contrib/install.sh new file mode 100644 index 0000000000..20dde963bc --- /dev/null +++ b/packages/dare-package/src/main/sample_data/contrib/install.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +. "$(dirname $0)/../../setEnv.sh" + +CURRENT_VERSION=${1} +BACKUP_DIR=${METC_HOME}/backup + +usage() +{ + echo "Usage: install.sh " +} + +pushd ${METC_HOME} + +if [ "${CURRENT_VERSION}" != "" ]; then + echo "Backing up version ${CURRENT_VERSION}" +else + usage + exit 1 +fi + +# validate current version +find . -name 'sixer-core-${CURRENT_VERSION}.jar' > /dev/null 2>&1 || (echo "Cannot verify ${CURRENT_VERSION}";exit 2) +echo "Confirmed current version ${CURRENT_VERSION}" + +# backup existing +echo "Backing up ${CURRENT_VERSION}" +BACKUP_FILE="${BACKUP_DIR}/backup-${CURRENT_VERSION}.tar.bz2" +mkdir -p ${BACKUP_DIR} +tar jcvf ${BACKUP_FILE} dare/bin dare/conf dare/contrib dare/lib ui/bin ui/lib ui/conf + +# remove current version libs +echo "Removing current version JARs" +find . -name "*-${CURRENT_VERSION}.jar" -exec rm -f {} \; +rm dare/bin/* dare/conf/* dare/lib/* ui/bin/* ui/lib/* ui/conf/* + +# install packages +echo "Installing new packages" +cd ${METC_HOME}/.. +tar jxvf /home/ubuntu/packages/sixer-server-package.tar.bz2 +tar jxvf /home/ubuntu/packages/sixer-ui-package.tar.bz2 + +chmod +x ${METC_HOME}/dare/contrib/install.sh + +echo "New version installed" +popd diff --git a/packages/dare-package/src/main/sample_data/contrib/rollback.sh b/packages/dare-package/src/main/sample_data/contrib/rollback.sh new file mode 100644 index 0000000000..a6e306c7de --- /dev/null +++ b/packages/dare-package/src/main/sample_data/contrib/rollback.sh @@ -0,0 +1,108 @@ +#!/bin/bash + +. "$(dirname $0)/../../setEnv.sh" + +service=/usr/sbin/service +tar=/bin/tar +rm=/bin/rm +backupdir=${METC_HOME}/backup + +function finish { + popd + echo + echo "====================================" + echo "Rollback database now (if necessary)" + echo "====================================" + echo + read -n 1 -s -r -p "Press any key to continue" + echo + echo "===========================" + echo "Starting Marketcetera stack" + echo "===========================" + echo + sudo service dare start +} + +# stop system +echo +echo "===========================" +echo "Stopping Marketcetera stack" +echo "===========================" +echo + +sudo service dare stop + +pushd ${METC_HOME} + +trap finish EXIT + +# provide choice of rollback options + +i=0 +for version in `ls ${backupdir}| grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'` +do + options[$i]=${version} + ((i++)) +done +options[$i]="Quit" +echo +PS3='Please enter your choice for version to rollback to: ' +select opt in "${options[@]}" +do + if [ "${opt}" == "Quit" ]; then + echo + echo "************************" + echo "Quitting with no changes" + echo "************************" + echo + exit 2 + fi + if [ "${opt}" == "" ]; then + echo + echo "**************" + echo "Invalid option" + echo "**************" + echo + else + echo + echo "======================" + echo "Rolling back to ${opt}" + echo "======================" + echo + break + fi +done + +cd ${METC_HOME} +backupfile="${backupdir}/backup-${opt}.tar.bz2" +if [ -f "${backupfile}" ]; then + echo + echo "======================" + echo "Verified ${backupfile}" + echo "======================" + echo +else + echo + echo "***************************************************************" + echo "Cannot roll back to ${opt} because ${backupfile} does not exist" + echo "***************************************************************" + echo + exit 3 +fi +echo +echo "==================================" +echo "Removing current version artifacts" +echo "==================================" +echo +${rm} -rf dare/bin dare/conf dare/contrib dare/lib ui/bin ui/lib ui/conf +echo +echo "=====================================" +echo "Installing previous version artifacts" +echo "=====================================" +echo +${tar} jxvf ${backupfile} +echo +echo "=====================" +echo "Rolled back to ${opt}" +echo "=====================" +echo diff --git a/packages/dare-package/src/main/sample_data/license/private-license.txt b/packages/dare-package/src/main/sample_data/license/private-license.txt new file mode 100644 index 0000000000..aab5547728 --- /dev/null +++ b/packages/dare-package/src/main/sample_data/license/private-license.txt @@ -0,0 +1,72 @@ +Click-wrap Software Licence Agreement +CAREFULLY READ THE FOLLOWING LICENCE AGREEMENT CAREFULLY! IT CONTAINS VERY IMPORTANT INFORMATION ABOUT YOUR RIGHTS AND OBLIGATIONS, AS WELL AS LIMITATIONS AND EXCLUSIONS THAT MAY APPLY TO YOU. THIS DOCUMENT CONTAINS A DISPUTE RESOLUTION CLAUSE. BY CLICKING ON THE “ACCEPT” BUTTON, YOU ARE CONSENTING TO BE BOUND BY AND ARE BECOMING A PARTY TO THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, CLICK THE “DO NOT ACCEPT” BUTTON OR LEAVE THE WEBSITE. +Please contact us at [info@marketcetera.com] for any queries. +“You” or “Your” means the person or company who is being licensed to use the Licensor software in association with the Usage Agreement (“Usage Agreement”). “We”, “Our” and “Us” means Marketcetera Inc. +NOW, THEREFORE, THIS AGREEMENT WITNESSETH that, in consideration of the mutual covenants contained herein, the Parties hereto agree as follows: +1. DEFINITIONS +1.1. Definitions. Capitalized terms in this Agreement will have the following meanings: +“Agreement” means this Software Licence Agreement between Us and You; +“Licensed Software” means certain commercial software products being provided to You under this Agreement, including executable program modules thereof, as well as related documentation and computer readable media; +“Sublicensed Software” means certain third party owned software components being provided under this Agreement, that are required to properly enable or operate the Licensed Software; +Other capitalized terms have the meanings defined in the Usage Agreement. +2. SOFTWARE LICENCE, RIGHTS & RESTRICTIONS +2.1 Software Licence and Rights. In consideration of the mutual covenants, and subject to the provisions contained in this Agreement, We hereby grant to You a revocable, non-exclusive licence to use the Licensed Software solely in order to utilize the Products and Services as provided under the Usage Agreement. +2.2 Restrictions. Without limiting the generality of the foregoing, You will use the Licensed Software only for purposes set forth herein, and, further, You expressly agree that You DO NOT have rights to: +(a) own title, or transfer title to the Licensed Software to another party; +(b) distribute, or sublicense or otherwise provide copies or any rights in relation to the Licensed Software to any third party; +(c) pledge, hypothecate, alienate or otherwise encumber the Licensed Software to any third party; +(d) use the Licensed Software to rent, lease or otherwise provide location-enabled telecommunication or information services to Your customers, including, without limitation, data processing, hosting, outsourcing, service bureau or online application services (ASP) offerings; or +(e) modify, enhance, reverse-engineer, decompile, disassemble or create substantially derived forms of the Licensed Software. +2.3 Enforcement of Restrictions. We will have the right to inspect and enforce the restrictions and covenants contained in this Agreement at Your sole expense, and You hereby agree to promptly notify Us of any known violations of such restrictions. +2.4 Our Obligations. Upon execution of this Agreement, We will: +(a) permit You to download a copy of the most current version of the Licensed Software for Your use under this Agreement; and +(b) provide You with ongoing updates to the Licensed Software as We consider needed. In each such case, We will automatically provide and install the necessary updates and will notify You when the update has been installed. +3. COPYRIGHT AND MARKS +3.1 Copyright. The Licensed Software, including any documentation, media, packaging and illustrations, is copyrighted and constitutes Our valuable property. You agree that all physical manifestations of the Licensed Software will display Our copyright notice in a conspicuous manner. The Licensed Software is protected under Canadian copyright laws and international treaty provisions. You will have a right to copy the materials, provided copyright notices and acknowledgement of trade-marks are included, pursuant to the covenants herein. You will include the following notice on any printed, electronic, online or packaged version of the Licensed Software, in any form whatsoever: + “Copyright © 2014 Marketcetera, Inc. All rights reserved.” +3.2 Trade-marks. Certain logos, product names and trade-marks owned by Us may be contained within the printed materials and electronic manifestations of the Licensed Software. You will have no right to use such marks in its end-user applications except as set out in the User Agreement. +4. TITLE +4.1 Title. You acknowledge that the Licensed Software, including any associated written materials and other documentation provided under this Agreement, belongs exclusively to Us. Unencumbered title to the Licensed Software will, at all times, remain with Us. You agree to protect the Licensed Software from unauthorized use, reproduction, distribution or publication in electronic or physical form. +5. WARRANTY AND INDEMNITY +5.1 Warranty. We warrant that We are the owner of the Licensed Software, and have the right and authority to grant the licence to the Licensed Software. We do not warrant, guarantee, accept any condition or make any representation that the Licensed Software will meet Your requirements or that the use of the Licensed Software will be uninterrupted or error-free. No other verbal or written information provided by Us will create a warranty or in any way increase Our liability, and You will not rely on such information. +5.2 Indemnity. We warrant that the Licensed Software does not infringe on any current subsisting and enforceable Canadian patent or Canadian copyright, and We will and hereby do agree to indemnify and hold You harmless in respect of any losses, costs, damages or expenses (including reasonable attorney’s fees and court costs) arising out of any claim, demand or action alleging that the Licensed Software violates or infringes the Canadian copyright, patent or other intellectual property right of any third party, providing that You provide Us with reasonable cooperation in preparing a defence against any such claim. +5.3 DISCLAIMER. THERE ARE NO WARRANTIES FOR SERVICES. WE MAKE NO EXPRESS REPRESENTATIONS OR WARRANTIES, OR ACCEPT ANY CONDITIONS EXCEPT THOSE EXPRESSLY STATED IN SECTIONS 5.1 AND 5.2 ABOVE. WE DISCLAIM ALL OTHER REPRESENTATIONS, WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SOME PROVINCES DO NOT PERMIT THE EXCLUSION OF CERTAIN IMPLIED WARRANTIES OR CONDITIONS. THEREFORE, THE FOREGOING DISCLAIMERS MAY NOT APPLY TO YOU. +6. LIMITATION OF LIABILITY AND REMEDIES +6.1 LIMITATION OF LIABILITY. IN NO EVENT WILL WE BE LIABLE FOR ANY LOSSES OR DAMAGES INCURRED BY YOU, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL, INCLUDING LOST OR ANTICIPATED PROFITS, SAVINGS, INTERRUPTION TO BUSINESS, LOSS OF BUSINESS OPPORTUNITIES, LOSS OF BUSINESS INFORMATION, THE COST OF RECOVERING SUCH LOST INFORMATION, THE COST OF SUBSTITUTE INTELLECTUAL PROPERTY OR ANY OTHER PECUNIARY LOSS ARISING FROM THE USE OF, OR THE INABILITY TO USE, THE LICENSED SOFTWARE REGARDLESS OF WHETHER YOU HAVE ADVISED US OR WE HAVE ADVISED YOU OF THE POSSIBILITY OF SUCH DAMAGES. OUR AGGREGATE LIABILITY IN RESPECT OF ANY AND ALL CLAIMS WILL BE LIMITED TO ONE HUNDERD ($100.00) DOLLARS. THE FOREGOING LIMITATIONS APPLY REGARDLESS OF THE CAUSE OR CIRCUMSTANCES GIVING RISE TO SUCH LOSS, DAMAGE OR LIABILITY, EVEN IF SUCH LOSS, DAMAGE OR LIABILITY IS BASED ON NEGLIGENCE OR OTHER TORTS OR BREACH OF CONTRACT (INCLUDING FUNDAMENTAL BREACH OR BREACH OF A FUNDAMENTAL TERM). +NEITHER YOU NOR WE MAY INSTITUTE ANY ACTION IN ANY FORM ARISING OUT OF THIS AGREEMENT MORE THAN ONE (1) YEAR AFTER THE CAUSE OF ACTION HAS ARISEN. SOME PROVINCES DO NOT ALLOW THE EXCLUSION OF LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES SO THE ABOVE EXCLUSIONS MAY NOT APPLY. +6.2 Dispute Resolution. You acknowledge that We possess valuable confidential and proprietary information, including trade-marks and business practices, which would be damaging to Us if revealed in open court. You further acknowledge and agree that it is preferable to resolve all disputes between Us and You confidentially, individually and in an expeditious and inexpensive manner. We and You accordingly acknowledge and agree that private dispute resolution is preferable to court actions. Before commencing any arbitration in the manner set out in Section 6.3 below, We and You shall first attempt to resolve any dispute or differences between the both of us by way of good faith negotiation. The good faith negotiation shall commence by each of Us and You communicating our position regarding the complaint, claim, dispute or controversy to the other party, and how the both of us should resolve the dispute. We and You shall then make good faith efforts to negotiate a resolution of the claim, dispute or controversy. Neither We nor You shall commence any arbitral proceedings unless and until the good faith negotiation fails. +6.3 ARBITRATION. ANY CLAIM, DISPUTE OR CONTROVERSY (WHETHER IN CONTRACT, TORT OR OTHERWISE, WHETHER PRE-EXISTING, PRESENT OR FUTURE, AND INCLUDING STATUTORY, COMMON LAW, INTENTIONAL TORT AND EQUITABLE CLAIMS CAPABLE IN LAW OF BEING SUBMITTED TO BINDING ARBITRATION) AGAINST US, Our agents, employees, officers, directors, successors, assigns or affiliates (collectively, for purposes of this paragraph, “Licensor Group”) arising from or relating to this Agreement, its interpretation or the breach, termination or validity thereof, the relationships between the parties, whether pre-existing, present or future (including, to the full extent permitted by applicable law, relationships with third parties who are not signatories to this Agreement), Licensor Group’s advertising or any related purchase SHALL BE RESOLVED EXCLUSIVELY AND FINALLY BY BINDING ARBITRATION ADMINISTERED BY THE NATIONAL ARBITRATION FORUM (“NAF”) under its Code of Procedure and any specific procedures for the resolution of small claims and/or consumer disputes then in effect (available via the Internet at , or via telephone at 1-800-474-2371). The arbitration will be limited solely to the dispute or controversy between Customer and Licensor Group. Any award of the arbitrator(s) shall be final and binding on each of us, and may be entered as a judgment in any court of competent jurisdiction. Information may be obtained, and claims may be filed with the NAF at P.O. Box 50191, Minneapolis, MN 55405, or by email at , or by online filing at . +7. SUCCESSORS AND ASSIGNS +7.1 Successors and Assigns. You may not assign Your rights and duties under this Agreement to any party at any time. This Agreement will enure to the benefit of and will be binding on Us and our respective successors and permitted assigns. In the event of corporate merger, amalgamation, divestiture or asset sale, We will have the right to transfer and assign Our rights and obligations hereunder to any third party (the “Assignee”), upon written notice to You, provided that We cause the Assignee to agree in writing to all the terms contained in this Agreement. +8. UPGRADES +8.1 Upgrades. Other than our obligation under Section 2.4(b), We shall have no other obligations to provide updates or support services to You. Obligations or expectations with regard to product upgrades, enhancements, support or remedies for errors, defects or deficiencies will be limited to those expressly set forth in a separate agreement between Us and You. In the absence of such an agreement between Us and You, We will use reasonable efforts to provide ongoing support and remedies to identified errors and defects, on a time and material basis, at Our then current commercial rates. +9. CONFIDENTIALITY +9.1 Confidentiality. You acknowledge that the existence of this Agreement, the terms and conditions hereof, the transactions contemplated hereby and other information, including, without limitation, customer, technical and financial information that they have received or will receive in connection with this Agreement, is considered private and confidential (the “Confidential Information”). You will use reasonable diligence and in no event less than the degree of care which We use in respect to our own confidential and proprietary information of like nature, to prevent the unauthorized disclosure, reproduction or distribution of such Confidential Information to any other individual, corporation or entity. Such Confidential Information will exclude: +(a) information that is already in the public domain; +(b) information already known to the receiving party, as of the date of the disclosure, unless the receiving party agreed to keep such information in confidence at the time of its original receipt; +(c) information hereafter obtained by the receiving party, from a source not otherwise under an obligation of confidentiality with the disclosing party; +(d) information that the receiving party is obligated to produce under order of a court of competent jurisdiction, provided that the receiving party promptly notifies the disclosing party of such an event so that the disclosing party may seek an appropriate protective order. +10. TERM +10.1 Term. The term of this Agreement will commence on the date of Your agreement to these terms and shall continue for the same term as the Usage Agreement. +11. GENERAL +11.1 Consents. Any consent required under this Agreement will not be unreasonably withheld. +11.2 Captions. The Article and paragraph headings used herein are for convenience only and are not a part of this Agreement and will not be used in construing it. +11.3 Entire Agreement. This Agreement constitutes the entire agreement of the Parties, and no amendment to the terms of this Agreement will be effective unless in writing and signed by both parties hereto. +11.4 Equitable Relief. You agree that any breach of this Agreement by You would cause irreparable damage, and that, in event of such breach, in addition to any and all remedies at law, We will have the right to an injunction, specific performance or other equitable relief to prevent the continuous violations of the terms of this Agreement. +11.5 Force Majeure. Notwithstanding anything herein to the contrary, We shall not be liable for any delay or failure in performance caused by circumstances beyond Our reasonable control. +11.6 Relationship of the Parties. This Agreement does not constitute a partnership or joint venture, and nothing herein contained is intended to constitute, nor will it be construed to constitute, such a partnership or joint venture. Except as expressly provided in this Agreement, neither We nor You will have any power or authority to act in the name or on behalf of the other party, or to bind the other party to any legal agreement. +11.7 Severability. The provisions of this Agreement are to be considered separately, and if any provision hereof should be found by any court or competent jurisdiction to be invalid or unenforceable, this Agreement will be deemed to have effect as if such provision were severed from this Agreement. +11.8 Number and Gender. Where the context permits, the singular includes the plural, and the masculine includes the feminine and vice versa. +11.9 Notices. All notices and communications required or permitted under this Agreement will be in writing and will be sent by registered or certified mail, postage prepaid, return receipt requested, facsimile transmission (the “Fax”), with confirmed answer back, or electronic mail, with confirmation of receipt, to Us or You at the respective addresses we provide to each other or to such other address as We or You may from time to time specify by notice to the other given as provided in this paragraph. In Our case, Our address is: +First Canadian Place +#5700-100 King St. W +Tronto, ON M5X1C7 +(416) 915-4269 +info@marketcetera.com +A notice given in electronic form shall be admissible in judicial or administrative proceedings based upon or relating to this Agreement to the same extent and subject to the same conditions as other business documents and records originally generated and maintained in printed form. +11.10 JURISDICTION. THE PARTIES HEREBY IRREVOCABLY ATTORN TO THE EXCLUSIVE JURISDICTION OF THE COURTS OF THE PROVINCE OF ONTARIO WITH RESPECT TO ANY DISPUTE ARISING HEREUNDER. +11.11 GOVERNING LAW. THIS AGREEMENT AND ANY SALES THEREUNDER SHALL BE DEEMED TO HAVE BEEN MADE IN THE PROVINCE OF ONTARIO AND SHALL BE CONSTRUED AND INTERPRETED ACCORDING TO THE LAWS OF THE PROVINCE OF ONTARIO AND THE APPLICABLE LAWS OF CANADA. We and You expressly exclude the United Nations Convention on Contracts for the International Sale of Goods, and the International Sale of Goods Act (ONTARIO), as amended, replaced or re-enacted from time to time. +11.12 Revisions to this Agreement. We may at any time revise the terms of this Agreement by updating these terms and by providing notice to you of that change. + + + diff --git a/packages/dare-package/src/main/sample_data/server.install4j b/packages/dare-package/src/main/sample_data/server.install4j new file mode 100644 index 0000000000..76bc495076 --- /dev/null +++ b/packages/dare-package/src/main/sample_data/server.install4j @@ -0,0 +1,725 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sys.installationDir + + + context.getBooleanVariable("sys.confirmedUpdateInstallation") + + + + + + ${form:welcomeMessage} + + !context.isConsole() + + + + + + String message = context.getMessage("ConsoleWelcomeLabel", context.getApplicationName()); +return console.askOkCancel(message, true); + + + + + + + + updateCheck + + + + + ${i18n:ClickNext} + + + + + + + + + ${i18n:LicenseLabel3} + + + + + + + + en + + license/private-license.txt + + + + + + + + textSource + displayedText + displayedTextFile + variableName + acceptInitiallySelected + readAllRequired + + + + + + !context.getBooleanVariable("sys.confirmedUpdateInstallation") + + + + + sys.installationDir + + + context.getVariable("sys.responseFile") == null + + + + + + ${i18n:SelectDirLabel(${compiler:sys.fullName})} + + + + + + + + suggestAppDir + validateApplicationId + existingDirWarning + checkWritable + manualEntryAllowed + checkFreeSpace + showRequiredDiskSpace + showFreeDiskSpace + allowSpacesOnUnix + validationScript + standardValidation + + + + + + + + + ${i18n:SelectComponentsLabel2} + + !context.isConsole() + + + + + + + selectionChangedScript + + + + + + + Set up the database for the Marketcetera Automated Trading Platform + Database Setup + + + + + Marketcetera ships with the HSQLDB database, which is the default selection. For better performance and data security, choose a different database type from the dropdown list. + +To connect to a database, Marketcetera needs a JDBC driver for that database. Marketcetera ships with several JDBC drivers, but others must be downloaded and installed by the user due to license restrictions. These types are marked with '*'. Downloaded JDBC drivers must be installed in the lib directory. + +Choose the database type that your Marketcetera server will use. + + + + + + Select the entry for the database system you'd like Marketcetera to use. Entries marked with '*' require you to provide the necessary JDBC drivers. + Database Type + + HSQLDB + PostgresSQL + MySQL* + Oracle* + SQLServer* + Other + + databaseSource + + + + + + + Configure database connection settings + Database Setup + + context.setVariable("databaseUsername","metc"); +context.setVariable("databasePassword","pw4metc"); +switch((int)context.getVariable("databaseSource")) { + case 0: // hsqldb + context.setVariable("jdbcDriver","org.hsqldb.jdbc.JDBCDriver"); + if(Util.isWindows()) { + String localAppDir = (String)context.getVariable("sys.localAppdataDir"); + localAppDir = localAppDir.replaceAll("\\\\","/"); + context.setVariable("jdbcUrl","jdbc:hsqldb:file:"+localAppDir+"/Marketcetera/dare/data/metc"); + } else { + String installDir = (String)context.getVariable("sys.installationDir"); + context.setVariable("jdbcUrl","jdbc:hsqldb:file:dare/data/metc"); + } + context.setVariable("testQuery","CALL NOW()"); + context.setVariable("dialect","hsqldb"); + break; + case 1: // postgressql + context.setVariable("jdbcDriver","org.postgresql.Driver"); + context.setVariable("jdbcUrl","jdbc:postgresql://localhost/metc"); + context.setVariable("testQuery","select 1"); + context.setVariable("dialect","psql"); + break; + case 2: // mysql + context.setVariable("jdbcDriver","com.mysql.jdbc.Driver"); + context.setVariable("jdbcUrl","jdbc:mysql://localhost:3306/metc"); + context.setVariable("testQuery","select 1"); + context.setVariable("dialect","mysql"); + break; + case 3: // oracle + context.setVariable("jdbcDriver","oracle.jdbc.OracleDriver"); + context.setVariable("jdbcUrl","jdbc:oracle:thin:@hostName:port:SID"); + context.setVariable("testQuery","select 1 from dual"); + context.setVariable("dialect","oracle"); + break; + case 4: // sqlserver + context.setVariable("jdbcDriver","com.microsoft.sqlserver.jdbc.SQLServerDriver"); + context.setVariable("jdbcUrl","jdbc:sqlserver://hostName\\instanceName:portNumber"); + context.setVariable("testQuery","select 1"); + context.setVariable("dialect","sqlserver"); + break; + case 5: // other + context.setVariable("jdbcDriver",""); + context.setVariable("jdbcUrl",""); + context.setVariable("testQuery","select 1"); + context.setVariable("dialect",""); + break; + default: + throw new IllegalArgumentException("Unknown database type: " + context.getVariable("databaseSource")); +}; + + + + These settings tell Marketcetera how to connect to the database. + + + + + + + + Enter the JDBC URL to connect to your database + ${installer:jdbcUrl} + Database JDBC URL + jdbcUrl + + + + + + Enter the database username, if required + ${installer:databaseUsername} + Database Username + databaseUsername + + return (Integer)context.getVariable("databaseSource") != 0; + + + + + Enter the database password, if required + ${installer:databasePassword} + Database Password + databasePassword + + return (Integer)context.getVariable("databaseSource") != 0; + + + + + You typically won't need to change these settings + + + + + + + Enter the JDBC driver name. Make sure that the JDBC libraries, if any, are copied to ors/lib + ${installer:jdbcDriver} + Database JDBC Driver + jdbcDriver + + + + + + + Enter the Flyway migration dialect to use + ${installer:dialect} + Flyway Migration Dialect + dialect + + + + + + + + + + ${i18n:UninstallerMenuEntry(${compiler:sys.fullName})} + + !context.getBooleanVariable("sys.programGroupDisabled") + + + + ${compiler:sys.fullName} ${compiler:sys.version} + + + + + + + + setEnv.sh + + + + + dare/conf/application.properties + + + + + !Util.isWindows() + + + + + + + startServerComponents.sh + + + + + stopServerComponents.sh + + + + + setEnv.sh + + + + + dare/bin/dare.sh + + + + +x + + + + + + + ${i18n:WizardPreparing} + + + + + + + + + ${form:finishedMessage} + + + + + + + + + ${i18n:UninstallerMenuEntry(${compiler:sys.fullName})} + + + + + + + + + + + + + + + + ${form:welcomeMessage} + + !context.isConsole() + + + + + + String message = context.getMessage("ConfirmUninstall", context.getApplicationName()); +return console.askYesNo(message, true); + + + + + + + + + + + + + + + + logs + + + + + + + + + + + ${i18n:UninstallerPreparing} + + + + + + + + + + ${form:successMessage} + + + + + + + + + + + + + + + + + + + + + + + + + + + From d081e2837f8048bb3d4933a567efac06a7d8393b Mon Sep 17 00:00:00 2001 From: Colin DuPlantis Date: Tue, 23 May 2023 09:46:33 -0700 Subject: [PATCH 2/3] MATP-1188 Create Server Installer --- .../src/main/sample_data/bin/dare.sh | 34 +++++------ .../src/main/sample_data/bin/setEnv.sh | 12 +--- .../sample_data/bin/startServerComponents.sh | 5 +- .../sample_data/bin/stopServerComponents.sh | 10 +--- .../sample_data/conf/application.properties | 14 ++--- .../src/main/sample_data/server.install4j | 57 ++++++++++++------- 6 files changed, 63 insertions(+), 69 deletions(-) diff --git a/packages/dare-package/src/main/sample_data/bin/dare.sh b/packages/dare-package/src/main/sample_data/bin/dare.sh index 81132e36de..9b2ea5f544 100644 --- a/packages/dare-package/src/main/sample_data/bin/dare.sh +++ b/packages/dare-package/src/main/sample_data/bin/dare.sh @@ -11,7 +11,7 @@ trap app_stop EXIT INT TERM APPLICATION_DIR=dare -cd ${DARE_HOME} +cd "${DARE_HOME}" THE_CLASSPATH=./conf for file in `ls -1 ./lib/*.jar` @@ -22,7 +22,7 @@ done rm -f dare.pid # # Set this to the log directory defined in the logger config file -LOGDIR=${DARE_HOME}/logs +LOGDIR="${DARE_HOME}/logs" # Set this to the name of the stderr/stdout file you want to write for each instance LOGNAME=dareout # Set this to a relative directory to the cluster installation @@ -31,20 +31,18 @@ INSTANCE_DIR=instances # These port values are used for day-to-day work, just make sure they are unique and leave enough room for each instance # # DARE RPC port -RPC_PORT=13010 +RPC_PORT=9000 # Cluster port -CLUSTER_PORT=9800 +CLUSTER_PORT=9010 # # These values are typically the ones you'll need to change # # This port value is what web services connect to # DARE WS port -WS_PORT=13000 +WS_PORT=9020 # # This port value is what incoming FIX sessions would connect to the DARE instance -DARE_ACCEPTOR_PORT=13020 -# This port value is what incoming FIX sessions would connect to the EXSIM instance -EXSIM_ACCEPTOR_PORT=13030 +DARE_ACCEPTOR_PORT=9030 # # Set this to a comma-separated list of cluster hosts CLUSTER_TCPIP_MEMBERS=127.0.0.1 @@ -60,17 +58,17 @@ INSTANCE_XMS=4096m # Set this to the max heap size for each instance INSTANCE_XMX=4096m # -java -Xms384m -Xmx512m -Xloggc:${LOGDIR}/dare_gc.out -server -Dorg.marketcetera.appDir=${METC_HOME}/${APPLICATION_DIR}\ - -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods\ - -Dlog.configurationFile=${METC_HOME}/${APPLICATION_DIR}/conf/logback.xml\ +java -Xms384m -Xmx512m -Xlog:gc:"${LOGDIR}/dare_gc.out" -server -Dorg.marketcetera.appDir="${METC_HOME}/${APPLICATION_DIR}"\ + -XX:+UseParallelGC\ + -Dlog.configurationFile="${METC_HOME}/${APPLICATION_DIR}/conf/log4j2.xml"\ -cp "${THE_CLASSPATH}"\ - -Dorg.marketcetera.app=com.marketcetera.sixer.SixerApplication\ + -Dorg.marketcetera.app=org.marketcetera.server.DareApplication\ -Dmetc.cluster.tcpip.members=${CLUSTER_TCPIP_MEMBERS}\ - -Dmetc.logdir=${LOGDIR}\ + -Dmetc.logdir="${LOGDIR}"\ -Dmetc.logname=${LOGNAME}\ -Dmetc.total.instances=${TOTAL_INSTANCES}\ -Dmetc.instance.spring.config.location=conf/application.properties\ - -Dmetc.instance.log.configurationFile=conf/logback.xml\ + -Dmetc.instance.log.configurationFile=conf/log4j2.xml\ -Dmetc.instance.Xms${INSTANCE_XMS}\ -Dmetc.instance.Xmx${INSTANCE_XMX}\ -Dmetc.start.delay=${INSTANCE_START_DELAY}\ @@ -78,15 +76,9 @@ java -Xms384m -Xmx512m -Xloggc:${LOGDIR}/dare_gc.out -server -Dorg.marketcetera. -Dmetc.port.server.port=${WS_PORT}\ -Dmetc.port.metc.cluster.port=${CLUSTER_PORT}\ -Dmetc.port.metc.dare.acceptor.port=${DARE_ACCEPTOR_PORT}\ - -Dmetc.port.metc.exsim.acceptor.port=${EXSIM_ACCEPTOR_PORT}\ -Dorg.marketcetera.instanceDir=${INSTANCE_DIR}\ - -Dmetc.instance.ALL.LOG.LEVEL=${ALL_LOG_LEVEL}\ - -Dmetc.instance.METC.LOGBACK.APPENDERS=${METC_LOGBACK_APPENDERS}\ - -Dmetc.instance.METC.LOG.LEVEL=${METC_LOG_LEVEL}\ -Dmetc.instance.XX:+UseParallelGC\ - -Dmetc.instance.XX:+AggressiveOpts\ - -Dmetc.instance.XX:+UseFastAccessorMethods\ - -Dmetc.instance.Xloggc:${LOGDIR}/dare_gc.out\ + -Dmetc.instance.Xlog:gc:"${LOGDIR}/dare_gc.out"\ -Dmetc.instance=0\ org.marketcetera.core.MultiInstanceApplicationContainer $* & retval=$? diff --git a/packages/dare-package/src/main/sample_data/bin/setEnv.sh b/packages/dare-package/src/main/sample_data/bin/setEnv.sh index e9573d7756..4014ac2b06 100644 --- a/packages/dare-package/src/main/sample_data/bin/setEnv.sh +++ b/packages/dare-package/src/main/sample_data/bin/setEnv.sh @@ -17,14 +17,8 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -export METC_HOME="/opt/Marketcetera" -export DATA_HOME="/opt/Marketcetera" +export METC_HOME="${installer:sys.installationDir}" +export DATA_HOME="${installer:sys.installationDir}" export DARE_HOME=${METC_HOME}/dare -export EXSIM_HOME=${METC_HOME}/exsim -export PHOTON_HOME=${METC_HOME}/photon -export SE_HOME=${METC_HOME}/strategyengine -export UI_HOME=${METC_HOME}/ui -export UBUNTU_MENUPROXY=0 -export PATH=${METC_HOME}/jdk1.8.0_261/bin:${DARE_HOME}/bin:${EXSIM_HOME}/bin:${PHOTON_HOME}/:${SE_HOME}/bin:${PATH} -export LD_LIBRARY_PATH=${SE_HOME}/modules/lib:${LD_LIBRARY_PATH} +export PATH=${DARE_HOME}/bin:${PATH} diff --git a/packages/dare-package/src/main/sample_data/bin/startServerComponents.sh b/packages/dare-package/src/main/sample_data/bin/startServerComponents.sh index b4a2a6054f..e138aa425c 100644 --- a/packages/dare-package/src/main/sample_data/bin/startServerComponents.sh +++ b/packages/dare-package/src/main/sample_data/bin/startServerComponents.sh @@ -13,8 +13,5 @@ . "$(dirname $0)/setEnv.sh" -cd ${DARE_HOME} +cd "${DARE_HOME}" ./bin/dare.sh - -#cd ${UI_HOME} -#./bin/ui.sh > /dev/null 2>&1 diff --git a/packages/dare-package/src/main/sample_data/bin/stopServerComponents.sh b/packages/dare-package/src/main/sample_data/bin/stopServerComponents.sh index c7cf323601..7aaedc3d39 100644 --- a/packages/dare-package/src/main/sample_data/bin/stopServerComponents.sh +++ b/packages/dare-package/src/main/sample_data/bin/stopServerComponents.sh @@ -13,18 +13,10 @@ . "$(dirname $0)/setEnv.sh" -cd ${DARE_HOME} +cd "${DARE_HOME}" if [ -f dare.pid ] then kill `cat dare.pid` else pkill -f java fi - -#cd ${UI_HOME} -#if [ -f ui.pid ] -#then -# kill `cat ui.pid` -#else -# pkill -f java -#fi diff --git a/packages/dare-package/src/main/sample_data/conf/application.properties b/packages/dare-package/src/main/sample_data/conf/application.properties index b1b8b90ff2..1e450586d9 100644 --- a/packages/dare-package/src/main/sample_data/conf/application.properties +++ b/packages/dare-package/src/main/sample_data/conf/application.properties @@ -23,11 +23,11 @@ metc.fix.session.creation.delay=10000 # # Database Settings # -spring.datasource.url=${metc.jdbc.url} -spring.datasource.username=${metc.jdbc.user} -spring.datasource.password=${metc.jdbc.password} -spring.datasource.driver-class-name=${metc.jdbc.driver} -spring.flyway.locations=db/migration/${metc.flyway.vendor} +spring.datasource.url=${installer:jdbcUrl} +spring.datasource.username=${installer:databaseUsername} +spring.datasource.password=${installer:databasePassword} +spring.datasource.driver-class-name=${installer:jdbcDriver} +spring.flyway.locations=db/migration/${installer:flywayVendor} # # Security Settings # @@ -91,7 +91,7 @@ fix.session-descriptors[0].sessions[0].host=exchange.marketcetera.com fix.session-descriptors[0].sessions[0].port=7001 fix.session-descriptors[0].sessions[0].enabled=true fix.session-descriptors[0].sessions[0].settings.BeginString=FIXT.1.1 -fix.session-descriptors[0].sessions[0].settings.SenderCompID=MATP-colin2 +fix.session-descriptors[0].sessions[0].settings.SenderCompID=${installer:senderCompId} fix.session-descriptors[0].sessions[0].settings.TargetCompID=MRKTC-EXCH fix.session-descriptors[0].sessions[0].settings.AppDataDictionary=FIX50SP2.xml fix.session-descriptors[0].sessions[0].settings.TransportDataDictionary=FIXT11.xml @@ -157,7 +157,7 @@ metc.persistent.execution.report.aliases={ \ # # Exsim Market Data Adapter Configuration # -metc.marketdata.exsim.senderCompId=unique-sendercompid +metc.marketdata.exsim.senderCompId=mda-${installer:senderCompId} # target comp id value to use metc.marketdata.exsim.targetCompId=MRKTC-EXCH # hostname to connect to diff --git a/packages/dare-package/src/main/sample_data/server.install4j b/packages/dare-package/src/main/sample_data/server.install4j index 76bc495076..5923ae97ff 100644 --- a/packages/dare-package/src/main/sample_data/server.install4j +++ b/packages/dare-package/src/main/sample_data/server.install4j @@ -1,7 +1,7 @@ - + @@ -226,40 +226,34 @@ switch((int)context.getVariable("databaseSource")) { context.setVariable("jdbcUrl","jdbc:hsqldb:file:"+localAppDir+"/Marketcetera/dare/data/metc"); } else { String installDir = (String)context.getVariable("sys.installationDir"); - context.setVariable("jdbcUrl","jdbc:hsqldb:file:dare/data/metc"); + context.setVariable("jdbcUrl","jdbc:hsqldb:file:data/metc"); } - context.setVariable("testQuery","CALL NOW()"); - context.setVariable("dialect","hsqldb"); + context.setVariable("flywayVendor","hsqldb"); break; case 1: // postgressql context.setVariable("jdbcDriver","org.postgresql.Driver"); context.setVariable("jdbcUrl","jdbc:postgresql://localhost/metc"); - context.setVariable("testQuery","select 1"); - context.setVariable("dialect","psql"); + context.setVariable("flywayVendor","psql"); break; case 2: // mysql context.setVariable("jdbcDriver","com.mysql.jdbc.Driver"); context.setVariable("jdbcUrl","jdbc:mysql://localhost:3306/metc"); - context.setVariable("testQuery","select 1"); - context.setVariable("dialect","mysql"); + context.setVariable("flywayVendor","mysql"); break; case 3: // oracle context.setVariable("jdbcDriver","oracle.jdbc.OracleDriver"); context.setVariable("jdbcUrl","jdbc:oracle:thin:@hostName:port:SID"); - context.setVariable("testQuery","select 1 from dual"); - context.setVariable("dialect","oracle"); + context.setVariable("flywayVendor","oracle"); break; case 4: // sqlserver context.setVariable("jdbcDriver","com.microsoft.sqlserver.jdbc.SQLServerDriver"); context.setVariable("jdbcUrl","jdbc:sqlserver://hostName\\instanceName:portNumber"); - context.setVariable("testQuery","select 1"); - context.setVariable("dialect","sqlserver"); + context.setVariable("flywayVendor","sqlserver"); break; case 5: // other context.setVariable("jdbcDriver",""); context.setVariable("jdbcUrl",""); - context.setVariable("testQuery","select 1"); - context.setVariable("dialect",""); + context.setVariable("flywayVendor",""); break; default: throw new IllegalArgumentException("Unknown database type: " + context.getVariable("databaseSource")); @@ -322,9 +316,33 @@ switch((int)context.getVariable("databaseSource")) { Enter the Flyway migration dialect to use - ${installer:dialect} - Flyway Migration Dialect - dialect + ${installer:flywayVendor} + Flyway Migration Vendor + flywayVendor + + + + + + + Configure exchange connection settings + Exchange Setup + + + + + These settings tell Marketcetera how to connect to the Marketcetera Exchange Simulator. + + + + + + + + Uniquely identifies this installation to the Exchange + ${installer:sys.userName}-sender-comp-id + Sender Comp ID + senderCompId @@ -357,6 +375,7 @@ switch((int)context.getVariable("databaseSource")) { + !Util.isWindows() @@ -450,7 +469,7 @@ return console.askYesNo(message, true); - logs + dare @@ -719,7 +738,7 @@ return console.askYesNo(message, true); - + From 5366bf681d97f1f6b5c6d4a891027756c03d3194 Mon Sep 17 00:00:00 2001 From: Colin DuPlantis Date: Tue, 23 May 2023 09:52:23 -0700 Subject: [PATCH 3/3] MATP-1188 Create Server Installer --- .../src/main/sample_data/contrib/archive.sh | 74 ---------- .../src/main/sample_data/contrib/archive.sql | 137 ------------------ .../main/sample_data/contrib/crontab.root.txt | 26 ---- .../src/main/sample_data/contrib/crontab.txt | 24 --- .../src/main/sample_data/contrib/install.sh | 46 ------ .../src/main/sample_data/contrib/rollback.sh | 108 -------------- 6 files changed, 415 deletions(-) delete mode 100644 packages/dare-package/src/main/sample_data/contrib/archive.sh delete mode 100644 packages/dare-package/src/main/sample_data/contrib/archive.sql delete mode 100644 packages/dare-package/src/main/sample_data/contrib/crontab.root.txt delete mode 100644 packages/dare-package/src/main/sample_data/contrib/crontab.txt delete mode 100644 packages/dare-package/src/main/sample_data/contrib/install.sh delete mode 100644 packages/dare-package/src/main/sample_data/contrib/rollback.sh diff --git a/packages/dare-package/src/main/sample_data/contrib/archive.sh b/packages/dare-package/src/main/sample_data/contrib/archive.sh deleted file mode 100644 index 881f4c5243..0000000000 --- a/packages/dare-package/src/main/sample_data/contrib/archive.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -set -e - -installdir=/opt/Marketcetera -dare_contrib_dir=${installdir}/dare/contrib -archivedir="${installdir}/archive" -timestamp="`date +%Y%m%d-%H%M%S%Z`" -dumpfilename="${archivedir}/archive-${timestamp}.sql" -archivesql="${dare_contrib_dir}/archive.sql" -errorfilename="/tmp/archive-${timestamp}_error.txt" -statusfilename="/tmp/archive-${timestamp}_status.txt" -hostname=sxr-global-postgres.internal.sxr.io -user=postgres -psqldump=/usr/bin/pg_dump -psql=/usr/bin/psql -gzip=/bin/gzip -service=/usr/sbin/service -err_mailing_list=colin@marketcetera.com -status_mailing_list=colin@marketcetera.com -crontab=/usr/bin/crontab -sudo=/usr/bin/sudo -signal_file=/tmp/exchange-shutdown -export PGPASSWORD="tird2hirm.taik-LAD" - -function err_report() { - echo "Error on line $1" >> ${errorfilename} - dos2unix -o ${errorfilename} > /dev/null 2>&1 - mail -s "Daily Start/Stop/Archive Error" ${err_mailing_list} < ${errorfilename} - rm -f ${errorfilename} -} - -function clean_up { - ${sudo} ${service} dare start >> ${statusfilename} 2>> ${errorfilename} - echo "DARE restarted at `date`" >> ${statusfilename} 2>> ${errorfilename} - dos2unix -o ${statusfilename} > /dev/null 2>&1 - mail -s "Daily Start/Stop/Archive `hostname` Status" ${status_mailing_list} < ${statusfilename} - rm -f ${statusfilename} - exit -} - -function wait_to_restart { - while [ ! -f "${signal_file}" ]; do - seconds=`echo $(($(date -f - +%s- <<< $'today 20:10\nnow')0))` - if [ "$seconds" -lt "1" ]; then - echo "Must restart now" >> ${statusfilename} 2>> ${errorfilename} - break - fi - sleep 1 - done - echo "Beginning DARE archive at `date`" >> ${statusfilename} 2>> ${errorfilename} -} - -if [ -e ${installdir}/no_restart ]; -then - exit -fi - -trap 'err_report $LINENO' ERR -trap clean_up EXIT SIGHUP SIGINT SIGTERM - -touch ${statusfilename} -touch ${errorfilename} - -wait_to_restart - -${sudo} ${service} dare stop >> ${statusfilename} 2>> ${errorfilename} -echo "DARE stopped at `date`" >> ${statusfilename} 2>> ${errorfilename} - -cd ${dare_contrib_dir} - -mkdir -p ${archivedir} >> ${statusfilename} 2>> ${errorfilename} -time ${psql} -h ${hostname} -U ${user} postgres < ${archivesql} -echo "Archive complete at `date`" >> ${statusfilename} 2>> ${errorfilename} diff --git a/packages/dare-package/src/main/sample_data/contrib/archive.sql b/packages/dare-package/src/main/sample_data/contrib/archive.sql deleted file mode 100644 index 549e744be1..0000000000 --- a/packages/dare-package/src/main/sample_data/contrib/archive.sql +++ /dev/null @@ -1,137 +0,0 @@ -begin; --- -select now() as archive_start; ---- ---- save ids of open orders ---- -drop table if exists tmp_ids; -select clord_id,current_message_id into tmp_ids from exchange_open_orders; ---- ---- remove non-open order records ---- -delete from exchange_closed_orders; -delete from exchange_trade_details where buy_order_id not in (select clord_id from tmp_ids) and sell_order_id not in (select clord_id from tmp_ids); -delete from exec_reports where order_id not in (select clord_id from tmp_ids); -delete from order_status where order_id not in (select clord_id from tmp_ids); -delete from reports where id not in (select report_id from exec_reports); -delete from outgoing_messages where order_id not in (select clord_id from tmp_ids); -delete from fix_messages where id not in (select current_message_id from tmp_ids) and id not in (select fix_message_id from reports) and id not in (select fix_message_id from outgoing_messages); --- --- sixer tables --- --- --- sixer_current_position negative position check --- -select count(*) from sixer_current_positions where position < 0; --- --- cleanup --- -drop table if exists tmp_ids; --- -select clock_timestamp() as archive_end; --- -commit; --- -select clock_timestamp() as va_start; -VACUUM ANALYZE exchange_closed_orders; -VACUUM ANALYZE exchange_marketdata_content; -VACUUM ANALYZE exchange_marketdata_exchanges; -VACUUM ANALYZE exchange_marketdata_instruments; -VACUUM ANALYZE exchange_marketdata_requests; -VACUUM ANALYZE exchange_open_orders; -VACUUM ANALYZE exchange_orderbook_stats; -VACUUM ANALYZE exchange_orderbooks; -VACUUM ANALYZE exchange_trade_details; -VACUUM ANALYZE exchanges; -VACUUM ANALYZE exec_reports; -VACUUM ANALYZE fix_messages; -VACUUM ANALYZE fix_session_attr_dscrptrs; -VACUUM ANALYZE fix_session_attributes; -VACUUM ANALYZE fix_sessions; -VACUUM ANALYZE flyway_schema_history; -VACUUM ANALYZE handled_messages; -VACUUM ANALYZE id_repository; -VACUUM ANALYZE incoming_fix_messages; -VACUUM ANALYZE message_store_messages; -VACUUM ANALYZE message_store_sessions; -VACUUM ANALYZE order_status; -VACUUM ANALYZE outgoing_messages; -VACUUM ANALYZE permissions; -VACUUM ANALYZE reports; -VACUUM ANALYZE roles; -VACUUM ANALYZE roles_permissions; -VACUUM ANALYZE roles_users; -VACUUM ANALYZE sixer_current_positions; -VACUUM ANALYZE sixer_events; -VACUUM ANALYZE sixer_lots; -VACUUM ANALYZE sixer_managed_orders; -VACUUM ANALYZE sixer_marketdata; -VACUUM ANALYZE sixer_marketdata_elements; -VACUUM ANALYZE sixer_order_status; -VACUUM ANALYZE sixer_placed_orders; -VACUUM ANALYZE sixer_pnl; -VACUUM ANALYZE sixer_positions; -VACUUM ANALYZE sixer_trades; -VACUUM ANALYZE sixer_user_trades; -VACUUM ANALYZE sixer_users; -VACUUM ANALYZE supervisor_permissions; -VACUUM ANALYZE supervisor_permissions_permissions; -VACUUM ANALYZE supervisor_permissions_users; -VACUUM ANALYZE user_attributes; -VACUUM ANALYZE users; -select clock_timestamp() as va_end; --- -reindex table exchange_closed_orders; -reindex table exchange_marketdata_content; -reindex table exchange_marketdata_exchanges; -reindex table exchange_marketdata_instruments; -reindex table exchange_marketdata_requests; -reindex table exchange_open_orders; -reindex table exchange_orderbook_stats; -reindex table exchange_orderbooks; -reindex table exchange_trade_details; -reindex table exchanges; -reindex table exec_reports; -reindex table fix_messages; -reindex table fix_session_attr_dscrptrs; -reindex table fix_session_attributes; -reindex table fix_sessions; -reindex table flyway_schema_history; -reindex table handled_messages; -reindex table id_repository; -reindex table incoming_fix_messages; -reindex table message_store_messages; -reindex table message_store_sessions; -reindex table order_status; -reindex table outgoing_messages; -reindex table permissions; -reindex table reports; -reindex table roles; -reindex table roles_permissions; -reindex table roles_users; -reindex table sixer_allocations; -reindex table sixer_contract_definitions; -reindex table sixer_contract_extensions; -reindex table sixer_contracts; -reindex table sixer_current_positions; -reindex table sixer_events; -reindex table sixer_game_players; -reindex table sixer_games; -reindex table sixer_lots; -reindex table sixer_managed_orders; -reindex table sixer_marketdata; -reindex table sixer_marketdata_elements; -reindex table sixer_order_status; -reindex table sixer_placed_orders; -reindex table sixer_pnl; -reindex table sixer_positions; -reindex table sixer_trades; -reindex table sixer_user_trades; -reindex table sixer_users; -reindex table supervisor_permissions; -reindex table supervisor_permissions_permissions; -reindex table supervisor_permissions_users; -reindex table user_attributes; -reindex table users; --- -select clock_timestamp() as reindex_end; diff --git a/packages/dare-package/src/main/sample_data/contrib/crontab.root.txt b/packages/dare-package/src/main/sample_data/contrib/crontab.root.txt deleted file mode 100644 index 36d1b6ef9b..0000000000 --- a/packages/dare-package/src/main/sample_data/contrib/crontab.root.txt +++ /dev/null @@ -1,26 +0,0 @@ -MAILTO=colin@marketcetera.com -# Edit this file to introduce tasks to be run by cron. -# -# Each task to run has to be defined through a single line -# indicating with different fields when the task will be run -# and what command to run for the task -# -# To define the time you can provide concrete values for -# minute (m), hour (h), day of month (dom), month (mon), -# and day of week (dow) or use '*' in these fields (for 'any').# -# Notice that tasks will be started based on the cron's system -# daemon's notion of time and timezones. -# -# Output of the crontab jobs (including errors) is sent through -# email to the user the crontab file belongs to (unless redirected). -# -# For example, you can run a backup of all your user accounts -# at 5 a.m every week with: -# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ -# -# For more information see the manual pages of crontab(5) and cron(8) -# -# m h dom mon dow command -# Clear cached RAM every hour -0 0 * * * /bin/sync; echo 3 > /proc/sys/vm/drop_caches -45 0 * * * /usr/sbin/service haproxy restart diff --git a/packages/dare-package/src/main/sample_data/contrib/crontab.txt b/packages/dare-package/src/main/sample_data/contrib/crontab.txt deleted file mode 100644 index 4d76db94fc..0000000000 --- a/packages/dare-package/src/main/sample_data/contrib/crontab.txt +++ /dev/null @@ -1,24 +0,0 @@ -MAILTO=colin@marketcetera.com -# Edit this file to introduce tasks to be run by cron. -# -# Each task to run has to be defined through a single line -# indicating with different fields when the task will be run -# and what command to run for the task -# -# To define the time you can provide concrete values for -# minute (m), hour (h), day of month (dom), month (mon), -# and day of week (dow) or use '*' in these fields (for 'any').# -# Notice that tasks will be started based on the cron's system -# daemon's notion of time and timezones. -# -# Output of the crontab jobs (including errors) is sent through -# email to the user the crontab file belongs to (unless redirected). -# -# For example, you can run a backup of all your user accounts -# at 5 a.m every week with: -# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ -# -# For more information see the manual pages of crontab(5) and cron(8) -# -# m h dom mon dow command -15 22 * * WED /bin/bash /opt/Marketcetera/dare/contrib/archive.sh diff --git a/packages/dare-package/src/main/sample_data/contrib/install.sh b/packages/dare-package/src/main/sample_data/contrib/install.sh deleted file mode 100644 index 20dde963bc..0000000000 --- a/packages/dare-package/src/main/sample_data/contrib/install.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -. "$(dirname $0)/../../setEnv.sh" - -CURRENT_VERSION=${1} -BACKUP_DIR=${METC_HOME}/backup - -usage() -{ - echo "Usage: install.sh " -} - -pushd ${METC_HOME} - -if [ "${CURRENT_VERSION}" != "" ]; then - echo "Backing up version ${CURRENT_VERSION}" -else - usage - exit 1 -fi - -# validate current version -find . -name 'sixer-core-${CURRENT_VERSION}.jar' > /dev/null 2>&1 || (echo "Cannot verify ${CURRENT_VERSION}";exit 2) -echo "Confirmed current version ${CURRENT_VERSION}" - -# backup existing -echo "Backing up ${CURRENT_VERSION}" -BACKUP_FILE="${BACKUP_DIR}/backup-${CURRENT_VERSION}.tar.bz2" -mkdir -p ${BACKUP_DIR} -tar jcvf ${BACKUP_FILE} dare/bin dare/conf dare/contrib dare/lib ui/bin ui/lib ui/conf - -# remove current version libs -echo "Removing current version JARs" -find . -name "*-${CURRENT_VERSION}.jar" -exec rm -f {} \; -rm dare/bin/* dare/conf/* dare/lib/* ui/bin/* ui/lib/* ui/conf/* - -# install packages -echo "Installing new packages" -cd ${METC_HOME}/.. -tar jxvf /home/ubuntu/packages/sixer-server-package.tar.bz2 -tar jxvf /home/ubuntu/packages/sixer-ui-package.tar.bz2 - -chmod +x ${METC_HOME}/dare/contrib/install.sh - -echo "New version installed" -popd diff --git a/packages/dare-package/src/main/sample_data/contrib/rollback.sh b/packages/dare-package/src/main/sample_data/contrib/rollback.sh deleted file mode 100644 index a6e306c7de..0000000000 --- a/packages/dare-package/src/main/sample_data/contrib/rollback.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash - -. "$(dirname $0)/../../setEnv.sh" - -service=/usr/sbin/service -tar=/bin/tar -rm=/bin/rm -backupdir=${METC_HOME}/backup - -function finish { - popd - echo - echo "====================================" - echo "Rollback database now (if necessary)" - echo "====================================" - echo - read -n 1 -s -r -p "Press any key to continue" - echo - echo "===========================" - echo "Starting Marketcetera stack" - echo "===========================" - echo - sudo service dare start -} - -# stop system -echo -echo "===========================" -echo "Stopping Marketcetera stack" -echo "===========================" -echo - -sudo service dare stop - -pushd ${METC_HOME} - -trap finish EXIT - -# provide choice of rollback options - -i=0 -for version in `ls ${backupdir}| grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'` -do - options[$i]=${version} - ((i++)) -done -options[$i]="Quit" -echo -PS3='Please enter your choice for version to rollback to: ' -select opt in "${options[@]}" -do - if [ "${opt}" == "Quit" ]; then - echo - echo "************************" - echo "Quitting with no changes" - echo "************************" - echo - exit 2 - fi - if [ "${opt}" == "" ]; then - echo - echo "**************" - echo "Invalid option" - echo "**************" - echo - else - echo - echo "======================" - echo "Rolling back to ${opt}" - echo "======================" - echo - break - fi -done - -cd ${METC_HOME} -backupfile="${backupdir}/backup-${opt}.tar.bz2" -if [ -f "${backupfile}" ]; then - echo - echo "======================" - echo "Verified ${backupfile}" - echo "======================" - echo -else - echo - echo "***************************************************************" - echo "Cannot roll back to ${opt} because ${backupfile} does not exist" - echo "***************************************************************" - echo - exit 3 -fi -echo -echo "==================================" -echo "Removing current version artifacts" -echo "==================================" -echo -${rm} -rf dare/bin dare/conf dare/contrib dare/lib ui/bin ui/lib ui/conf -echo -echo "=====================================" -echo "Installing previous version artifacts" -echo "=====================================" -echo -${tar} jxvf ${backupfile} -echo -echo "=====================" -echo "Rolled back to ${opt}" -echo "=====================" -echo