Skip to content

Commit 1242fb9

Browse files
author
Rakesh Recharla
committed
2 parents 75a5e4c + 1e08ce2 commit 1242fb9

40 files changed

+422
-1951
lines changed

service/build/Dockerfile.template

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM appiriodevops/ap-microservice-base:0.0.1
2+
3+
MAINTAINER mdesiderio@appirio.com
4+
5+
WORKDIR /data
6+
7+
COPY review-microservice.jar /data/review-microservice.jar
8+
9+
COPY review-service.yaml /data/review-service.yaml
10+
11+
COPY newrelic.yml /usr/local/share/newrelic/newrelic.yml
12+
13+
COPY sumo-sources.json /data/sumo-sources.json
14+
15+
COPY sumo.conf /etc/sumo.conf
16+
17+
CMD /bin/bash /usr/local/share/sumocollector/collector start && java @ENV_JAVA_PARAMS@ -Ddw.authDomain="$AUTH_DOMAIN" -Ddw.databases[0].password="$OLTP_PW" -Ddw.databases[0].url="$OLTP_URL" -Ddw.databases[1].password="$DW_PW" -Ddw.databases[1].url="$DW_URL" -jar /data/review-microservice.jar server /data/review-service.yaml
18+
19+
EXPOSE 8080 8081 2181 9092
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"AWSEBDockerrunVersion": "1",
3+
"Authentication": {
4+
"Bucket": "appirio-platform-dev",
5+
"Key": "services/common/dockercfg"
6+
},
7+
"Image": {
8+
"Name": "appiriodevops/@IMAGE@",
9+
"Update": "true"
10+
},
11+
"Ports": [
12+
{
13+
"ContainerPort": "8080"
14+
}
15+
],
16+
"Volumes": [
17+
],
18+
"Logging": ""
19+
}

service/build/deploy.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
# Define script variables
3+
WORKSPACE=$1
4+
DEPLOY_DIR=$2
5+
SERVICE=$3
6+
ENV=$4
7+
8+
DOCKER_REPO=appiriodevops
9+
VER=`date "+%Y%m%d%H%M"`
10+
IMAGE="$SERVICE-microservice:$ENV.$VER"
11+
DOCKERRUN_TEMPLATE=$DEPLOY_DIR/Dockerrun.aws.json.template
12+
DOCKERRUN=$DEPLOY_DIR/Dockerrun.aws.json
13+
AWS_S3_BUCKET=appirio-platform-dev
14+
AWS_PROFILE="tc-$ENV"
15+
AWS_S3_KEY="services/docker/$IMAGE"
16+
ENV_JAVA_PARAMS=" "
17+
18+
# Elastic Beanstalk Application name
19+
# dev
20+
APPNAME="Development"
21+
if [ "$ENV" = "qa" ]; then
22+
APPNAME="QA"
23+
fi
24+
if [ "$ENV" = "prod" ]; then
25+
APPNAME="Production"
26+
AWS_S3_BUCKET=appirio-platform-prod
27+
ENV_JAVA_PARAMS='-Xmx3g -Dnewrelic.environment=production -javaagent:$NEWRELIC_JAR'
28+
fi
29+
30+
cd $DEPLOY_DIR
31+
32+
echo "Generating Dockerfile"
33+
cat Dockerfile.template | sed -e "s/@ENV_JAVA_PARAMS@/$ENV_JAVA_PARAMS/g" > Dockerfile
34+
35+
echo "Generate sumo config files"
36+
cat sumo.conf.template | sed -e "s/@env@/${ENV}/g" > sumo.conf
37+
cat sumo-sources.json.template | sed -e "s/@env@/${ENV}/g" > sumo-sources.json
38+
39+
echo "Copying deployment files to build folder"
40+
cp $WORKSPACE/service/target/review-microservice*.jar review-microservice.jar
41+
cp $WORKSPACE/service/src/main/resources/review-service.yaml review-service.yaml
42+
43+
echo "Building docker image $DOCKER_REPO/$IMAGE"
44+
sudo docker build -t $DOCKER_REPO/$IMAGE $DEPLOY_DIR
45+
46+
echo "Pushing image to docker $DOCKER_REPO/$IMAGE"
47+
sudo docker push $DOCKER_REPO/$IMAGE
48+
49+
echo "Generating dockerrun file"
50+
cat $DOCKERRUN_TEMPLATE | sed -e "s/@IMAGE@/${IMAGE}/g" > $DOCKERRUN
51+
52+
echo "Uploading dockerrun file to aws"
53+
54+
echo "Pushing Dockerrun.aws.json to S3: ${AWS_S3_BUCKET}/${AWS_S3_KEY}"
55+
aws s3api put-object --profile $AWS_PROFILE --bucket "${AWS_S3_BUCKET}" --key "${AWS_S3_KEY}" --body $DOCKERRUN
56+
57+
echo "Creating new application version $IMAGE in $APPNAME from s3:${AWS_S3_BUCKET}/${AWS_S3_KEY}"
58+
aws elasticbeanstalk create-application-version --profile $AWS_PROFILE --application-name $APPNAME --version-label $IMAGE --source-bundle S3Bucket="$AWS_S3_BUCKET",S3Key="$AWS_S3_KEY"
59+
60+
echo "updating elastic beanstalk environment ${AWS_EB_ENV} with the version $IMAGE."
61+
# assumes beanstalk app for this service has already been created and configured
62+
aws elasticbeanstalk --profile $AWS_PROFILE update-environment --environment-name $SERVICE-$ENV --version-label $IMAGE
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,4 @@ test:
282282
app_name: ap-review (Test)
283283

284284
production:
285-
<<: *default_settings
285+
<<: *default_settings

service/run-config/prod/build/sumo-sources.json renamed to service/build/sumo-sources.json.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"api.version": "v1",
33
"sources": [
44
{
5-
"name": "ap-review-prod",
5+
"name": "ap-review-@env@",
66
"sourceType": "LocalFile",
77
"multilineProcessingEnabled": false,
88
"pathExpression": "/var/log/ap-review.log",
9-
"category": "prod",
9+
"category": "@env@",
1010
"hostName": "ap-review"
1111
}
1212
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name=ap-review-prod
1+
name=ap-review-@env@
22
accessid=suMochTM9jsUmo
33
accesskey=i9Jo6vJ8TiGH4NLJ6JOrhR2Z34eKZQcDNCiGz5ePkujZWwzzZhcAZNufty6viT63
44
clobber=true

service/pom.xml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<properties>
99
<dropwizard.version>0.7.1</dropwizard.version>
1010
<powermock.version>1.5.4</powermock.version>
11+
<jackson-version>[2.5.1,)</jackson-version>
1112
</properties>
1213

1314
<build>
@@ -123,7 +124,7 @@
123124
<dependency>
124125
<groupId>appirio.platform</groupId>
125126
<artifactId>supply-library</artifactId>
126-
<version>1.0.3</version>
127+
<version>1.0.7-SNAPSHOT</version>
127128
</dependency>
128129
<dependency>
129130
<groupId>org.projectlombok</groupId>
@@ -183,6 +184,55 @@
183184
<artifactId>com.springsource.com.informix.jdbc</artifactId>
184185
<version>3.0.0.JC3</version>
185186
</dependency>
187+
<dependency>
188+
<groupId>com.fasterxml.jackson.core</groupId>
189+
<artifactId>jackson-core</artifactId>
190+
<version>${jackson-version}</version>
191+
</dependency>
192+
<dependency>
193+
<groupId>com.fasterxml.jackson.core</groupId>
194+
<artifactId>jackson-databind</artifactId>
195+
<version>${jackson-version}</version>
196+
</dependency>
197+
<dependency>
198+
<groupId>com.fasterxml.jackson.datatype</groupId>
199+
<artifactId>jackson-datatype-joda</artifactId>
200+
<version>${jackson-version}</version>
201+
</dependency>
202+
<dependency>
203+
<groupId>com.fasterxml.jackson.module</groupId>
204+
<artifactId>jackson-module-jaxb-annotations</artifactId>
205+
<version>${jackson-version}</version>
206+
</dependency>
207+
<dependency>
208+
<groupId>com.fasterxml.jackson.module</groupId>
209+
<artifactId>jackson-module-afterburner</artifactId>
210+
<version>${jackson-version}</version>
211+
</dependency>
212+
<dependency>
213+
<groupId>com.fasterxml.jackson.jaxrs</groupId>
214+
<artifactId>jackson-jaxrs-json-provider</artifactId>
215+
<version>${jackson-version}</version>
216+
</dependency>
217+
<dependency>
218+
<groupId>com.appirio</groupId>
219+
<artifactId>ap-events-bus</artifactId>
220+
<version>0.0.2-SNAPSHOT</version>
221+
<exclusions>
222+
<exclusion>
223+
<groupId>org.slf4j</groupId>
224+
<artifactId>slf4j-log4j12</artifactId>
225+
</exclusion>
226+
<exclusion>
227+
<groupId>log4j</groupId>
228+
<artifactId>log4j</artifactId>
229+
</exclusion>
230+
<exclusion>
231+
<groupId>com.fasterxml.jackson</groupId>
232+
<artifactId>*</artifactId>
233+
</exclusion>
234+
</exclusions>
235+
</dependency>
186236
</dependencies>
187237
<distributionManagement>
188238
<!-- for deployment on the build server -->

service/run-config/dev/build/Dockerfile

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)