Skip to content

Commit f3a2f8a

Browse files
committed
Merge branch 'dev-circleci'
2 parents cddfeb6 + 48f1222 commit f3a2f8a

File tree

5 files changed

+97
-77
lines changed

5 files changed

+97
-77
lines changed

.travis.yml

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

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# TC Deployment Notes
22
_[TC Deployment Notes should always be kept up to date **on the default branch**. Update these notes when changes to this information occur]_
33

4-
**General Deployment:** This software is deployed to AWS S3 by Travis.ci. It's ultimately delivered through AWS Cloudfront, which is fed from the S3 bucket. There are no EC2 systems involved in the delivery (althought Connect is fed from various micro-services).
4+
**General Deployment:** This software is deployed to AWS S3 by CircleCI. It's ultimately delivered through AWS Cloudfront, which is fed from the S3 bucket. There are no EC2 systems involved in the delivery (althought Connect is fed from various micro-services).
55

66
**Branches:**
77

@@ -13,8 +13,8 @@ _[TC Deployment Notes should always be kept up to date **on the default branch**
1313

1414
**Additional Notes:**
1515

16-
* The _.travis.yml_ file controls the build - see this file if you need to confirm if your commit will deploy anything
17-
* Travis-ci builds can be easily cancelled - please do so if you accidentally trigger an undesired build
16+
* The _circle.yml_ file controls the build - see this file if you need to confirm if your commit will deploy anything
17+
* Circle-ci builds can be easily cancelled - please do so if you accidentally trigger an undesired build
1818

1919
# Customer-App
2020

circle.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
machine:
2+
node:
3+
version: 5.5.0
4+
environment:
5+
CXX: g++-4.8
6+
7+
dependencies:
8+
pre:
9+
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
10+
- sudo apt-get update -y
11+
- sudo apt-get install g++-4.8 -y
12+
override:
13+
- npm install
14+
15+
compile:
16+
override:
17+
- npm cache clean
18+
- npm run lint && npm test && npm run build
19+
20+
deployment:
21+
development:
22+
branch: dev
23+
owner: appirio-tech
24+
commands:
25+
- ./deploy.sh DEV
26+
qa:
27+
branch: qa
28+
owner: appirio-tech
29+
commands:
30+
- ./deploy.sh QA
31+
production:
32+
branch: master
33+
owner: appirio-tech
34+
commands:
35+
- ./deploy.sh PROD

deploy.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env bash
2+
3+
ENV=$1
4+
echo $ENV
5+
#AWS_REGION=$(eval "echo \$${ENV}_AWS_REGION")
6+
AWS_ACCESS_KEY_ID=$(eval "echo \$${ENV}_AWS_ACCESS_KEY_ID")
7+
AWS_SECRET_ACCESS_KEY=$(eval "echo \$${ENV}_AWS_SECRET_ACCESS_KEY")
8+
AWS_S3_BUCKET=$(eval "echo \$${ENV}_S3_BUCKET")
9+
10+
configure_aws_cli() {
11+
aws --version
12+
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
13+
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
14+
#aws configure set default.region $AWS_REGION
15+
aws configure set default.output json
16+
echo "Configured AWS CLI."
17+
}
18+
19+
deploy_s3bucket() {
20+
#chmod -R 775 ${HOME}/${CIRCLE_PROJECT_REPONAME}/dist
21+
cat dist/app.2e9868372e0e2992d5d2.css
22+
#aws s3 sync --dryrun ${HOME}/${CIRCLE_PROJECT_REPONAME}/dist s3://${AWS_S3_BUCKET} --cache-control private,no-store,no-cache,must-revalidate,max-age=0
23+
#result=`aws s3 sync ${HOME}/${CIRCLE_PROJECT_REPONAME}/dist s3://${AWS_S3_BUCKET} --cache-control private,no-store,no-cache,must-revalidate,max-age=0`
24+
aws s3 sync --dryrun ${HOME}/${CIRCLE_PROJECT_REPONAME}/dist s3://${AWS_S3_BUCKET} --cache-control max-age=0,s-maxage=86400 --exclude "*.txt" --exclude "*.js" --exclude "*.map" --exclude "*.css"
25+
result=`aws s3 sync ${HOME}/${CIRCLE_PROJECT_REPONAME}/dist s3://${AWS_S3_BUCKET} --cache-control max-age=0,s-maxage=86400 --exclude "*.txt" --exclude "*.js" --exclude "*.map" --exclude "*.css"`
26+
if [ $? -eq 0 ]; then
27+
#echo $result
28+
echo "All html, font, image and media files are Deployed without gzip encoding!"
29+
else
30+
echo "Deployment Failed - $result"
31+
exit 1
32+
fi
33+
#result=`aws s3 sync ${HOME}/${CIRCLE_PROJECT_REPONAME}/dist s3://${AWS_S3_BUCKET} --cache-control private,no-store,no-cache,must-revalidate,max-age=0`
34+
aws s3 sync --dryrun ${HOME}/${CIRCLE_PROJECT_REPONAME}/dist s3://${AWS_S3_BUCKET} --cache-control max-age=0,s-maxage=86400 --exclude "*" --include "*.txt" --include "*.js" --include "*.map" --include "*.css" --content-encoding gzip
35+
result=`aws s3 sync ${HOME}/${CIRCLE_PROJECT_REPONAME}/dist s3://${AWS_S3_BUCKET} --cache-control max-age=0,s-maxage=86400 --exclude "*" --include "*.txt" --include "*.js" --include "*.map" --include "*.css" --content-encoding gzip`
36+
if [ $? -eq 0 ]; then
37+
#echo $result
38+
echo "All css, js, and map files are Deployed! with gzip"
39+
else
40+
echo "Deployment Failed - $result"
41+
exit 1
42+
fi
43+
44+
}
45+
46+
#sed -i 's/^application\/x-font-woff.*/application\/font-woff\t\t\t\twoff/' /etc/mime.types
47+
echo -e "application/font-woff\t\t\t\twoff2" >> /etc/mime.types
48+
echo -e "application/font-sfnt\t\t\t\tttf" >> /etc/mime.types
49+
echo -e "application/json\t\t\t\tmap" >> /etc/mime.types
50+
#sed -i 's/^image\/vnd.microsoft.icon.*/image\/vnd.microsoft.icon/' /etc/mime.types
51+
#sed -i 's/^image\/x-icon.*/image\/x-icon\t\t\t\tico/' /etc/mime.types
52+
cat /etc/mime.types | grep -i woff
53+
cat /etc/mime.types | grep -i ico
54+
cat /etc/mime.types | grep -i map
55+
cat /etc/mime.types | grep -i ttf
56+
57+
configure_aws_cli
58+
deploy_s3bucket

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require('./node_modules/coffee-script/register')
22
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
33

4-
const branch = process.env.TRAVIS_BRANCH
4+
const branch = process.env.CIRCLE_BRANCH
55

66
process.env.ENV = 'DEV' // Default to DEV
77

0 commit comments

Comments
 (0)