-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b24a90
commit 56b4581
Showing
2 changed files
with
67 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,68 @@ | ||
|
||
name: CICD Deployment API to Elastic Beanstalk | ||
name: CICD Deployment API Koyeb | ||
|
||
on: | ||
push: | ||
branches: | ||
- Ch8BE | ||
pull_request: | ||
branches: | ||
- Ch8BE | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: [ ubuntu-latest ] | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v2 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
node-version: '20' | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Install Yarn | ||
run: npm install --global yarn@latest | ||
# - name: Run tests | ||
# run: npm test | ||
|
||
- name: Clean Yarn Cache | ||
run: yarn cache clean | ||
# - name: Build project | ||
# run: npm run build | ||
|
||
- name: Remove Node Modules | ||
run: rm -rf node_modules | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: github.ref == 'refs/heads/Ch8BE' | ||
|
||
- name: Install Dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Generate deployment package | ||
run: zip -r deploy.zip . -x '*.git*' | ||
- name: Deploy to EB | ||
uses: einaregilsson/beanstalk-deploy@v22 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
aws_access_key: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
application_name: 'Car-Challenge8-API' | ||
environment_name: 'car-challenge8-api-env' | ||
version_label: ${{ github.sha }}-${{ github.run_number }} | ||
region: us-east-1 | ||
deployment_package: deploy.zip | ||
node-version: '20' | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Build project | ||
run: npm run build | ||
|
||
- name: Deploy to Koyeb | ||
env: | ||
KOYEB_API_TOKEN: 7mn92452fwp2net3olqnxly8glbq0a6ejnwb603ntbb51w0smc7vzi92h0vkugzd | ||
run: | | ||
curl -X POST https://app.koyeb.com/v1/services/c7ae7002-8df6-48f9-ad18-fbd5fa336ebf/redeploy \ | ||
-H "Authorization: Bearer 7mn92452fwp2net3olqnxly8glbq0a6ejnwb603ntbb51w0smc7vzi92h0vkugzd" \ | ||
-H "Content-Type: application/json" \ | ||
-d ' | ||
{ | ||
"name": "synrgy-final-project-fsw", | ||
"git": { | ||
"repo":"https://github.com/RazinSyakib43/Car-Management-Dashboard.git", | ||
"branch":"Ch8BE" | ||
} | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,8 @@ import type { Knex } from "knex"; | |
|
||
const config: { [key: string]: Knex.Config } = { | ||
development: { | ||
client: "pg", | ||
connection: { | ||
host: "localhost", | ||
port: 5432, | ||
database: "car_rental_ch7_db", | ||
user: "postgres", | ||
password: "yessgood123", | ||
}, | ||
client: 'pg', | ||
connection: "postgresql://postgres.hgxmajbxzfwodrzbdpmc:[email protected]:6543/postgres", | ||
pool: { | ||
min: 0, | ||
max: 7 | ||
|
@@ -28,9 +22,12 @@ const config: { [key: string]: Knex.Config } = { | |
staging: { | ||
client: "postgresql", | ||
connection: { | ||
database: "my_db", | ||
user: "username", | ||
password: "password" | ||
host: "carrentalch7db.cjss6eo44hm5.ap-southeast-1.rds.amazonaws.com", | ||
port: 5432, | ||
database: "car_rental_ch7_db", | ||
user: "ch8admin", | ||
password: "oQxil5ODW3SK", | ||
ssl: { rejectUnauthorized: false } | ||
}, | ||
pool: { | ||
min: 2, | ||
|
@@ -44,9 +41,12 @@ const config: { [key: string]: Knex.Config } = { | |
production: { | ||
client: "postgresql", | ||
connection: { | ||
database: "my_db", | ||
user: "username", | ||
password: "password" | ||
host: "carrentalch7db.cjss6eo44hm5.ap-southeast-1.rds.amazonaws.com", | ||
port: 5432, | ||
database: "car_rental_ch7_db", | ||
user: "ch8admin", | ||
password: "oQxil5ODW3SK", | ||
ssl: { rejectUnauthorized: false } | ||
}, | ||
pool: { | ||
min: 2, | ||
|