Skip to content

Commit

Permalink
feat: add readme and test deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
wadhekarp committed Jul 13, 2024
1 parent 08064b3 commit 3e1298d
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .env.prod
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CALLME_SERVICE_URL=http://54.229.62.240:8000/callme
CALLME_SERVICE_URL=http://54.72.94.31:8000/callme
1 change: 1 addition & 0 deletions .github/workflows/ci-cd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths-ignore:
- 'README.md'
- '.gitignore'
- 'docs/**'
branches: [ "main" ]
workflow_dispatch:

Expand Down
7 changes: 0 additions & 7 deletions .infra/prod/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ resource "aws_security_group" "webserver_sg" {
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
from_port = 8000
to_port = 8000
Expand Down
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,32 @@ Start the container
```


## Folder structure
## CI/CD Flow
## API Documentation

/start - Initiates the call to CallMe service

```bash
curl -X 'POST' 'http://{example_service_url}:8000/start' -H 'Content-Type: application/json' -d '{"url": "http://example_service_url:8000/hello"}'
```

/hello - Captures the message from CallMe service

```bash
curl -X 'POST' 'http://{example_service_url}:8000/hello' -H 'Content-Type: application/json' -d '{"hello": "some text"}'
```

/callback_data - Retrieve the message sent by Call Me service

```bash
curl -X 'GET' 'http://{example_service_url}:8000/callback_data' -H 'accept: application/json'
```

/health - Health Status of API

```bash
curl -X 'GET' 'http://{example_service_url}:8000/health' -H 'Content-Type: application/json'
```

## CI/CD Flow

![CI/CD Overview](./docs/CI_CD.drawio.png)
135 changes: 135 additions & 0 deletions docs/CI_CD.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<mxfile modified="2024-07-13T17:02:52.122Z" host="app.diagrams.net" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" etag="r7182Nubxm8qkR6tUwbG" version="24.6.5" type="device">
<diagram id="Ht1M8jgEwFfnCIfOTk4-" name="Page-1">
<mxGraphModel dx="1434" dy="858" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="zgGieb3NMAHs5FnjexiJ-1" value="" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="30" y="39.38" width="1070" height="216.25" as="geometry" />
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="zgGieb3NMAHs5FnjexiJ-2" target="zgGieb3NMAHs5FnjexiJ-3" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="96" y="145" />
<mxPoint x="96" y="145" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-2" value="" style="html=1;verticalLabelPosition=bottom;align=center;labelBackgroundColor=#ffffff;verticalAlign=top;strokeWidth=2;strokeColor=#0080F0;shadow=0;dashed=0;shape=mxgraph.ios7.icons.user;" parent="1" vertex="1">
<mxGeometry x="46" y="123.75" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-3" value="" style="dashed=0;outlineConnect=0;html=1;align=center;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.weblogos.github" parent="1" vertex="1">
<mxGeometry x="136.5" y="123.75" width="40" height="42.5" as="geometry" />
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-5" value="Commit&amp;nbsp;&lt;br&gt;Code" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="76.5" y="155" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-6" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="175" y="145" as="sourcePoint" />
<mxPoint x="226" y="145" as="targetPoint" />
<Array as="points">
<mxPoint x="185" y="145" />
<mxPoint x="185" y="145" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-7" value="" style="shape=image;html=1;verticalAlign=top;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;imageAspect=0;aspect=fixed;image=https://cdn1.iconfinder.com/data/icons/social-media-2106/24/social_media_social_media_logo_docker-128.png" parent="1" vertex="1">
<mxGeometry x="450.01" y="108.63" width="63.75" height="63.75" as="geometry" />
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-8" value="Build Image from code base" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="437.13" y="172.38" width="89.5" height="30" as="geometry" />
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="275" y="144.5" as="sourcePoint" />
<mxPoint x="348.5" y="144.5" as="targetPoint" />
<Array as="points">
<mxPoint x="285" y="144.5" />
<mxPoint x="285" y="144.5" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-13" value="" style="shape=image;html=1;verticalAlign=top;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;imageAspect=0;aspect=fixed;image=https://cdn0.iconfinder.com/data/icons/social-media-2127/48/social_media_social_media_logo_docker-128.png" parent="1" vertex="1">
<mxGeometry x="585" y="114.5" width="61" height="61" as="geometry" />
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="380" y="143.25" as="sourcePoint" />
<mxPoint x="454" y="143.25" as="targetPoint" />
<Array as="points">
<mxPoint x="390" y="143.25" />
<mxPoint x="390" y="143.25" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-15" value="Terrafrom Apply" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="335" y="80" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="513.76" y="140" as="sourcePoint" />
<mxPoint x="587.76" y="140" as="targetPoint" />
<Array as="points">
<mxPoint x="523.76" y="140" />
<mxPoint x="523.76" y="140" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-21" value="AWS Cloud" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;container=1;pointerEvents=0;collapsible=0;recursiveResize=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_aws_cloud_alt;strokeColor=#232F3E;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#232F3E;dashed=0;" parent="1" vertex="1">
<mxGeometry x="870" y="90" width="190" height="118.75" as="geometry" />
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-11" value="" style="outlineConnect=0;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;shape=mxgraph.aws3.ec2;fillColor=#F58534;gradientColor=none;" vertex="1" parent="zgGieb3NMAHs5FnjexiJ-21">
<mxGeometry x="30" y="30" width="46.5" height="50.88" as="geometry" />
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-13" value="" style="image;sketch=0;aspect=fixed;html=1;points=[];align=center;fontSize=12;image=img/lib/mscae/Docker.svg;" vertex="1" parent="zgGieb3NMAHs5FnjexiJ-21">
<mxGeometry x="75.95" y="59.99999999999999" width="38.11" height="31.25" as="geometry" />
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-1" value="GitHub Actions&lt;br&gt;Workflow" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="111.75" y="90" width="89.5" height="30" as="geometry" />
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-3" value="" style="sketch=0;points=[[0,0,0],[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0,0],[0,1,0],[0.25,1,0],[0.5,1,0],[0.75,1,0],[1,1,0],[0,0.25,0],[0,0.5,0],[0,0.75,0],[1,0.25,0],[1,0.5,0],[1,0.75,0]];outlineConnect=0;fontColor=#232F3E;fillColor=#7AA116;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.s3;" vertex="1" parent="1">
<mxGeometry x="230" y="122.5" width="45" height="45" as="geometry" />
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-4" value="Ansible Config&amp;nbsp;&lt;br&gt;Push to s3" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="207.75" y="177.5" width="89.5" height="30" as="geometry" />
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-5" value="" style="image;html=1;image=img/lib/clip_art/computers/Server_Rack_128x128.png" vertex="1" parent="1">
<mxGeometry x="330" y="112.25" width="70" height="69" as="geometry" />
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-6" value="Push Image to DockerHub" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="570.75" y="90" width="89.5" height="30" as="geometry" />
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-7" value="" style="sketch=0;pointerEvents=1;shadow=0;dashed=0;html=1;strokeColor=none;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;align=center;fillColor=#505050;shape=mxgraph.mscae.enterprise.settings" vertex="1" parent="1">
<mxGeometry x="730" y="123.75" width="40" height="36" as="geometry" />
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="650" y="140" as="sourcePoint" />
<mxPoint x="724" y="140" as="targetPoint" />
<Array as="points">
<mxPoint x="660" y="140" />
<mxPoint x="660" y="140" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-10" value="EC2 Status check before deploy" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="710" y="175.5" width="89.5" height="30" as="geometry" />
</mxCell>
<mxCell id="RUGqaKzsuKH0ymSwmaAw-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="790" y="140" as="sourcePoint" />
<mxPoint x="864" y="140" as="targetPoint" />
<Array as="points">
<mxPoint x="800" y="140" />
<mxPoint x="800" y="140" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zgGieb3NMAHs5FnjexiJ-24" value="Deploy to EC2" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="920" y="208.75" width="60" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

0 comments on commit 3e1298d

Please sign in to comment.