Skip to content

Commit

Permalink
Added deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
piyushgarg-dev committed Oct 29, 2023
1 parent f3f0f30 commit 12e0f1e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
"repository": "[email protected]:piyushgarg-dev/review-app-api.git",
"author": "Piyush Garg <[email protected]>",
"scripts": {
"local": "dotenv -c local -- npm run prisma:generate && concurrently \"serverless offline --stage local --disableCookieValidation\"",
"migrate:latest": "dotenv -c local -- prisma migrate deploy",
"prisma:migrate:local": "dotenv -c local -- prisma migrate dev",
"local": "dotenv -c development -- npm run prisma:generate && concurrently \"serverless offline --stage development --disableCookieValidation\"",
"migrate:latest": "dotenv -c development -- prisma migrate deploy",
"prisma:migrate:local": "dotenv -c development -- prisma migrate dev",
"prisma:generate": "prisma generate",
"prisma:studio": "dotenv -c local -- prisma studio"
"prisma:studio": "dotenv -c development -- prisma studio",
"deploy:prod": "dotenv -c production -- sh scripts/deploy.sh production"
},
"devDependencies": {
"@types/jsonwebtoken": "^9.0.2",
Expand Down
3 changes: 2 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
}

datasource db {
Expand Down
10 changes: 10 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
STAGE="$1"

echo "[$STAGE]: Migrate Primsa"
dotenv -c $STAGE -- prisma migrate deploy

echo "[$STAGE]: Generate Primsa Client"
npm run prisma:generate

echo "[$STAGE]: Start Serverless Deployment"
sls deploy --stage $STAGE
2 changes: 1 addition & 1 deletion serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ provider:
timeout: 25
lambdaHashingVersion: 20201221
region: ap-south-1
profile: default
profile: melonreviews
environment:
STAGE: ${self:provider.stage}
NODE_ENV: ${self:provider.stage}
Expand Down

0 comments on commit 12e0f1e

Please sign in to comment.