Skip to content

Dev test pg #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4f99473
Merge pull request #10 from topcoder-platform/dev
nkumar-topcoder May 11, 2020
33aa805
[skip ci]
nkumar-topcoder May 11, 2020
4c18ed5
[skip ci]
nkumar-topcoder May 11, 2020
a9366a4
[skip ci]
nkumar-topcoder May 11, 2020
7ae6d17
[skip ci]
nkumar-topcoder May 11, 2020
0b3329e
[skip ci]
nkumar-topcoder May 11, 2020
740f95c
Update config.yml
nkumar-topcoder May 11, 2020
6370ba2
Update config.yml
nkumar-topcoder May 11, 2020
cd70a6a
Update config.yml
nkumar-topcoder May 11, 2020
dbd8866
[skip ci]
nkumar-topcoder May 12, 2020
042130c
[skip ci]
nkumar-topcoder May 12, 2020
0f24ce1
Update updateInformix.js
nkumar-topcoder May 12, 2020
1a3ddca
[skip ci]
nkumar-topcoder May 13, 2020
00fa3d0
[skip ci]
nkumar-topcoder May 13, 2020
d9cd73a
Update config.yml
nkumar-topcoder May 13, 2020
8e815f6
Update consumer.js
nkumar-topcoder May 13, 2020
58714b3
group consumer changes
May 15, 2020
3e67379
Merge pull request #11 from topcoder-platform/feature/group-consumer
nkumar-topcoder May 15, 2020
4bc2794
Update consumer.js
May 15, 2020
81e41e3
Update consumer.js
nkumar-topcoder May 17, 2020
9d3d037
Update consumer.js
nkumar-topcoder May 17, 2020
46f8759
Update consumer.js
nkumar-topcoder May 17, 2020
dcfd1d4
[skip ci]
nkumar-topcoder May 20, 2020
5901e72
Update default.js
nkumar-topcoder May 20, 2020
8d61d45
[skip ci]
nkumar-topcoder May 20, 2020
1611bfc
[skip ci]
nkumar-topcoder May 22, 2020
69adfde
[skip ci]
nkumar-topcoder May 22, 2020
84d2584
Update default.js
nkumar-topcoder May 22, 2020
1f5b9ba
[skip ci]
nkumar-topcoder May 22, 2020
ec29f73
Update default.js
nkumar-topcoder May 22, 2020
d0d9e8e
bit clean-up
May 22, 2020
67bcea7
[skip ci]
nkumar-topcoder May 24, 2020
f417122
Update updateInformix.js
nkumar-topcoder May 24, 2020
ae345bb
[skip ci]
nkumar-topcoder May 27, 2020
6df7af9
[skip ci]
nkumar-topcoder May 27, 2020
7261158
Update default.js
nkumar-topcoder May 27, 2020
3ba0197
Update consumer.js
nkumar-topcoder May 27, 2020
8ca9470
[skip ci]
nkumar-topcoder May 28, 2020
c81266a
Update default.js
nkumar-topcoder May 28, 2020
495e3c4
[skip ci]
nkumar-topcoder Jun 1, 2020
131bbda
[skip ci]
nkumar-topcoder Jun 1, 2020
cd444e4
[skip ci]
nkumar-topcoder Jun 1, 2020
07cbe00
Update config.yml
nkumar-topcoder Jun 1, 2020
4e94214
[skip ci]
nkumar-topcoder Jun 4, 2020
c37fe28
[skip ci]
nkumar-topcoder Jun 4, 2020
61e990d
pg pool verify
nkumar-topcoder Jun 4, 2020
3995bc4
Update config.yml
nkumar-topcoder Jun 4, 2020
9e160e8
[skip ci]
nkumar-topcoder Jun 6, 2020
85e47f1
[skip ci]
nkumar-topcoder Jun 6, 2020
fa505be
[skip ci]
nkumar-topcoder Jun 8, 2020
2e0d694
[skip ci]
nkumar-topcoder Jun 8, 2020
3ac7fee
[skip ci]
nkumar-topcoder Jun 8, 2020
3801c9f
Update updateInformix.js
nkumar-topcoder Jun 8, 2020
7f419c8
Update config.yml
nkumar-topcoder Jun 8, 2020
b8600d2
Update consumer.js
nkumar-topcoder Jun 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 30 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ defaults: &defaults
install_dependency: &install_dependency
name: Installation of build and deployment dependencies.
command: |
sudo apt-get update
sudo apt install jq
sudo pip install awscli --upgrade
sudo pip install docker-compose
sudo apt-get install default-jdk
sudo apt-get install default-jdk --fix-missing
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
#Git Clone -change back to v1.3 or latest once counter var is generalized.
Expand Down Expand Up @@ -39,30 +40,42 @@ build_steps: &build_steps
- deploy:
name: Running MasterScript.
command: |

./awsconfiguration.sh ${DEPLOY_ENV}
source awsenvconf

# ./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar
#scorecard test consumer remove later
#./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-consumer_scorecard-deployvar
#source buildenvvar
#./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer

echo "Running Masterscript - deploy postgres-ifx-processer producer"
if [ -e ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar.json ]; then sudo rm -vf ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar.json; fi
./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-producer-deployvar
#scorecard test producer remove later
#echo "Running Masterscript - deploy postgres-ifx-processer producer"
#if [ -e ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar.json ]; then sudo rm -vf ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar.json; fi
#./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-producer_scorecard-deployvar
#source buildenvvar
#./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer

./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar
source buildenvvar
./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer

#echo "Running Masterscript - deploy postgres-ifx-processer producer"
#if [ -e ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar.json ]; then sudo rm -vf ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar.json; fi
#./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-producer-deployvar
#source buildenvvar
#./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer

echo "Running Masterscript - deploy postgres-ifx-processer producer_dd"
if [ -e ${LOGICAL_ENV}-${APP_NAME}-producer-deployvar.json ]; then sudo rm -vf ${LOGICAL_ENV}-${APP_NAME}-producer-deployvar.json; fi
./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-producer_dd-deployvar
source buildenvvar
./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer

#echo "Running Masterscript - deploy postgres-ifx-processer reconsiler1"
#if [ -e ${LOGICAL_ENV}-${APP_NAME}-reconsiler1-deployvar.json ]; then sudo rm -vf ${LOGICAL_ENV}-${APP_NAME}-reconsiler1-deployvar.json; fi
#./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-reconsiler1-deployvar
#echo "Running Masterscript - deploy postgres-ifx-processer producer_dd"
#if [ -e ${LOGICAL_ENV}-${APP_NAME}-producer-deployvar.json ]; then sudo rm -vf ${LOGICAL_ENV}-${APP_NAME}-producer-deployvar.json; fi
#./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-producer_dd-deployvar
#source buildenvvar
#./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer

echo "Running Masterscript - deploy postgres-ifx-processer reconsiler1"
if [ -e ${LOGICAL_ENV}-${APP_NAME}-reconsiler1-deployvar.json ]; then sudo rm -vf ${LOGICAL_ENV}-${APP_NAME}-reconsiler1-deployvar.json; fi
./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-reconsiler1-deployvar
source buildenvvar
./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer

jobs:
# Build & Deploy against development backend #
Expand Down Expand Up @@ -103,13 +116,12 @@ workflows:
branches:
only:
- dev
- dev-retryfeature
- "build-test":
context : org-global
filters:
branches:
only:
- dev-test-pg
only:
- dev-test-pg
- dev-test-pg-rf
- "build-prod":
context : org-global
Expand Down
40 changes: 22 additions & 18 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ module.exports = {
database: process.env.PG_DATABASE || 'postgres', // database must exist before running the tool
password: process.env.PG_PASSWORD || 'password',
port: parseInt(process.env.PG_PORT, 10) || 5432,
triggerFunctions: process.env.TRIGGER_FUNCTIONS || ['dev_db_notifications'], // List of trigger functions to listen to
triggerTopics: process.env.TRIGGER_TOPICS || ['dev.db.postgres.sync'], // Names of the topic in the trigger payload
triggerFunctions: process.env.TRIGGER_FUNCTIONS || ['test_db_notifications'], // List of trigger functions to listen to
triggerTopics: process.env.TRIGGER_TOPICS || ['test.db.postgres.sync'], // Names of the topic in the trigger payload
triggerOriginators: process.env.TRIGGER_ORIGINATORS || ['tc-postgres-delta-processor'] // Names of the originator in the trigger payload
},
KAFKA: { // Kafka connection options
Expand All @@ -34,32 +34,36 @@ module.exports = {
},
topic: process.env.KAFKA_TOPIC || 'db.topic.sync', // Kafka topic to push and receive messages
partition: process.env.partition || [0], // Kafka partitions to use
maxRetry: process.env.MAX_RETRY || 3,
maxRetry: process.env.MAX_RETRY || 10,
errorTopic: process.env.ERROR_TOPIC || 'db.scorecardtable.error',
recipients: ['[email protected]'] // Kafka partitions to use
recipients: ['[email protected]'], // Kafka partitions to use,
KAFKA_URL: process.env.KAFKA_URL,
KAFKA_GROUP_ID: process.env.KAFKA_GROUP_ID || 'test-postgres-ifx-consumer',
KAFKA_CLIENT_CERT: process.env.KAFKA_CLIENT_CERT ? process.env.KAFKA_CLIENT_CERT.replace('\\n', '\n') : null,
KAFKA_CLIENT_CERT_KEY: process.env.KAFKA_CLIENT_CERT_KEY ? process.env.KAFKA_CLIENT_CERT_KEY.replace('\\n', '\n') : null,
},
SLACK: {
URL: process.env.SLACKURL || 'us-east-1',
SLACKCHANNEL: process.env.SLACKCHANNEL || 'ifxpg-migrator',
SLACKNOTIFY: process.env.SLACKNOTIFY || 'false'
SLACKNOTIFY: process.env.SLACKNOTIFY || 'false'
},
RECONSILER:{
RECONSILER: {
RECONSILER_START: process.env.RECONSILER_START || 5,
RECONSILER_END: process.env.RECONSILER_END || 1,
RECONSILER_DURATION_TYPE: process.env.RECONSILER_DURATION_TYPE || 'm'
},
DYNAMODB:
{
DYNAMODB_TABLE: process.env.DYNAMODB_TABLE || 'dev_pg_ifx_payload_sync',
DD_ElapsedTime: process.env.DD_ElapsedTime || 600000
},
{
DYNAMODB_TABLE: process.env.DYNAMODB_TABLE || 'test_pg_ifx_payload_sync',
DD_ElapsedTime: process.env.DD_ElapsedTime || 600000
},

AUTH0_URL: process.env.AUTH0_URL ,
AUTH0_AUDIENCE: process.env.AUTH0_AUDIENCE ,
TOKEN_CACHE_TIME: process.env.TOKEN_CACHE_TIME ,
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID ,
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET ,
BUSAPI_URL : process.env.BUSAPI_URL ,
KAFKA_ERROR_TOPIC : process.env.KAFKA_ERROR_TOPIC ,
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL
AUTH0_URL: process.env.AUTH0_URL,
AUTH0_AUDIENCE: process.env.AUTH0_AUDIENCE,
TOKEN_CACHE_TIME: process.env.TOKEN_CACHE_TIME,
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
BUSAPI_URL: process.env.BUSAPI_URL,
KAFKA_ERROR_TOPIC: process.env.KAFKA_ERROR_TOPIC,
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL
}
131 changes: 121 additions & 10 deletions informix-identity-trigger-proc.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
database common_oltp

DROP PROCEDURE proc_user_update(varchar,decimal);
DROP PROCEDURE proc_user_update;
CREATE PROCEDURE informix.proc_user_update(
new_handle varchar(50),
user_id decimal(10,0))
if (USER != 'ifxsyncuser') then
UPDATE user SET handle_lower = lower(new_handle), modify_date = current WHERE user.user_id = user_id;
End if;
end procedure;
end procedure;

DROP PROCEDURE proc_user_update;
create procedure "informix".proc_user_update(
user_id DECIMAL(10,0),
old_first_name VARCHAR(64),
Expand All @@ -25,7 +27,7 @@ new_middle_name VARCHAR(64),
old_timezone_id decimal(5,0),
new_timezone_id decimal(5,0)
)

if (USER != 'ifxsyncuser') then
if ((old_first_name != new_first_name) or (old_last_name != new_last_name ) or (old_middle_name != new_middle_name )) then
insert into audit_user (column_name, old_value, new_value,
user_id)
Expand Down Expand Up @@ -57,7 +59,7 @@ user_id)
user_id)
values ('TIMEZONE_ID', old_timezone_id, new_timezone_id, user_id);
End If;
if (USER != 'ifxsyncuser') then

UPDATE user SET handle_lower = lower(new_handle), modify_date = current WHERE user.user_id = user_id;
End if;
end procedure;
Expand All @@ -75,7 +77,7 @@ new_primary_ind DECIMAL(1,0),
old_status_id DECIMAL(3,0),
new_status_id DECIMAL(3,0)
)

if (USER != 'ifxsyncuser') then
if (old_email_type_id != new_email_type_id) then
insert into audit_user (column_name, old_value, new_value, user_id)
values ('EMAIL_TYPE', old_email_type_id, new_email_type_id, user_id);
Expand All @@ -95,12 +97,122 @@ new_status_id DECIMAL(3,0)
insert into audit_user (column_name, old_value, new_value, user_id)
values ('EMAIL_PRIMARY_IND', old_primary_ind, new_primary_ind, user_id);
End If;
if (USER != 'ifxsyncuser') then

update email set modify_date = current where email.email_id = email_id;
End if;
end procedure;

DROP PROCEDURE informix.proc_user_last_login;
CREATE PROCEDURE informix.proc_user_last_login (user_id DECIMAL(10,0), o_last_login DATETIME YEAR TO FRACTION,
n_last_login DATETIME YEAR TO FRACTION)

if (o_last_login != n_last_login) then
if (USER != 'ifxsyncuser') then
insert into corona_event (corona_event_type_id,user_id, corona_event_timestamp) values (1, user_id, n_last_login);
end if;
End if;
end procedure;

DROP PROCEDURE informix.proc_phone_update;
CREATE PROCEDURE informix.proc_phone_update(
phone_id decimal(10,0),
user_id DECIMAL(10,0),
old_phone_type_id DECIMAL(5,0),
new_phone_type_id DECIMAL(5,0),
old_number VARCHAR(64),
new_number VARCHAR(64),
old_primary_ind DECIMAL(1,0),
new_primary_ind DECIMAL(1,0)
)
if (USER != 'ifxsyncuser') then
if (old_phone_type_id != new_phone_type_id) then
insert into audit_user (column_name, old_value, new_value, user_id)
values ('PHONE_TYPE', old_phone_type_id, new_phone_type_id, user_id);
End If;

if (old_number != new_number) then
insert into audit_user (column_name, old_value, new_value, user_id)
values ('PHONE_NUMBER', old_number, new_number, user_id);
End If;

if (old_primary_ind != new_primary_ind) then
insert into audit_user (column_name, old_value, new_value, user_id)
values ('PHONE_PRIMARY_IND', old_primary_ind, new_primary_ind, user_id);
End If;
update phone set modify_date = current where phone.phone_id = phone_id;
End if;
end procedure;

DROP PROCEDURE informix.proc_address_update;
CREATE PROCEDURE informix.proc_address_update(
address_id DECIMAL(10,0),
old_address_type_id DECIMAL(5,0),
new_address_type_id DECIMAL(5,0),
old_address1 VARCHAR(254),
new_address1 VARCHAR(254),
old_address2 VARCHAR(254),
new_address2 VARCHAR(254),
old_address3 VARCHAR(254),
new_address3 VARCHAR(254),
old_city VARCHAR(64),
new_city VARCHAR(64),
old_state_code CHAR(2),
new_state_code CHAR(2),
old_province VARCHAR(64),
new_province VARCHAR(64),
old_zip VARCHAR(15),
new_zip VARCHAR(15),
old_country_code CHAR(3),
new_country_code CHAR(3)
)
define user_id DECIMAL(10,0);
let user_id = NVL((select min(x.user_id) from user_address_xref x where x.address_id = address_id), -1);
if (USER != 'ifxsyncuser') then
if (user_id > 0 and old_address1 != new_address1) then
insert into audit_user (column_name, old_value, new_value,
user_id)
values ('ADDRESS1', old_address1, new_address1, user_id);
End If;
if (user_id > 0 and old_address2 != new_address2) then
insert into audit_user (column_name, old_value, new_value,
user_id)
values ('ADDRESS2', old_address2, new_address2, user_id);
End If;
if (user_id > 0 and old_address3 != new_address3) then
insert into audit_user (column_name, old_value, new_value,
user_id)
values ('ADDRESS3', old_address3, new_address3, user_id);
End If;
if (user_id > 0 and old_city != new_city) then
insert into audit_user (column_name, old_value, new_value,
user_id)
values ('ADDRESS_CITY', old_city, new_city, user_id);
End If;
if (user_id > 0 and old_state_code != new_state_code) then
insert into audit_user (column_name, old_value, new_value,
user_id)
values ('ADDRESS_STATE', old_state_code, new_state_code, user_id);
End If;
if (user_id > 0 and old_province != new_province) then
insert into audit_user (column_name, old_value, new_value,
user_id)
values ('ADDRESS_PROVINCE', old_province, new_province, user_id);
End If;
if (user_id > 0 and old_zip != new_zip) then
insert into audit_user (column_name, old_value, new_value,
user_id)
values ('ADDRESS_ZIP', old_zip, new_zip, user_id);
End If;
if (user_id > 0 and old_country_code != new_country_code) then
insert into audit_user (column_name, old_value, new_value,
user_id)
values ('ADDRESS_COUNTRY', old_country_code, new_country_code, user_id);
End If;

update address set modify_date = current where address.address_id = address_id;
End if;
end procedure;

database informixoltp
DROP PROCEDURE informix.proc_coder_update;
CREATE PROCEDURE informix.proc_coder_update(
Expand All @@ -110,7 +222,8 @@ v_oldlanguage_id decimal(3,0), v_newlanguage_id decimal(3,0),
v_oldcoder_type_id decimal(3,0), v_newcoder_type_id decimal(3,0),
v_oldcomp_country_code varchar(3), v_newcomp_country_code varchar(3)
)

if (USER != 'ifxsyncuser') then

if (v_oldquote != v_newquote) then
insert into audit_coder (column_name, old_value, new_value, user_id)
values ('QUOTE', v_oldquote , v_newquote, v_oldcoder_id);
Expand All @@ -131,10 +244,8 @@ v_oldcomp_country_code varchar(3), v_newcomp_country_code varchar(3)
values ('COMP_COUNTRY', v_oldcomp_country_code , v_newcomp_country_code, v_oldcoder_id);
End if;

if (USER != 'ifxsyncuser') then
update coder set modify_date = current where coder_id = v_oldcoder_id;
End if;

end procedure;

database tcs_catalog;
Expand All @@ -155,7 +266,7 @@ new_rating decimal(5,4)
update user_reliability set modify_date = current where user_id = p_user_id and phase_id = p_phase_id;
End if;
end procedure;

DROP PROCEDURE proc_rating_update;
CREATE PROCEDURE informix.proc_rating_update(
p_user_id DECIMAL(10,0),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"aws-sdk": "*",
"config": "^3.2.2",
"informix-wrapper": "git+https://github.com/appirio-tech/informix-wrapper.git",
"informix-wrapper": "git+https://github.com/appirio-tech/informix-wrapper.git#prepare_stmt_fix",
"no-kafka": "^3.4.3",
"pg": "^7.12.1",
"sleep": "^6.1.0",
Expand Down
Loading