Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [NMP-80] Prisma set up #105

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
82dcef5
Added prisma
dallascrichmond Dec 13, 2024
7d026b8
Added region router and controller
dallascrichmond Dec 13, 2024
cd344e9
Prisma initialized and test region model defined
dallascrichmond Dec 16, 2024
d4cc2f7
Deleted compied docker compose
dallascrichmond Dec 16, 2024
afd1782
Updated volumes
dallascrichmond Dec 16, 2024
0ec8d8e
DATABASE URL added
dallascrichmond Dec 16, 2024
51e7c6f
Updated deploy
dallascrichmond Dec 16, 2024
26bca6b
Updated
dallascrichmond Dec 16, 2024
1dac732
Change database url
dallascrichmond Dec 16, 2024
72a8478
Added database url
dallascrichmond Dec 16, 2024
1d3c5aa
Updated url
dallascrichmond Dec 17, 2024
9ce1682
update
dallascrichmond Dec 17, 2024
c034346
Updated url
dallascrichmond Dec 17, 2024
643e367
Added migrate command to package
dallascrichmond Dec 17, 2024
9e0e4c7
Files added
dallascrichmond Dec 17, 2024
c61b294
Updated package
dallascrichmond Dec 17, 2024
65b0436
Test
dallascrichmond Dec 17, 2024
8359573
Updated deploy
dallascrichmond Dec 17, 2024
ea39da5
Fix
dallascrichmond Dec 17, 2024
e0d0d7a
Added new workflow
dallascrichmond Dec 18, 2024
ee3da46
Updated
dallascrichmond Dec 18, 2024
6eaa457
Updated deploy
dallascrichmond Dec 18, 2024
775565d
Test
dallascrichmond Dec 18, 2024
812a424
Temporarily removing migrations
raarielgrace Dec 19, 2024
17aa699
Longer wait before database timeout
raarielgrace Dec 20, 2024
d412952
Reverting. Didn't fix the issue
raarielgrace Dec 20, 2024
31fa8b9
One more attempt with IP
raarielgrace Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,21 @@ jobs:
-p IMAGE_TAG=${{ inputs.tag }}
-p TARGET=${{ inputs.target }}
-p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }}
-p DB_PASSWORD=${{ secrets.DB_PASSWORD }}
-p DATABASE_URL="postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@10.98.51.10:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public"
verification_path: /api/health
verification_retry_attempts: "5"
verification_retry_seconds: "15"
#- name: Install dependencies
# run: |
# cd backend
# npm ci
#- name: Run Prisma Migrations
# env:
# DATABASE_URL: "postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@10.98.51.10:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public"
# run: |
# cd backend
# npx prisma migrate deploy

frontend:
name: Frontend
Expand Down
3 changes: 3 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
# Keep environment variables out of version control
.env
10 changes: 0 additions & 10 deletions backend/.husky/pre-push

This file was deleted.

16 changes: 14 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@ FROM node:20.17.0
# Copy files and install dependencies
WORKDIR /app/
COPY . ./
RUN npm ci && \
npm run build

RUN npx prisma generate

#For debugging: create and write the contents of start.sh in the container
RUN rm start.sh
RUN echo "#!/bin/bash" >> start.sh && \
echo "# push the schema to the database and sync the client" >> start.sh && \
echo "npx prisma db push --schema='/usr/src/app/prisma/schema.prisma' --skip-generate " >> start.sh && \
echo "" >> start.sh

# Set execute permissions for the start.sh script.
RUN chmod +x ./start.sh

RUN npm run build

# Run in dev mode, `npm run serve` for production
CMD ["npm", "run", "serve", "--no-update-notifier", "--max-old-space-size=50"]
8 changes: 6 additions & 2 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ parameters:
required: true
- name: DB_PASSWORD
description: Password for the PostgreSQL connection user.
from: '[a-zA-Z0-9]{16}'
generate: expression
required: true
- name: SSOAUTH
description: SSO Auth Server URL
required: true
- name: DATABASE_URL
description: Database URL
required: true
objects:
- kind: Service
apiVersion: v1
Expand Down Expand Up @@ -101,6 +103,8 @@ objects:
value: https://${APP}-${TARGET}.apps.silver.devops.gov.bc.ca
- name: BACKEND_URL
value: https://${APP}-${TARGET}-${COMPONENT}.apps.silver.devops.gov.bc.ca
- name: DATABASE_URL
value: ${DATABASE_URL}
ports:
- containerPort: 3000
protocol: TCP
Expand Down
Loading
Loading