Skip to content

Commit

Permalink
Merge pull request #31 from canopas/deploy-production
Browse files Browse the repository at this point in the history
Deploy production
  • Loading branch information
jimmy0251 authored Jan 29, 2022
2 parents a442cac + f4747ab commit 6c208b2
Show file tree
Hide file tree
Showing 13 changed files with 192 additions and 15 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/deploy-dev-backend.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: DeployDevBackend
on:
push:
tags:
- '*'
branches:
- master
- '*'

jobs:
deploy-backend:
Expand All @@ -18,8 +20,6 @@ jobs:
with:
go-version: '^1.17.5'

- uses: actions/setup-node@v1

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down Expand Up @@ -50,6 +50,7 @@ jobs:
parameter-overrides: >-
EnvName=dev,
S3BucketName=dev-stack-canopas-backend,
CustomDomainName=dev-stack-api.canopas.com,
LambdaHandlerPath=main,
LambdaZipFilePath=${{ env.ZIP_NAME }},
Sender=${{ secrets.SENDER }},
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/deploy-dev-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: DeployDevFrontend
on:
push:
tags:
- '*'
branches:
- master
- '*'

jobs:
deploy-frontend:
Expand All @@ -23,6 +25,7 @@ jobs:
with:
role-to-assume: arn:aws:iam::569704406482:role/github-actions-s3-access
aws-region: ap-south-1

- name: Deploy cloudfront
id: canopas-website-dev-frontend-stack
uses: aws-actions/aws-cloudformation-github-deploy@v1
Expand All @@ -33,12 +36,15 @@ jobs:
timeout-in-minutes: "10"
no-fail-on-empty-changeset: "1"
parameter-overrides: >-
S3BucketName=dev-stack-canopas-v1-frontend
S3BucketName=dev-stack-canopas-v1-frontend,
CustomDomainName=dev-stack.canopas.com
- name: Build frontend
run: |
cd vue-frontend
npm ci
npm run build
- name: Upload to S3
run: |
cd vue-frontend
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/deploy-prod-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: DeployProdBackend
on:
push:
tags:
- '*'
branches:
- '*'

jobs:
deploy-backend:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/[email protected]

- uses: actions/setup-go@v2
with:
go-version: '^1.17.5'

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::569704406482:role/github-actions-s3-access
aws-region: ap-south-1
- name: Build backend
run: |
GOOS=linux GOARCH=amd64 go build -o main main.go
- name: Zip function
run: |
apt-get update && apt-get install -y zip
uuid=$(uuidgen)
export ZIP_NAME="canopas-website-v1-${uuid}.zip"
zip $ZIP_NAME main
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV
- name: Upload to S3
run: |
aws s3 cp ${{ env.ZIP_NAME }} s3://prod-stack-canopas-backend/
- name: Deploy lambda function
id: canopas-website-prod-backend-stack
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: canopas-website-prod-backend-stack
template: infrastructure/template-backend.yml
capabilities: CAPABILITY_IAM,CAPABILITY_NAMED_IAM
timeout-in-minutes: "5"
no-fail-on-empty-changeset: "1"
parameter-overrides: >-
EnvName=prod,
S3BucketName=prod-stack-canopas-backend,
CustomDomainName=prod-stack-api.canopas.com,
LambdaHandlerPath=main,
LambdaZipFilePath=${{ env.ZIP_NAME }},
Sender=${{ secrets.SENDER }},
Receiver=${{ secrets.RECEIVER }},
AccessKeyId=${{ secrets.ACCESS_KEY_ID }},
SecretAccessKey=${{ secrets.SECRET_ACCESS_KEY }},
Region=${{ secrets.AWS_REGION }}
53 changes: 53 additions & 0 deletions .github/workflows/deploy-prod-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: DeployProdFrontend
on:
push:
tags:
- '*'
branches:
- '*'

jobs:
deploy-frontend:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/[email protected]

- uses: actions/setup-node@v1
with:
node-version: '16'

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::569704406482:role/github-actions-s3-access
aws-region: ap-south-1

- name: Deploy cloudfront
id: canopas-website-prod-frontend-stack
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: canopas-website-prod-frontend-stack
template: infrastructure/template-frontend.yml
capabilities: CAPABILITY_IAM,CAPABILITY_NAMED_IAM
timeout-in-minutes: "10"
no-fail-on-empty-changeset: "1"
parameter-overrides: >-
S3BucketName=prod-stack-canopas-v1-frontend,
CustomDomainName=canopas.com
- name: Build frontend
run: |
cd vue-frontend
npm ci
mv src/config.prod.js src/config.js
npm run build
- name: Upload to S3
run: |
cd vue-frontend
aws s3 sync --delete --cache-control 'max-age=31536000' --exclude *.html dist/ s3://prod-stack-canopas-v1-frontend/
aws s3 sync --cache-control 'no-cache' dist/ s3://prod-stack-canopas-v1-frontend/
7 changes: 5 additions & 2 deletions infrastructure/template-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Parameters:
Description: Name of the S3 bucket
AllowedPattern: ^.*[^0-9]$
ConstraintDescription: Must end with non-numeric character.
CustomDomainName:
Type: String
Description: Name of the custom domain
Sender:
Type: String
Description: Email address of sender.
Expand Down Expand Up @@ -51,7 +54,7 @@ Outputs:
- Arn
Export:
Name:
Fn::Sub: LambdaRole
Fn::Sub: LambdaRole-${EnvName}
LambdaFunctionName:
Value:
Ref: LambdaFunction
Expand Down Expand Up @@ -194,7 +197,7 @@ Resources:
DependsOn:
- ApiGatewayDeployment
Properties:
DomainName: dev-go-vue.canopas.com
DomainName: !Ref CustomDomainName
RestApiId: !Ref ApiGateway
Stage: !Ref ApiGatewayStageName

7 changes: 5 additions & 2 deletions infrastructure/template-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Parameters:
Description: Name of the S3 bucket
AllowedPattern: ^.*[^0-9]$
ConstraintDescription: Must end with non-numeric character.
CustomDomainName:
Type: String
Description: Name of the custom domain

Outputs:
CloudFrontDist:
Expand Down Expand Up @@ -49,14 +52,14 @@ Resources:
DefaultRootObject: index.html
HttpVersion: http2
Aliases:
- dev-stack.canopas.com
- !Ref CustomDomainName
CustomErrorResponses:
- ErrorCachingMinTTL: 31536000
ErrorCode: 403
ResponseCode: 200
ResponsePagePath: '/index.html'
ViewerCertificate:
AcmCertificateArn: 'arn:aws:acm:us-east-1:569704406482:certificate/61f88a8a-9346-4e90-9d62-d0b20cd71765'
AcmCertificateArn: 'arn:aws:acm:us-east-1:569704406482:certificate/4e2d0bf9-3e0d-4581-9292-a0ba91179f00'
MinimumProtocolVersion: TLSv1.2_2021
SslSupportMethod: sni-only
DefaultCacheBehavior:
Expand Down
35 changes: 31 additions & 4 deletions vue-frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,37 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>favicon-16x16.webp" />
<title>
Canopas - Creative solutions using innovative design, technology, and
strategy.
</title>

<meta
name="keywords"
content="Canopas, Canopas LLP, Canopas Software LLP, Canopas Software Company, Canopas Inc,
software company in surat, Software development company, IT company in surat"
/>
<meta name="author" content="canopas" />
<meta
name="description"
content=" As a software development company, Canopas helps entrepreneurs, small businesses, and startups to grow their businesses exponentially using technology."
/>
<meta property="og:title" content="Canopas" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://canopas.com/" />

<title>Canopas - Software development company - Surat</title>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-VXHMMMEJ5X"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());

gtag("config", "G-VXHMMMEJ5X");
</script>
</head>
<body>
<noscript>
Expand Down
4 changes: 3 additions & 1 deletion vue-frontend/src/components/ContactScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export default {
ScreenFooter,
ContactForm,
},
mounted() {},
mounted() {
window.gtag("event", "view_canopas_client_contact");
},
};
</script>

Expand Down
3 changes: 3 additions & 0 deletions vue-frontend/src/components/Error404Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export default {
ScreenFooter,
FontAwesomeIcon,
},
mounted() {
window.gtag("event", "view_canopas_404");
},
};
</script>

Expand Down
3 changes: 3 additions & 0 deletions vue-frontend/src/components/HomeScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ export default {
DoYouKnow,
HowDoWeDiffer,
},
mounted() {
window.gtag("event", "view_canopas_home");
},
};
</script>

Expand Down
2 changes: 2 additions & 0 deletions vue-frontend/src/components/contact/ContactForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,8 @@ export default {
if (this.name === "" || this.email === "") {
this.showValidationError = true;
} else {
window.gtag("event", "canopas_client_contact_submit");
this.showValidationError = false;
if (this.designationType == 0) {
designationValue =
Expand Down
2 changes: 1 addition & 1 deletion vue-frontend/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export default Object.freeze({
MEDIUM_URL: "https://medium.com/canopas",
BLOG_URL: "https://blog.canopas.com",
JOBS_URL: "https://jobs.canopas.com",
API_BASE: "https://dev-go-vue.canopas.com",
API_BASE: "https://dev-stack-api.canopas.com",
CALENDLY_IFRAME_URL: "https://calendly.com/darpanvithani/15min",
});
12 changes: 12 additions & 0 deletions vue-frontend/src/config.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default Object.freeze({
FACEBOOK_URL: "https://www.facebook.com/canopassoftware",
TWITTER_URL: "https://twitter.com/canopassoftware",
GITHUB_URL: "https://github.com/canopas",
INSTAGRAM_URL: "https://www.instagram.com/canopassoftware/",
LINKEDIN_URL: "https://www.linkedin.com/company/canopasinc",
MEDIUM_URL: "https://medium.com/canopas",
BLOG_URL: "https://blog.canopas.com",
JOBS_URL: "https://jobs.canopas.com",
API_BASE: "https://prod-stack-api.canopas.com",
CALENDLY_IFRAME_URL: "https://calendly.com/darpanvithani/15min",
});

0 comments on commit 6c208b2

Please sign in to comment.