Skip to content

Commit 89b7780

Browse files
Merge pull request #113 from appirio-tech/dev-core-api-upgrade
Dev core api upgrade
2 parents fb9fec7 + 70dc925 commit 89b7780

File tree

3 files changed

+112
-45
lines changed

3 files changed

+112
-45
lines changed

.circleci/config.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,8 @@ jobs:
4545
- run:
4646
name: Deploy to AWS
4747
command: |
48-
chmod +x /home/circleci/project/service/build/buildimage.sh
49-
/home/circleci/project/service/build/buildimage.sh /home/circleci/project /home/circleci/project/service/build ap-review dev
50-
- deploy:
51-
command: |
52-
echo "ntegration testing"
53-
cp ./../buildscript/master_deply_v4.1.sh .
54-
./master_deply_v4.1.sh -d EBS -e DEV -t ${TAGNAME} -s wolf
48+
chmod +x /home/circleci/project/service/build/deploy.sh
49+
/home/circleci/project/service/build/deploy.sh /home/circleci/project /home/circleci/project/service/build ap-review dev
5550
5651
workflows:
5752
version: 2
@@ -61,4 +56,4 @@ workflows:
6156
- "build-dev":
6257
filters:
6358
branches:
64-
only: dev
59+
only: dev-core-api-upgrade

service/build/deploy.sh

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,42 @@
33
WORKSPACE=$1
44
DEPLOY_DIR=$2
55
SERVICE=$3
6+
APINAME=$3 #ap-review
7+
CONFIG=$4
68
ENV=$4
79

10+
11+
REPO="${SERVICE}-microservice"
12+
TAG="${REPO}:${CONFIG}.${VER}"
13+
IMAGE="${REGISTRY}/${TAG}"
14+
15+
816
DOCKER_REPO=appiriodevops
917
VER=`date "+%Y%m%d%H%M"`
1018
IMAGE="$SERVICE-microservice:$ENV.$VER"
19+
1120
DOCKERRUN_TEMPLATE=$DEPLOY_DIR/Dockerrun.aws.json.template
1221
DOCKERRUN=$DEPLOY_DIR/Dockerrun.aws.json
1322
AWS_S3_BUCKET=appirio-platform-dev
1423
AWS_PROFILE="tc-$ENV"
1524
AWS_S3_KEY="services/docker/$IMAGE"
1625
ENV_JAVA_PARAMS=" "
26+
ENV_CONFIG=`echo "$ENV" | tr '[:lower:]' '[:upper:]'`
27+
28+
AWS_REGION=$(eval "echo \$${ENV_CONFIG}_AWS_REGION")
29+
AWS_ACCESS_KEY_ID=$(eval "echo \$${ENV_CONFIG}_AWS_ACCESS_KEY_ID")
30+
AWS_SECRET_ACCESS_KEY=$(eval "echo \$${ENV_CONFIG}_AWS_SECRET_ACCESS_KEY")
31+
32+
configure_aws_cli() {
33+
aws --version
34+
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
35+
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
36+
aws configure set default.region $AWS_REGION
37+
aws configure set default.output json
38+
echo "Configured AWS CLI."
39+
}
40+
41+
configure_aws_cli
1742

1843
# Elastic Beanstalk Application name
1944
# dev
@@ -40,24 +65,49 @@ echo "Copying deployment files to build folder"
4065
cp $WORKSPACE/service/target/review-microservice*.jar review-microservice.jar
4166
cp $WORKSPACE/service/src/main/resources/review-service.yaml review-service.yaml
4267

68+
echo "Generating Docker aws json......."
69+
PLATFORM_BUCKET=appirio-platform-$CONFIG
70+
EBDOCKER_FILENAME=${APINAME}-${CONFIG}.${VER}.aws.json
71+
cat $WORKSPACE/service/build/Dockerrun.aws.json.template | sed -e "s/@IMAGE@/${IMAGE}/g" > ./$EBDOCKER_FILENAME
72+
cat ./$EBDOCKER_FILENAME
73+
74+
echo "copying beanstalk docker file..."
75+
aws s3 cp $EBDOCKER_FILENAME s3://$PLATFORM_BUCKET/services/elasticbeanstalk/
76+
77+
echo "copying dockercfg......"
78+
aws s3 cp "s3://appirio-platform-$ENV/services/common/dockercfg" ~/.dockercfg
79+
#eval $(aws ecr get-login --region $AWS_REGION --no-include-email)
80+
# Builds Docker image of the app.
81+
#TAG=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_REPOSITORY:$CIRCLE_SHA1
82+
4383
echo "Building docker image $DOCKER_REPO/$IMAGE"
4484
docker build -t $DOCKER_REPO/$IMAGE $DEPLOY_DIR
4585

4686
echo "Pushing image to docker $DOCKER_REPO/$IMAGE"
4787
#docker login -u ykohata
4888
docker push $DOCKER_REPO/$IMAGE
4989

50-
echo "Generating dockerrun file"
51-
cat $DOCKERRUN_TEMPLATE | sed -e "s/@IMAGE@/${IMAGE}/g" > $DOCKERRUN
90+
# echo "Generating dockerrun file"
91+
# cat $DOCKERRUN_TEMPLATE | sed -e "s/@IMAGE@/${IMAGE}/g" > $DOCKERRUN
92+
93+
# echo "Uploading dockerrun file to aws"
94+
95+
# echo "Pushing Dockerrun.aws.json to S3: ${AWS_S3_BUCKET}/${AWS_S3_KEY}"
96+
# aws s3api put-object --bucket "${AWS_S3_BUCKET}" --key "${AWS_S3_KEY}" --body $DOCKERRUN
5297

53-
echo "Uploading dockerrun file to aws"
98+
#EBVERSION=${APINAME}-${CONFIG}.${VER}
5499

55-
echo "Pushing Dockerrun.aws.json to S3: ${AWS_S3_BUCKET}/${AWS_S3_KEY}"
56-
aws s3api put-object --profile $AWS_PROFILE --bucket "${AWS_S3_BUCKET}" --key "${AWS_S3_KEY}" --body $DOCKERRUN
100+
#aws elasticbeanstalk create-application-version --application-name ${APPNAME} --version-label ${EBVERSION} --source-bundle S3Bucket=${PLATFORM_BUCKET},S3Key=services/elasticbeanstalk/$EBDOCKER_FILENAME
101+
102+
#echo "Creating new application version $IMAGE in $APPNAME from s3:${AWS_S3_BUCKET}/${AWS_S3_KEY}"
103+
#aws elasticbeanstalk create-application-version --application-name $APPNAME --version-label $IMAGE --source-bundle S3Bucket="$AWS_S3_BUCKET",S3Key="$AWS_S3_KEY"
104+
105+
# assumes beanstalk app for this service has already been created and configured
106+
#aws elasticbeanstalk update-environment --environment-name $APINAME --version-label $EBVERSION
57107

58-
echo "Creating new application version $IMAGE in $APPNAME from s3:${AWS_S3_BUCKET}/${AWS_S3_KEY}"
59-
aws elasticbeanstalk create-application-version --profile $AWS_PROFILE --application-name $APPNAME --version-label $IMAGE --source-bundle S3Bucket="$AWS_S3_BUCKET",S3Key="$AWS_S3_KEY"
108+
echo "Creating new EBS application version \n"
109+
aws elasticbeanstalk create-application-version --application-name $APPNAME --version-label $IMAGE --source-bundle S3Bucket=${PLATFORM_BUCKET},S3Key=services/elasticbeanstalk/$EBDOCKER_FILENAME
60110

61-
echo "updating elastic beanstalk environment ${AWS_EB_ENV} with the version $IMAGE."
111+
echo "Updating EBS with the version $IMAGE \n"
62112
# assumes beanstalk app for this service has already been created and configured
63-
aws elasticbeanstalk --profile $AWS_PROFILE update-environment --environment-name $SERVICE-$ENV --version-label $IMAGE
113+
aws elasticbeanstalk update-environment --environment-name $SERVICE-$ENV --version-label $IMAGE

service/pom.xml

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@
1010
<dropwizard.version>1.0.0</dropwizard.version>
1111
<powermock.version>1.5.4</powermock.version>
1212
<jackson-version>2.7.3</jackson-version>
13-
<core.api.version>4.0.1-DEV</core.api.version>
13+
<core.api.version>4.2.0</core.api.version>
1414
<supply-library.version>1.0.20-SNAPSHOT</supply-library.version>
1515
</properties>
1616

1717
<build>
18+
<extensions>
19+
<extension>
20+
<groupId>org.kuali.maven.wagons</groupId>
21+
<artifactId>maven-s3-wagon</artifactId>
22+
<version>1.2.1</version>
23+
</extension>
24+
</extensions>
1825
<plugins>
1926
<plugin>
2027
<groupId>org.codehaus.mojo</groupId>
@@ -239,16 +246,14 @@
239246
</dependencies>
240247
<distributionManagement>
241248
<!-- for deployment on the build server -->
242-
<repository>
243-
<id>appirio-repo</id>
244-
<name>Appirio Maven Repository</name>
245-
<url>http://maven.topcoder-dev.com:8080/</url>
246-
</repository>
247-
<snapshotRepository>
248-
<id>appirio-repo</id>
249-
<name>Appirio Maven Repository</name>
250-
<url>http://maven.topcoder-dev.com:8080/</url>
251-
</snapshotRepository>
249+
<snapshotRepository>
250+
<id>tcreposnap</id>
251+
<url>s3://tc-mvn-repo/snapshot</url>
252+
</snapshotRepository>
253+
<repository>
254+
<id>tcrepo</id>
255+
<url>s3://tc-mvn-repo/release</url>
256+
</repository>
252257
</distributionManagement>
253258
<reporting>
254259
<plugins>
@@ -294,13 +299,39 @@
294299
</reporting>
295300

296301
<repositories>
302+
<repository>
303+
<id>tcrepo</id>
304+
<url>s3://tc-mvn-repo/release</url>
305+
<snapshots>
306+
<enabled>false</enabled>
307+
<updatePolicy>always</updatePolicy>
308+
</snapshots>
309+
<releases>
310+
<enabled>true</enabled>
311+
<updatePolicy>always</updatePolicy>
312+
</releases>
313+
</repository>
314+
<repository>
315+
<id>tcreposnap</id>
316+
<url>s3://tc-mvn-repo/snapshot</url>
317+
<snapshots>
318+
<enabled>true</enabled>
319+
<updatePolicy>always</updatePolicy>
320+
</snapshots>
321+
<releases>
322+
<enabled>false</enabled>
323+
<updatePolicy>always</updatePolicy>
324+
</releases>
325+
</repository>
297326
<repository>
298-
<id>temp-maven-repo</id>
299-
<url>https://github.com/appirio-tech/temp-maven-repo/raw/master</url>
300-
<snapshots>
301-
<enabled>true</enabled>
302-
<updatePolicy>always</updatePolicy>
303-
</snapshots>
327+
<id>com.springsource.repository.bundles.release</id>
328+
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
329+
<url>http://repository.springsource.com/maven/bundles/release</url>
330+
</repository>
331+
<repository>
332+
<id>com.springsource.repository.bundles.external</id>
333+
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
334+
<url>http://repository.springsource.com/maven/bundles/external</url>
304335
</repository>
305336
<repository>
306337
<id>Appirio Technology Maven Repository</id>
@@ -311,16 +342,7 @@
311342
<releases>
312343
<updatePolicy>always</updatePolicy>
313344
</releases>
314-
</repository>
315-
<repository>
316-
<id>com.springsource.repository.bundles.release</id>
317-
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
318-
<url>http://repository.springsource.com/maven/bundles/release</url>
319-
</repository>
320-
<repository>
321-
<id>com.springsource.repository.bundles.external</id>
322-
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
323-
<url>http://repository.springsource.com/maven/bundles/external</url>
324-
</repository>
345+
</repository>
325346
</repositories>
347+
326348
</project>

0 commit comments

Comments
 (0)