Skip to content

Commit 1e08ce2

Browse files
committed
Merge pull request #40 from appirio-tech/dev
Remove supply server from review microservice #105166403482486
2 parents 4c4603a + 408f3c9 commit 1e08ce2

31 files changed

+282
-1969
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/run-config/dev/build/Dockerfile

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

0 commit comments

Comments
 (0)