Skip to content

Commit 79d637c

Browse files
Merge pull request #1 from topcoder-platform/dev
merge into master from dev
2 parents c6d37f9 + 128c9e3 commit 79d637c

38 files changed

+4822
-466
lines changed

.circleci/config.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
version: 2
2+
defaults: &defaults
3+
docker:
4+
- image: circleci/python:2.7-stretch-browsers
5+
install_dependency: &install_dependency
6+
name: Installation of build and deployment dependencies.
7+
command: |
8+
sudo apt install jq
9+
sudo pip install awscli --upgrade
10+
sudo pip install docker-compose
11+
install_deploysuite: &install_deploysuite
12+
name: Installation of install_deploysuite.
13+
command: |
14+
git clone --branch v1.4.2 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
15+
cp ./../buildscript/master_deploy.sh .
16+
cp ./../buildscript/buildenv.sh .
17+
cp ./../buildscript/awsconfiguration.sh .
18+
restore_cache_settings_for_build: &restore_cache_settings_for_build
19+
key: docker-node-modules-{{ checksum "package-lock.json" }}
20+
21+
save_cache_settings: &save_cache_settings
22+
key: docker-node-modules-{{ checksum "package-lock.json" }}
23+
paths:
24+
- node_modules
25+
26+
builddeploy_steps: &builddeploy_steps
27+
- checkout
28+
- setup_remote_docker
29+
- run: *install_dependency
30+
- run: *install_deploysuite
31+
- restore_cache: *restore_cache_settings_for_build
32+
- run: ./build.sh ${APPNAME}
33+
- save_cache: *save_cache_settings
34+
- deploy:
35+
name: Running MasterScript.
36+
command: |
37+
./awsconfiguration.sh $DEPLOY_ENV
38+
source awsenvconf
39+
# # producer deployment
40+
# ./unsetenv.sh
41+
# ./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-producer-deployvar
42+
# source buildenvvar
43+
# ./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
44+
# # notify deployment
45+
# rm -rf buildenvvar
46+
# # ./unsetenv.sh
47+
# ./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-notify-deployvar
48+
# source buildenvvar
49+
# ./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-notify-appvar -i ${APPNAME}
50+
# # consumer deployment
51+
# rm -rf buildenvvar
52+
# ./unsetenv.sh
53+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-consumer-deployvar
54+
source buildenvvar
55+
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
56+
# # without kafka dynamodb
57+
# rm -rf buildenvvar
58+
# ./unsetenv.sh
59+
# ./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-withoutkafka-deployvar
60+
# source buildenvvar
61+
# ./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-${APPNAME}-withoutkafka-appvar -i ${APPNAME}
62+
# # reconciler deployment
63+
# rm -rf buildenvvar
64+
# # ./unsetenv.sh
65+
# ./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-reconciler-deployvar
66+
# source buildenvvar
67+
# ./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
68+
69+
70+
jobs:
71+
# Build & Deploy against development backend
72+
"build-dev":
73+
<<: *defaults
74+
environment:
75+
DEPLOY_ENV: "DEV"
76+
LOGICAL_ENV: "dev"
77+
APPNAME: "ifxpg-nodeserver"
78+
steps: *builddeploy_steps
79+
80+
"build-prod":
81+
<<: *defaults
82+
environment:
83+
DEPLOY_ENV: "PROD"
84+
LOGICAL_ENV: "prod"
85+
APPNAME: "ifxpg-nodeserver"
86+
steps: *builddeploy_steps
87+
88+
workflows:
89+
version: 2
90+
build:
91+
jobs:
92+
# Development builds are executed on "develop" branch only.
93+
- "build-dev":
94+
context : org-global
95+
filters:
96+
branches:
97+
only:
98+
- dev
99+
100+
# Production builds are exectuted only on tagged commits to the
101+
# master branch.
102+
- "build-prod":
103+
context : org-global
104+
filters:
105+
branches:
106+
only: master

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ ENV LICENSE accept
3737
RUN rm /usr/bin/python && ln -s /usr/bin/python2.7 /usr/bin/python
3838
RUN echo "sqlexec 2021/tcp" >> /etc/services
3939

40-
RUN mkdir /app
41-
COPY . /app
40+
RUN mkdir /ifxpg-nodeserver
41+
COPY . /ifxpg-nodeserver
4242

43-
WORKDIR /app
43+
WORKDIR /ifxpg-nodeserver
4444
RUN rm -rf node_modules && npm install --unsafe-perm
4545

4646
# ENTRYPOINT [ "/bin/bash" ]
47-
ENTRYPOINT [ "npm" ]
47+
ENTRYPOINT [ "npm","run" ]

build.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
APP_NAME=$1
4+
UPDATE_CACHE=""
5+
#docker-compose -f docker/docker-compose.yml build $APP_NAME
6+
docker build -t $APP_NAME:latest .
7+
docker create --name app $APP_NAME:latest
8+
9+
if [ -d node_modules ]
10+
then
11+
mv package-lock.json old-package-lock.json
12+
docker cp app:/$APP_NAME/package-lock.json package-lock.json
13+
set +eo pipefail
14+
UPDATE_CACHE=$(cmp package-lock.json old-package-lock.json)
15+
set -eo pipefail
16+
else
17+
UPDATE_CACHE=1
18+
fi
19+
20+
if [ "$UPDATE_CACHE" == 1 ]
21+
then
22+
docker cp app:/$APP_NAME/node_modules .
23+
fi

config/default.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88
PARTITION: 0
99
},
1010
RETRY_COUNTER: 3,
11+
KAFKA_REPOST_COUNT: 5,
1112
topic_error: {
1213
NAME: 'db.ifxpgmigrate.error',
1314
PARTITION: 0,
@@ -41,5 +42,29 @@ module.exports = {
4142
USER: process.env.IFX_USER || 'informix',
4243
PASSWORD: process.env.IFX_PASSWORD || '1nf0rm1x',
4344
POOL_MAX_SIZE: parseInt(process.env.IFX_POOL_MAX_SIZE || '10')
45+
},
46+
DYNAMODB: {
47+
REGION: process.env.AWS_REGION || 'us-east-1',
48+
TABLENAME: process.env.DYNAMODB_TABLENAME || 'ifxpg-migrator'
49+
},
50+
SLACK: {
51+
URL: process.env.SLACKURL || 'us-east-1',
52+
SLACKCHANNEL: process.env.SLACKCHANNEL || 'ifxpg-migrator',
53+
SLACKNOTIFY: process.env.SLACKNOTIFY || 'false'
54+
},
55+
EXEMPTIONDATATYPE : {
56+
MONEY: {
57+
testdb_testtable5 : 'dmoney'
58+
}
59+
},
60+
RECONCILER :
61+
{
62+
RECONCILER_ELAPSE_TIME : 600000,
63+
RECONCILER_IGNORE_STATUS : 'PostgresUpdated',
64+
RECONCILER_START_ELAPSE_TIME : 1,
65+
RECONCILER_DIFF_PERIOD : 10,
66+
RECONCILER_DURATION_TYPE : 'm',
67+
RECONCILER_RETRY_COUNT : 1,
68+
RECONCILER_POST_URL : 'http://ifxpg-migrator.topcoder-dev.com/kafkaevents'
4469
}
4570
}

informix_auditing/UNIX.mak

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# TARGET must be set to the location/filename
3030
# of the platform-specific make include file.
3131

32-
TARGET=$(INFORMIXDIR)/incl/dbdk/makeinc.linux86_64
32+
TARGET=$(INFORMIXDIR)/incl/dbdk/makeinc.linux
3333
include $(TARGET)
3434
# ===============================================================
3535
# This is the project title.
@@ -39,12 +39,12 @@ BINDIR = $(OS_NAME)-$(PLATFORM)
3939

4040
# Platform independent code goes here.
4141
# The following code was generated by BladeSmith.
42-
42+
LDFLAGS = -m32
4343
LCURL = -lcurl
4444
MI_INCL = $(INFORMIXDIR)/incl
4545
COPTS=-O -DMI_SERVBUILD -DMITRACE_OFF=1
46-
CFLAGS =$(COPTS) $(CC_PIC) -I$(MI_INCL)/public -I$(MI_INCL)
47-
PTCFLAGS =$(LCURL) $(COPTS) $(CC_PIC) -I$(MI_INCL)/public -I$(MI_INCL)
46+
CFLAGS =$(LDFLAGS) $(COPTS) $(CC_PIC) -I$(MI_INCL)/public -I$(MI_INCL)
47+
PTCFLAGS =$(LDFLAGS) $(LCURL) $(COPTS) $(CC_PIC) -I$(MI_INCL)/public -I$(MI_INCL)
4848
LINKFLAGS = $(SHLIBLFLAG) $(SYMFLAG)
4949
LIBS =
5050

@@ -89,7 +89,7 @@ RecordAudit.jar: RecordAudit.class
8989
# Misspelled symbol names will not be resolved here or at load time.
9090
#
9191
$(PROJECT_LIBS) : $(PROJECT_OBJS)
92-
$(SHLIBLOD) $(LCURL) $(LINKFLAGS) -o $(PROJECT_LIBS) \
92+
$(SHLIBLOD) $(LDFLAGS) $(LCURL) $(LINKFLAGS) -o $(PROJECT_LIBS) \
9393
$(PROJECT_OBJS) $(LIBS) $(DATABLADE_LIBS) 2> link.errs
9494

9595
server: $(PROJECT_LIBS)

informix_auditing/UNIX_x64.mak

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# (c) Copyright IBM Corp. 2004 All rights reserved. */
2+
# */
3+
# This sample program is owned by International Business Machines */
4+
# Corporation or one of its subsidiaries ("IBM") and is copyrighted */
5+
# and licensed, not sold. */
6+
# */
7+
# You may copy, modify, and distribute this sample program in any */
8+
# form without payment to IBM, for any purpose including developing,*/
9+
# using, marketing or distributing programs that include or are */
10+
# derivative works of the sample program. */
11+
# */
12+
# The sample program is provided to you on an "AS IS" basis, without */
13+
# warranty of any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL */
14+
# WARRANTIES EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO*/
15+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTIC-*/
16+
# ULAR PURPOSE. Some jurisdictions do not allow for the exclusion or */
17+
# limitation of implied warranties, so the above limitations or */
18+
# exclusions may not apply to you. IBM shall not be liable for any */
19+
# damages you suffer as a result of using, modifying or distributing */
20+
# the sample program or its derivatives. */
21+
# */
22+
# Each copy of any portion of this sample program or any derivative */
23+
# work, must include a the above copyright notice and disclaimer of */
24+
# warranty. */
25+
# */
26+
# ********************************************************************/
27+
28+
# This Makefile builds the logger libraries
29+
# TARGET must be set to the location/filename
30+
# of the platform-specific make include file.
31+
32+
TARGET=$(INFORMIXDIR)/incl/dbdk/makeinc.linux86_64
33+
include $(TARGET)
34+
# ===============================================================
35+
# This is the project title.
36+
PROJECT_TITLE = auditing
37+
38+
BINDIR = $(OS_NAME)-$(PLATFORM)
39+
40+
# Platform independent code goes here.
41+
# The following code was generated by BladeSmith.
42+
43+
LCURL = -lcurl
44+
MI_INCL = $(INFORMIXDIR)/incl
45+
COPTS=-O -DMI_SERVBUILD -DMITRACE_OFF=1
46+
CFLAGS =$(COPTS) $(CC_PIC) -I$(MI_INCL)/public -I$(MI_INCL)
47+
PTCFLAGS =$(LCURL) $(COPTS) $(CC_PIC) -I$(MI_INCL)/public -I$(MI_INCL)
48+
LINKFLAGS = $(SHLIBLFLAG) $(SYMFLAG)
49+
LIBS =
50+
51+
PROJECT_OBJS= $(BINDIR)/auditing1.$(OBJSUFF) $(BINDIR)/auditing2.$(OBJSUFF) $(BINDIR)/auditing3.$(OBJSUFF) $(BINDIR)/audit_util.$(OBJSUFF)
52+
53+
PROJECT_LIBS=$(BINDIR)/$(PROJECT_TITLE).$(BLDLIB_SUFF)
54+
55+
all: $(BINDIR) RecordAudit.jar
56+
$(MAKE) $(MAKEFLAGS) -f UNIX.mak server
57+
58+
# Construct the object file.
59+
60+
$(BINDIR)/auditing1.$(OBJSUFF) : auditing1.c
61+
$(CC) $(CFLAGS) -o $@ -c $?
62+
63+
$(BINDIR)/auditing2.$(OBJSUFF) : auditing2.c
64+
$(CC) $(PTCFLAGS) -o $@ -c $?
65+
66+
$(BINDIR)/auditing3.$(OBJSUFF) : auditing3.c
67+
$(CC) $(CFLAGS) -o $@ -c $?
68+
69+
$(BINDIR)/audit_util.$(OBJSUFF) : audit_util.c
70+
$(CC) $(PTCFLAGS) -o $@ -c $?
71+
72+
RecordAudit.class: RecordAudit.java
73+
javac RecordAudit.java
74+
75+
RecordAudit.jar: RecordAudit.class
76+
jar cf RecordAudit.jar RecordAudit.class
77+
78+
# Construct the shared library.
79+
# Do *NOT* link with client side libraries.
80+
# You will see many undefined symbols during linking. This is
81+
# normal since those symbols are resolved when the server loads
82+
# your shared object.
83+
#
84+
# ATTENTION:
85+
# The ld "Symbol referencing errors" warning is normal.
86+
# These unresolved symbols are resolved when the server
87+
# loads the shared object. This list should be examined, however,
88+
# for symbol names that may have been inadvertently misspelled.
89+
# Misspelled symbol names will not be resolved here or at load time.
90+
#
91+
$(PROJECT_LIBS) : $(PROJECT_OBJS)
92+
$(SHLIBLOD) $(LCURL) $(LINKFLAGS) -o $(PROJECT_LIBS) \
93+
$(PROJECT_OBJS) $(LIBS) $(DATABLADE_LIBS) 2> link.errs
94+
95+
server: $(PROJECT_LIBS)
96+
97+
clean:
98+
$(RM) $(RMFLAGS) $(PROJECT_LIBS) $(PROJECT_OBJS) RecordAudit.class RecordAudit.jar
99+
100+
$(BINDIR):
101+
-mkdir $(BINDIR)
102+
103+
INSTALL:
104+
cp $(BINDIR)/$(PROJECT_TITLE).bld $(INFORMIXDIR)/extend/auditing/$(PROJECT_TITLE).bld
105+
cp RecordAudit.jar $(INFORMIXDIR)/extend/auditing/RecordAudit.jar

0 commit comments

Comments
 (0)