Skip to content

Commit 1b29f9f

Browse files
aws deploy test1
1 parent 21681cb commit 1b29f9f

File tree

4 files changed

+65
-14
lines changed

4 files changed

+65
-14
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
sudo docker pull thisshon/v-pay:latest
5353
sudo docker stop user-app || true
5454
sudo docker rm user-app || true
55-
sudo docker run -e DATABASE_URL=${{ secrets.DATABASE_URL }} -e NEXTAUTH_URL=http://vpay.uk.to -d --name user-app -p 3005:3000 --restart unless-stopped thisshon/v-pay:latest
55+
sudo docker run -e DATABASE_URL=${{ secrets.DATABASE_URL }} -e NEXTAUTH_URL=https://vpay.starzc.com -d --name user-app -p 3005:3000 --restart unless-stopped thisshon/v-pay:latest
5656
5757
# Deploy bank-webhook to EC2
5858
- name: Deploy to EC2 (bank-webhook)
@@ -65,4 +65,4 @@ jobs:
6565
sudo docker pull thisshon/bank-webhook:latest
6666
sudo docker stop bank-webhook || true
6767
sudo docker rm bank-webhook || true
68-
sudo docker run -e DATABASE_URL=${{ secrets.DATABASE_URL }} -e NEXTAUTH_URL=http://bank.vpay.uk.to -d --name bank-webhook -p 3003:3003 --restart unless-stopped thisshon/bank-webhook:latest
68+
sudo docker run -e DATABASE_URL=${{ secrets.DATABASE_URL }} -e NEXTAUTH_URL=https://vpaybankwebhook.starzc.com -d --name bank-webhook -p 3003:3003 --restart unless-stopped thisshon/bank-webhook:latest

README.md

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,7 @@ Graphical view of monthly transactions.
2828
User selects a bank and amount.
2929
Creates an on-ramp transaction (status: Processing).
3030
Redirects to bank site; after payment, the bank calls the /hdfcWebhook endpoint (bank-webhook app).
31-
On webhook, the backend updates the user's balance and transaction status to Success.
32-
sample Postman Post Req:
33-
{
34-
"token": "232.23011382469227",
35-
"user_identifier": "2",
36-
"amount": "10000",
37-
"PaymentResponse":"Success"
38-
}
39-
![postman webhook call](image.png)
31+
4032
4. P2P Transfer
4133
User enters recipient's number and amount.
4234
Backend validates recipient, checks balance, and performs atomic transfer (debit sender, credit receiver, create transfer record).
@@ -48,6 +40,15 @@ P2P Transactions: Shows last 5 sent/received transfers, with direction, amount,
4840
All Transactions: Tabular view of all user transactions.
4941
6. Bank Webhook
5042
Receives POST requests from banks after payment.
43+
On webhook, the backend updates the user's balance and transaction status to Success.
44+
sample Postman Post Req:
45+
{
46+
"token": "232.23011382469227",
47+
"user_identifier": "2",
48+
"amount": "10000",
49+
"PaymentResponse":"Success"
50+
}
51+
![postman webhook call](image.png)
5152
Validates payload, updates user balance and transaction status.
5253
Codebase Structure
5354
user-app: Next.js frontend (dashboard, auth, API routes).
@@ -71,4 +72,54 @@ Frontend: Next.js, React, Tailwind CSS, Radix UI, custom UI library.
7172
Backend: Next.js API routes, Express (webhook), Prisma, PostgreSQL.
7273
Auth: NextAuth.js.
7374
State: React hooks, Recoil (planned).
74-
Dev Tools: Turborepo, ESLint, Prettier, Docker.
75+
Dev Tools: Turborepo, ESLint, Prettier, Docker.
76+
77+
78+
AWS SETUP
79+
80+
Can Run entire Turborepo in ec2 for simplification, but here dockerizing separately and adding workflows for learing.
81+
ec2-t3micro
82+
security group: open ssh,http,https ports
83+
84+
connect using keypair: chmod 400 Vpay-keypair.pem
85+
cp Vpay-keypair.pem ~/.ssh/
86+
ssh -i ~/.ssh/Vpay-keypair.pem ubuntu@"public-ip-address"
87+
88+
ngnix:
89+
server {
90+
server_name Vpay.starzc.com;
91+
92+
location / {
93+
proxy_pass http://localhost:3005;
94+
proxy_http_version 1.1;
95+
proxy_set_header Upgrade $http_upgrade;
96+
proxy_set_header Connection 'upgrade';
97+
proxy_set_header Host $host;
98+
proxy_cache_bypass $http_upgrade;
99+
100+
101+
}
102+
103+
104+
}
105+
106+
server {
107+
server_name Vpaybankwebhook.starzc.com;
108+
109+
location / {
110+
proxy_pass http://localhost:3003;
111+
proxy_http_version 1.1;
112+
proxy_set_header Upgrade $http_upgrade;
113+
proxy_set_header Connection 'upgrade';
114+
proxy_set_header Host $host;
115+
proxy_cache_bypass $http_upgrade;
116+
117+
118+
}
119+
120+
121+
122+
}
123+
sudo nginx -t
124+
sudo nginx -s reload
125+
Install certbot for https :https://certbot.eff.org/instructions?ws=nginx&os=snap

apps/bank-webhook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66

77
"scripts": {
8-
"build": "tsc && npm run swagger:build",
8+
"build": "npm run swagger:build && tsc",
99
"start": "node dist/index.js",
1010
"dev": "npx ts-node ./src/index.ts",
1111
"swagger:build": "node scripts/generate-swagger.js"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dev": "turbo dev",
77
"lint": "turbo lint",
88
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
9-
"db:generate": "cd packages/db && npx prisma generate && cd ../..",
9+
"db:generate": "cd packages/db && npx prisma generate && cd ../..",
1010
"start-user-app": "cd ./apps/user-app && npm run start",
1111
"start-bankwebhook": "cd ./apps/bank-webhook && npm run start",
1212
"start": "concurrently \"npm run start-bankwebhook\" \"npm run start-user-app\""

0 commit comments

Comments
 (0)