Skip to content

Commit 3c26148

Browse files
authored
Merge pull request #2084 from bluewave-labs/develop-saas
Merging develop-saas into master-saas
2 parents b0b292f + d0545ec commit 3c26148

File tree

221 files changed

+20609
-7108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+20609
-7108
lines changed

.claude/settings.local.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(npm run build:*)",
5+
"Bash(mkdir:*)",
6+
"Bash(npm run lint)",
7+
"Bash(npm run lint:*)",
8+
"Bash(npx tsc:*)",
9+
"Bash(npx eslint:*)",
10+
"Bash(git checkout:*)",
11+
"Bash(git add:*)",
12+
"Bash(git commit:*)",
13+
"Bash(git push:*)",
14+
"Bash(gh pr create:*)",
15+
"Bash(grep:*)",
16+
"Bash(git pull:*)",
17+
"Bash(node:*)",
18+
"Bash(npm start)",
19+
"Bash(npx swagger-jsdoc:*)",
20+
"Bash(gh pr list:*)",
21+
"Bash(find:*)",
22+
"Bash(cat:*)",
23+
"Bash(git fetch:*)",
24+
"Bash(git merge:*)",
25+
"Bash(git stash:*)",
26+
"Bash(gh pr view:*)",
27+
"Read(/A:\\VerifyWiseRepository\\verifywise\\Clients\\src\\presentation\\components\\AddNewRiskForm\\MitigationSection/**)",
28+
"Read(/A:\\VerifyWiseRepository\\verifywise\\Clients\\src\\presentation\\components\\AddNewRiskForm/**)",
29+
"Read(/A:\\VerifyWiseRepository\\verifywise\\Clients\\src\\presentation\\components\\AddNewRiskForm\\MitigationSection/**)",
30+
"Read(/A:\\VerifyWiseRepository\\verifywise\\Clients\\src\\presentation\\components\\AddNewRiskForm\\MitigationSection/**)",
31+
"Read(/A:\\VerifyWiseRepository\\verifywise\\Clients\\src\\presentation\\components\\AddNewRiskForm\\MitigationSection/**)",
32+
"Read(/A:\\VerifyWiseRepository\\verifywise\\Clients\\src\\presentation\\components\\AddNewRiskForm\\MitigationSection/**)",
33+
"Read(/A:\\VerifyWiseRepository\\verifywise\\Clients\\src\\presentation\\components\\AddNewRiskForm\\MitigationSection/**)",
34+
"mcp__ide__getDiagnostics",
35+
"Read(/A:\\VerifyWiseRepository\\verifywise\\Clients\\src\\presentation\\components\\AddNewRiskForm\\MitigationSection/**)",
36+
"Read(/A:\\VerifyWiseRepository\\verifywise\\Clients\\src\\presentation\\components\\AddNewRiskForm\\MitigationSection/**)",
37+
"WebFetch(domain:github.com)"
38+
],
39+
"deny": [],
40+
"ask": []
41+
}
42+
}

.env.dev

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ NODE_ENV=development
1010

1111
MULTI_TENANCY_ENABLED=false
1212

13+
# Google Authentication
14+
# Get your Google Client ID from: https://console.developers.google.com/
15+
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
16+
1317
RESEND_API_KEY=your-resend-api-key
1418

1519
# Database

.env.prod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ DB_SSL=false
1212

1313
MULTI_TENANCY_ENABLED=false
1414

15+
# Google Authentication
16+
# Get your Google Client ID from: https://console.developers.google.com/
17+
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
18+
1519
RESEND_API_KEY=your-resend-api-key
1620

1721
# Database
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build and Push Images to GitHub Container Registry
2+
3+
on:
4+
push:
5+
branches:
6+
- develop-saas
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
environment: Build
12+
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v2
23+
24+
- name: Debug GitHub Token Access
25+
run: |
26+
if [ -z "${{ secrets.GITHUB_TOKEN }}" ]; then
27+
echo "GITHUB_TOKEN is NOT available"
28+
exit 1
29+
else
30+
echo "GITHUB_TOKEN is available"
31+
fi
32+
33+
- name: Log in to GitHub Container Registry
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Verify Google Client ID Secret
41+
run: |
42+
if [ -z "${{ secrets.GOOGLE_CLIENT_ID }}" ]; then
43+
echo "GOOGLE_CLIENT_ID secret is NOT available"
44+
exit 1
45+
fi
46+
47+
- name: Build and push Clients image
48+
uses: docker/build-push-action@v4
49+
with:
50+
context: ./Clients
51+
platforms: linux/amd64,linux/arm64
52+
push: true
53+
tags: |
54+
ghcr.io/${{ github.repository_owner }}/verifywise-frontend-saas:test
55+
build-args: |
56+
VITE_GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}
57+
58+
- name: Build and push Servers image
59+
uses: docker/build-push-action@v4
60+
with:
61+
context: ./Servers
62+
platforms: linux/amd64,linux/arm64
63+
push: true
64+
tags: |
65+
ghcr.io/${{ github.repository_owner }}/verifywise-backend-saas:test
66+
67+
- name: Build and push BiasAndFairnessServers image
68+
uses: docker/build-push-action@v4
69+
with:
70+
context: ./BiasAndFairnessServers
71+
platforms: linux/amd64,linux/arm64
72+
push: true
73+
tags: |
74+
ghcr.io/${{ github.repository_owner }}/verifywise-bias-and-fairness-backend-saas:test
75+
76+
- name: Deploy to Testing
77+
uses: appleboy/ssh-action@v0.1.5
78+
with:
79+
host: ${{ secrets.TEST_HOST }}
80+
username: ${{ secrets.TEST_USER }}
81+
key: ${{ secrets.TEST_SSH_KEY }}
82+
script: |
83+
cd /root/verifywise
84+
docker-compose --env-file .env.prod down
85+
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.ID}}" | grep -v -E "(redis|postgres)" | awk 'NR>1 {print $2}' | xargs -r docker rmi -f || true
86+
./install.sh

.github/workflows/docker-image-saas.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
build-and-push:
99
if: ${{ endsWith(github.event.release.tag_name, '-saas') }}
1010
runs-on: ubuntu-latest
11+
environment: Build
1112

1213
env:
1314
FULL_TAG: ${{ github.event.release.tag_name }}
@@ -45,6 +46,13 @@ jobs:
4546
username: ${{ github.actor }}
4647
password: ${{ secrets.GITHUB_TOKEN }}
4748

49+
- name: Verify Google Client ID Secret
50+
run: |
51+
if [ -z "${{ secrets.GOOGLE_CLIENT_ID }}" ]; then
52+
echo "GOOGLE_CLIENT_ID secret is NOT available"
53+
exit 1
54+
fi
55+
4856
- name: Build and push Clients image
4957
uses: docker/build-push-action@v4
5058
with:
@@ -54,6 +62,8 @@ jobs:
5462
tags: |
5563
ghcr.io/${{ github.repository_owner }}/verifywise-frontend-saas:${{ env.TAG }}
5664
ghcr.io/${{ github.repository_owner }}/verifywise-frontend-saas:latest
65+
build-args: |
66+
VITE_GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}
5767
5868
- name: Build and push Servers image
5969
uses: docker/build-push-action@v4
@@ -74,3 +84,15 @@ jobs:
7484
tags: |
7585
ghcr.io/${{ github.repository_owner }}/verifywise-bias-and-fairness-backend-saas:${{ env.TAG }}
7686
ghcr.io/${{ github.repository_owner }}/verifywise-bias-and-fairness-backend-saas:latest
87+
88+
- name: Deploy to Production
89+
uses: appleboy/ssh-action@v0.1.5
90+
with:
91+
host: ${{ secrets.PROD_HOST }}
92+
username: ${{ secrets.PROD_USER }}
93+
key: ${{ secrets.PROD_SSH_KEY }}
94+
script: |
95+
cd /root/verifywise
96+
docker-compose --env-file .env.prod down
97+
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.ID}}" | grep -v -E "(redis|postgres)" | awk 'NR>1 {print $2}' | xargs -r docker rmi -f || true
98+
./install.sh

Clients/Dockerfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,27 @@ RUN npm install
1313
# Step 5: Copy the rest of the application files
1414
COPY . .
1515

16-
# Step 6: Build the application
16+
# Step 6: Accept env variables for Vite
17+
ARG VITE_GOOGLE_CLIENT_ID
18+
ENV VITE_GOOGLE_CLIENT_ID=$VITE_GOOGLE_CLIENT_ID
19+
20+
# Step 7: Build the application
1721
RUN npm run build
1822

19-
# Step 7: Use a lightweight web server for production
23+
# Step 8: Use a lightweight web server for production
2024
FROM nginx:1.25-alpine
2125

22-
# Step 8: Copy the build output to NGINX's default public directory
26+
# Step 9: Copy the build output to NGINX's default public directory
2327
COPY --from=build /app/dist /usr/share/nginx/html
2428

25-
# Step 9: Copy the custom NGINX configuration
29+
# Step 9: Copy the custom error page
30+
# COPY upgrade.html /usr/share/nginx/html/upgrade.html
31+
32+
# Step 10: Copy the custom NGINX configuration
2633
COPY nginx.conf /etc/nginx/conf.d/default.conf
2734

28-
# Step 10: Expose port 80
35+
# Step 11: Expose port 80
2936
EXPOSE 80
3037

31-
# Step 11: Start NGINX server
38+
# Step 12: Start NGINX server
3239
CMD ["nginx", "-g", "daemon off;"]

Clients/env.vars.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ export const ENV_VARs = {
44
(typeof window !== "undefined" // only run in browser
55
? `${window.location.protocol}//${window.location.hostname}${
66
window.location.protocol === "https:" ? "" : ":3000"
7-
}` // use current URL if not set
7+
}` // use current URL if not set
88
: "http://localhost:3000/"), // final Node/SSR fallback
99
IS_DEMO_APP: import.meta.env.VITE_IS_DEMO_APP === "true",
1010
IS_MULTI_TENANT: import.meta.env.VITE_IS_MULTI_TENANT === "true",
11+
GOOGLE_CLIENT_ID: import.meta.env.VITE_GOOGLE_CLIENT_ID ?? "",
1112
};

Clients/nginx.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ server {
99
}
1010

1111
error_page 404 /index.html;
12+
# error_page 502 503 504 /upgrade.html;
1213

1314
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|map)$ {
1415
expires max;

0 commit comments

Comments
 (0)