Skip to content

Commit 0bedbfc

Browse files
author
vikasrohit
authored
Merge pull request #92 from topcoder-platform/dev
Prod - M2M and other changes
2 parents 01ac6b4 + 0685320 commit 0bedbfc

22 files changed

+508
-249
lines changed

.circleci/config.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
version: 2
2+
jobs:
3+
test:
4+
docker:
5+
- image: circleci/node:8.9.4
6+
- image: circleci/postgres:9.6.2-alpine
7+
environment:
8+
- POSTGRES_USER: circle_test
9+
- POSTGRES_DB: circle_test
10+
- image: elasticsearch:2.3
11+
environment:
12+
DB_MASTER_URL: postgres://circle_test:@127.0.0.1:5432/circle_test
13+
AUTH_SECRET: secret
14+
AUTH_DOMAIN: topcoder-dev.com
15+
LOG_LEVEL: debug
16+
APP_VERSION: v4
17+
steps:
18+
- checkout
19+
- restore_cache:
20+
key: test-node-modules-{{ checksum "package.json" }}
21+
- run: npm install
22+
- save_cache:
23+
key: test-node-modules-{{ checksum "package.json" }}
24+
paths:
25+
- node_modules
26+
- run: npm run lint
27+
- run: npm run test
28+
- run: npm run build
29+
- persist_to_workspace:
30+
root: .
31+
paths:
32+
- dist
33+
deployDev:
34+
docker:
35+
- image: docker:17.06.1-ce-git
36+
steps:
37+
- checkout
38+
- setup_remote_docker
39+
- run:
40+
name: Installation of build dependencies.
41+
command: apk add --no-cache bash
42+
- attach_workspace:
43+
at: ./workspace
44+
- run:
45+
name: Installing AWS client
46+
command: |
47+
apk add --no-cache jq py-pip sudo
48+
sudo pip install awscli --upgrade
49+
- run: ./build.sh DEV
50+
- run: ./deploy.sh DEV
51+
deployProd:
52+
docker:
53+
- image: docker:17.06.1-ce-git
54+
steps:
55+
- checkout
56+
- setup_remote_docker
57+
- run:
58+
name: Installation of build dependencies.
59+
command: apk add --no-cache bash
60+
- attach_workspace:
61+
at: ./workspace
62+
- run:
63+
name: Installing AWS client
64+
command: |
65+
apk add --no-cache jq py-pip sudo
66+
sudo pip install awscli --upgrade
67+
- run: ./build.sh PROD
68+
- run: ./deploy.sh PROD
69+
workflows:
70+
version: 2
71+
build:
72+
jobs:
73+
- test
74+
- deployDev:
75+
requires:
76+
- test
77+
filters:
78+
branches:
79+
only: 'dev'
80+
- deployProd:
81+
requires:
82+
- test
83+
filters:
84+
branches:
85+
only: 'master'

.ebextensions/01-environment-variables.config

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ option_settings:
3232
- namespace: aws:elasticbeanstalk:application:environment
3333
option_name: DIRECT_PROJECT_SERVICE_ENDPOINT
3434
value: TBD
35-
- namespace: aws:elasticbeanstalk:application:environment
36-
option_name: TOPIC_SERVICE_ENDPOINT
37-
value: TBD
3835
- namespace: aws:elasticbeanstalk:application:environment
3936
option_name: FILE_SERVICE_ENDPOINT
4037
value: TBD
@@ -53,27 +50,6 @@ option_settings:
5350
- namespace: aws:elasticbeanstalk:application:environment
5451
option_name: AWS_SECRET_ACCESS_KEY
5552
value: TBD
56-
- namespace: aws:elasticbeanstalk:application:environment
57-
option_name: SALESFORCE_WEB_TO_LEAD_URL
58-
value: https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8
59-
- namespace: aws:elasticbeanstalk:application:environment
60-
option_name: SALESFORCE_ORG_ID
61-
value: TBD
62-
- namespace: aws:elasticbeanstalk:application:environment
63-
option_name: SALESFORCE_LEAD_PROJECT_NAME
64-
value: TBD
65-
- namespace: aws:elasticbeanstalk:application:environment
66-
option_name: SALESFORCE_LEAD_PROJECT_DESC
67-
value: TBD
68-
- namespace: aws:elasticbeanstalk:application:environment
69-
option_name: SALESFORCE_LEAD_PROJECT_LINK
70-
value: TBD
71-
- namespace: aws:elasticbeanstalk:application:environment
72-
option_name: SALESFORCE_LEAD_PROJECT_ID
73-
value: TBD
7453
- namespace: aws:elasticbeanstalk:application:environment
7554
option_name: CONNECT_PROJECTS_URL
7655
value: TBD
77-
- namespace: aws:elasticbeanstalk:application:environment
78-
option_name: USER_SERVICE_URL
79-
value: TBD

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM node:6.9.4
2-
LABEL version="1.0"
1+
FROM node:8.2.1
2+
LABEL version="1.2"
33
LABEL description="Projects microservice"
44

55
RUN apt-get update && \

build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
# more bash-friendly output for jq
4+
JQ="jq --raw-output --exit-status"
5+
6+
ENV=$1
7+
AWS_REGION=$(eval "echo \$${ENV}_AWS_REGION")
8+
ACCOUNT_ID=$(eval "echo \$${ENV}_AWS_ACCOUNT_ID")
9+
AWS_REPOSITORY=$(eval "echo \$${ENV}_AWS_REPOSITORY")
10+
11+
build() {
12+
docker build -t $ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_REPOSITORY:$CIRCLE_SHA1 .
13+
}
14+
15+
build

circle.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"authSecret": "AUTH_SECRET",
2+
"apiVersion": "API_VERSION",
3+
"AUTH_SECRET": "AUTH_SECRET",
34
"logLevel": "LOG_LEVEL",
45
"version": "APP_VERSION",
56
"captureLogs": "CAPTURE_LOGS",
@@ -17,28 +18,22 @@
1718
"directProjectServiceTimeout": "DIRECT_PROJECT_SERVICE_TIMEOUt",
1819
"fileServiceEndpoint": "FILE_SERVICE_ENDPOINT",
1920
"identityServiceEndpoint": "IDENTITY_SERVICE_ENDPOINT",
20-
"topicServiceEndpoint": "TOPIC_SERVICE_ENDPOINT",
2121
"memberServiceEndpoint": "MEMBER_SERVICE_ENDPOINT",
2222
"systemUserClientId": "SYSTEM_USER_CLIENT_ID",
2323
"systemUserClientSecret": "SYSTEM_USER_CLIENT_SECRET",
24-
"userServiceUrl": "USER_SERVICE_URL",
2524
"connectProjectsUrl": "CONNECT_PROJECTS_URL",
26-
"salesforceLead" : {
27-
"webToLeadUrl": "SALESFORCE_WEB_TO_LEAD_URL",
28-
"orgId" : "SALESFORCE_ORG_ID",
29-
"projectNameFieldId": "SALESFORCE_LEAD_PROJECT_NAME",
30-
"projectDescFieldId": "SALESFORCE_LEAD_PROJECT_DESC",
31-
"projectLinkFieldId": "SALESFORCE_LEAD_PROJECT_LINK",
32-
"projectIdFieldId" : "SALESFORCE_LEAD_PROJECT_ID"
33-
},
3425
"dbConfig": {
3526
"masterUrl": "DB_MASTER_URL",
3627
"maxPoolSize": "DB_MAX_POOL_SIZE",
3728
"minPoolSize": "DB_MIN_POOL_SIZE"
3829
},
39-
"analyticsKey": "ANALYTICS_KEY",
40-
"validIssuers": "VALID_ISSUERS",
30+
"analyticsKey": "SEGMENT_ANALYTICS_KEY",
31+
"VALID_ISSUERS": "VALID_ISSUERS",
4132
"jwksUri": "JWKS_URI",
4233
"busApiUrl": "BUS_API_URL",
43-
"busApiToken": "BUS_API_TOKEN"
34+
"AUTH0_URL" : "AUTH0_URL",
35+
"AUTH0_CLIENT_ID": "AUTH0_CLIENT_ID",
36+
"AUTH0_CLIENT_SECRET": "AUTH0_CLIENT_SECRET",
37+
"AUTH0_AUDIENCE": "AUTH0_AUDIENCE",
38+
"TOKEN_CACHE_TIME" : "TOKEN_CACHE_TIME"
4439
}

config/default.json

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"authSecret": "secret",
3-
"authDomain": "topcoder-dev.com",
2+
"apiVersion": "v4",
3+
"AUTH_SECRET": "secret",
44
"logLevel": "info",
55
"version": "v4",
66
"captureLogs": "false",
@@ -9,7 +9,6 @@
99
"pubsubQueueName": "project.service",
1010
"pubsubExchangeName": "projects",
1111
"fileServiceEndpoint": "",
12-
"topicServiceEndpoint": "",
1312
"identityServiceEndpoint": "",
1413
"memberServiceEndpoint": "",
1514
"directProjectServiceEndpoint": "",
@@ -25,25 +24,20 @@
2524
},
2625
"systemUserClientId": "",
2726
"systemUserClientSecret": "",
28-
"userServiceUrl": "",
2927
"connectProjectUrl":"",
30-
"salesforceLead" : {
31-
"webToLeadUrl": "https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8",
32-
"orgId": "",
33-
"projectNameFieldId": "",
34-
"projectDescFieldId": "",
35-
"projectLinkFieldId": "",
36-
"projectIdFieldId" : ""
37-
},
3828
"dbConfig": {
3929
"masterUrl": "",
4030
"maxPoolSize": 50,
4131
"minPoolSize": 4,
4232
"idleTimeout": 1000
4333
},
4434
"analyticsKey": "",
45-
"validIssuers": "[\"https:\/\/topcoder-newauth.auth0.com\/\",\"https:\/\/api.topcoder-dev.com\"]",
46-
"jwksUri": "",
35+
"VALID_ISSUERS": "[\"https:\/\/topcoder-newauth.auth0.com\/\",\"https:\/\/api.topcoder-dev.com\"]",
4736
"busApiUrl": "http://api.topcoder-dev.com",
48-
"busApiToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoicHJvamVjdC1zZXJ2aWNlIiwiaWF0IjoxNTEyNzQ3MDgyLCJleHAiOjE1MjEzODcwODJ9.PHuNcFDaotGAL8RhQXQMdpL8yOKXxjB5DbBIodmt7RE"
37+
"HEALTH_CHECK_URL": "_health",
38+
"AUTH0_CLIENT_ID": "",
39+
"AUTH0_CLIENT_SECRET": "",
40+
"AUTH0_AUDIENCE": "",
41+
"AUTH0_URL": "",
42+
"TOKEN_CACHE_TIME": ""
4943
}

config/development.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"authDomain": "topcoder-dev.com",
32
"pubsubQueueName": "dev.project.service",
43
"pubsubExchangeName": "dev.projects",
54
"attachmentsS3Bucket": "topcoder-dev-media"

config/sample.local.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,9 @@ if (process.env.NODE_ENV === 'test') {
1212
logentriesToken: '',
1313
rabbitmqURL: 'amqp://dockerhost:5672',
1414
fileServiceEndpoint: 'https://api.topcoder-dev.com/v3/files/',
15-
topicServiceEndpoint: 'https://api.topcoder-dev.com/v4/topics/',
1615
directProjectServiceEndpoint: 'https://api.topcoder-dev.com/v3/direct',
1716
connectProjectsUrl: 'https://connect.topcoder-dev.com/projects/',
1817
memberServiceEndpoint: 'http://dockerhost:3001/members',
19-
salesforceLead: {
20-
webToLeadUrl: 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8',
21-
orgId: '00D2C0000000dO6',
22-
projectNameFieldId: 'title',
23-
projectDescFieldId: 'description',
24-
projectLinkFieldId: 'URL',
25-
projectIdFieldId: '00N2C000000Vxxx',
26-
},
2718
dbConfig: {
2819
masterUrl: 'postgres://coder:mysecretpassword@dockerhost:54321/projectsdb',
2920
maxPoolSize: 50,

config/test.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
2-
"authSecret": "secret",
3-
"authDomain": "topcoder-dev.com",
2+
"AUTH_SECRET": "secret",
43
"logLevel": "debug",
54
"captureLogs": "false",
65
"logentriesToken": "",

0 commit comments

Comments
 (0)