Skip to content

Commit 476a492

Browse files
author
vikasrohit
authored
Merge pull request #80 from topcoder-platform/feature/circleci-ecs-upgrade-squashed
CircleCI 2.0 upgrade
2 parents a9bb684 + 38a5b61 commit 476a492

File tree

16 files changed

+388
-200
lines changed

16 files changed

+388
-200
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: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,6 @@ FROM node:6.9.4
22
LABEL version="1.0"
33
LABEL description="Projects microservice"
44

5-
RUN apt-get update && \
6-
apt-get upgrade -y
7-
8-
# install aws
9-
RUN apt-get install -y \
10-
ssh \
11-
python \
12-
python-dev \
13-
python-pip
14-
15-
RUN pip install awscli
16-
175
RUN apt-get install libpq-dev
186
# Create app directory
197
RUN mkdir -p /usr/src/app

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.

config/custom-environment-variables.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"apiVersion": "API_VERSION",
23
"authSecret": "AUTH_SECRET",
34
"logLevel": "LOG_LEVEL",
45
"version": "APP_VERSION",
@@ -17,26 +18,16 @@
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",
30+
"analyticsKey": "SEGMENT_ANALYTICS_KEY",
4031
"validIssuers": "VALID_ISSUERS",
4132
"jwksUri": "JWKS_URI",
4233
"busApiUrl": "BUS_API_URL",

config/default.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"apiVersion": "v4",
23
"authSecret": "secret",
34
"authDomain": "topcoder-dev.com",
45
"logLevel": "info",
@@ -9,7 +10,6 @@
910
"pubsubQueueName": "project.service",
1011
"pubsubExchangeName": "projects",
1112
"fileServiceEndpoint": "",
12-
"topicServiceEndpoint": "",
1313
"identityServiceEndpoint": "",
1414
"memberServiceEndpoint": "",
1515
"directProjectServiceEndpoint": "",
@@ -25,16 +25,7 @@
2525
},
2626
"systemUserClientId": "",
2727
"systemUserClientSecret": "",
28-
"userServiceUrl": "",
2928
"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-
},
3829
"dbConfig": {
3930
"masterUrl": "",
4031
"maxPoolSize": 50,

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,

0 commit comments

Comments
 (0)