Skip to content

Commit 3ec7a6d

Browse files
author
root
committed
add Dockerfile, circleci
1 parent 8a7a75f commit 3ec7a6d

File tree

3 files changed

+106
-2
lines changed

3 files changed

+106
-2
lines changed

.circleci/config.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
version: 2
2+
defaults: &defaults
3+
docker:
4+
- image: docker:17.06.1-ce-git
5+
install_dependency: &install_dependency
6+
name: Installation of build and deployment dependencies.
7+
command: |
8+
apk update
9+
apk add --no-cache bash curl
10+
apk upgrade
11+
apk add --no-cache jq py-pip sudo
12+
sudo pip install awscli --upgrade
13+
install_deploysuite: &install_deploysuite
14+
name: Installation of install_deploysuite.
15+
#Git Clone -change back to v1.3 or latest once counter var is generalized.
16+
command: |
17+
git clone --branch master https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
18+
cp ./../buildscript/master_deploy.sh .
19+
cp ./../buildscript/buildenv.sh .
20+
cp ./../buildscript/awsconfiguration.sh .
21+
22+
restore_cache_settings_for_build: &restore_cache_settings_for_build
23+
key: docker-pg-ifx-notify-{{ checksum "package-lock.json" }}
24+
25+
save_cache_settings: &save_cache_settings
26+
key: docker-pg-ifx-notifyy-{{ checksum "package-lock.json" }}
27+
paths:
28+
- node_modules
29+
30+
run_build: &run_build
31+
name: Build of Docker image
32+
command: ./build.sh
33+
34+
build_steps: &build_steps
35+
- checkout
36+
- setup_remote_docker
37+
- run: *install_dependency
38+
- run: *install_deploysuite
39+
- restore_cache: *restore_cache_settings_for_build
40+
- run: docker build -t postgres-ifx-processor:${DEPLOY_ENV}.${CIRCLE_BUILD_NUM} .
41+
- save_cache: *save_cache_settings
42+
- deploy:
43+
name: Running MasterScript.
44+
command: |
45+
./awsconfiguration.sh ${DEPLOY_ENV}
46+
source awsenvconf
47+
./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar
48+
source buildenvvar
49+
./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer
50+
51+
echo "Running Masterscript - deploy postgres-ifx-processer producer"
52+
if [ -e ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar.json ]; then sudo rm -vf ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar.json; fi
53+
./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-producer-deployvar
54+
source buildenvvar
55+
./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer
56+
57+
jobs:
58+
# Build & Deploy against development backend
59+
"build-dev":
60+
<<: *defaults
61+
environment:
62+
DEPLOY_ENV: "DEV"
63+
LOGICAL_ENV: "DEV"
64+
GLOBAL_ENV: "dev"
65+
APP_NAME: "postgres-ifx-processer"
66+
steps: *build_steps
67+
# Build & Deploy against production backend
68+
"build-prod":
69+
<<: *defaults
70+
environment:
71+
DEPLOY_ENV: "PROD"
72+
LOGICAL_ENV: "PROD"
73+
GLOBAL_ENV: "prod"
74+
APP_NAME: "postgres-ifx-processer"
75+
steps: *build_steps
76+
workflows:
77+
version: 2
78+
build:
79+
jobs:
80+
# Development builds are executed on "develop" branch only.
81+
- "build-dev":
82+
context : org-global
83+
filters:
84+
branches:
85+
only:
86+
- dev
87+
- "build-prod":
88+
context : org-global
89+
filters:
90+
branches:
91+
only:
92+
- master
93+

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
FROM node:8.2.1
3+
LABEL app="pg-ifx-notify" version="1.0"
4+
5+
WORKDIR /opt/app
6+
COPY . .
7+
8+
RUN npm install
9+
RUN npm install dotenv --save
10+
ENTRYPOINT ["/bin/bash" , "-c", "source ./env_producer.sh && printenv"]
11+
#ENTRYPOINT ["npm","run"]

config/default.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ module.exports = {
2929
KAFKA: { // Kafka connection options
3030
brokers_url: process.env.KAFKA_URL || 'localhost:9092', // comma delimited list of initial brokers list
3131
SSL: {
32-
cert: process.env.KAFKA_SSL_CERT || null, // SSL client certificate file path
33-
key: process.env.KAFKA_SSL_KEY || null // SSL client key file path
32+
cert: process.env.KAFKA_CLIENT_CERT || null, // SSL client certificate file path
33+
key: process.env.KAFKA_CLIENT_CERT_KEY || null // SSL client key file path
3434
},
3535
topic: process.env.KAFKA_TOPIC || 'db.postgres.sync', // Kafka topic to push and receive messages
3636
partition: process.env.partition || [0] // Kafka partitions to use

0 commit comments

Comments
 (0)