Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/jaydee029/Barkin into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydee029 committed Apr 5, 2024
2 parents eb40212 + 36cfea5 commit 9b24051
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
workflow_dispatch:
pull_request:
branches: [main]
env:
AWS_REGION: ap-south-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
PRIVATE_SSH_KEY: ${{ secrets.AWS_SSH_KEY }}
SERVER_PUBLIC_IP: ${{ secrets.AWS_PUBLIC_KEY }}

jobs:
deploy:
Expand Down Expand Up @@ -35,7 +41,6 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1


- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
Expand All @@ -44,5 +49,26 @@ jobs:
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
- name: Deploy docker image to EC2
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: verses
IMAGE_TAG: latest
AWS_DEFAULT_REGION: ap-south-1
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_PUBLIC_KEY}}
username: ubuntu
key: ${{ secrets.AWS_SSH_KEY }}
envs: PRIVATE_SSH_KEY,REGISTRY,REPOSITORY,IMAGE_TAG,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_DEFAULT_REGION,AWS_REGION
script: |-
sudo apt update
sudo apt install docker.io -y
sudo apt install awscli -y
sudo $(aws ecr get-login --no-include-email --region ap-south-1);
sudo docker stop deploy || true
sudo docker rm deploy || true
sudo docker pull $REGISTRY/$REPOSITORY:$IMAGE_TAG
sudo docker run -d -e PORT=80 -e JWT_SECRET=fbd88e -e GOLD_KEY=nfjd878 -e DB_CONN=dgddbujdb --name deploy -p 80:80 $REGISTRY/$REPOSITORY:$IMAGE_TAG

3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ ADD Verses /usr/bin/Verses

EXPOSE 80

CMD ["Verses"]


CMD ["Verses"]
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ A social media Backend APi

## API DOCUMENTATION

###
Welcome Page
```
http://13.201.15.193/app
```

### Base URL
```
http://13.201.15.193/api
```

### Endpoints

Expand Down Expand Up @@ -179,14 +188,7 @@ A social media Backend APi

Status Code: 204 No Content
- #### Administrative Tasks
- #### Gold Webhooks `POST` `/gold/webhooks`
Description: Receive webhook notifications related to gold.

Request Body:

Response:

Status Code: 200 OK
- #### Metrics `GET` `/metrics`
Description: Retrieve server metrics.

Expand Down

0 comments on commit 9b24051

Please sign in to comment.