From 4e2768b7f969ed27746757c8fcfa394be163458f Mon Sep 17 00:00:00 2001 From: Riley Windsor Date: Wed, 13 Nov 2024 19:22:47 -0500 Subject: [PATCH 1/9] fix things --- apps/frontend/auth.ts | 4 ++-- apps/frontend/lib/mongodb.ts | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/frontend/auth.ts b/apps/frontend/auth.ts index d60800c8..57821cac 100644 --- a/apps/frontend/auth.ts +++ b/apps/frontend/auth.ts @@ -1,12 +1,12 @@ import { MongoDBAdapter } from "@auth/mongodb-adapter"; import NextAuth from "next-auth"; import GitHub from "next-auth/providers/github"; -import Keycloak from "next-auth/providers/keycloak"; +// import Keycloak from "next-auth/providers/keycloak"; import clientPromise from "./lib/mongodb" export const { handlers, signIn, signOut, auth } = NextAuth({ adapter: MongoDBAdapter(clientPromise, {databaseName: 'gladosdb'}), - providers: [GitHub, Keycloak], + providers: [GitHub], //Add Keycloak here to do local testing callbacks: { authorized: async ({ auth }) => { // Logged in users are authenticated, otherwise redirect to login page diff --git a/apps/frontend/lib/mongodb.ts b/apps/frontend/lib/mongodb.ts index 7b4e2942..f4d5f8df 100644 --- a/apps/frontend/lib/mongodb.ts +++ b/apps/frontend/lib/mongodb.ts @@ -4,12 +4,11 @@ import { getEnvVar } from '../utils/env'; // Adapted from https://github.com/vercel/next.js/tree/canary/examples/with-mongodb -// const MONGODB_PORT = getEnvVar('MONGODB_PORT'); -// const USERNAME = getEnvVar('MONGODB_USERNAME'); -// const PASSWORD = getEnvVar('MONGODB_PASSWORD'); +const MONGODB_PORT = getEnvVar('MONGODB_PORT'); +const USERNAME = getEnvVar('MONGODB_USERNAME'); +const PASSWORD = getEnvVar('MONGODB_PASSWORD'); -// const MONGODB_URI = `mongodb://${USERNAME}:${PASSWORD}@glados-service-mongodb:${MONGODB_PORT}`; -const MONGODB_URI = 'mongodb://root:password123@137.112.104.86:30000/?directConnection=true'; +const MONGODB_URI = `mongodb://${USERNAME}:${PASSWORD}@glados-service-mongodb:${MONGODB_PORT}`; const MONGODB_OPTIONS = {}; export const DB_NAME = 'gladosdb'; From d2700ed04749d2f6236b45230fc7cf44165acde6 Mon Sep 17 00:00:00 2001 From: Riley Windsor Date: Wed, 13 Nov 2024 19:27:14 -0500 Subject: [PATCH 2/9] Update frontend.Dockerfile --- apps/frontend/frontend.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/frontend/frontend.Dockerfile b/apps/frontend/frontend.Dockerfile index efddc60e..20c37f06 100644 --- a/apps/frontend/frontend.Dockerfile +++ b/apps/frontend/frontend.Dockerfile @@ -17,7 +17,7 @@ FROM node:20-alpine AS base FROM base AS deps RUN apk add --no-cache bash libc6-compat - +WORKDIR /app COPY package.json ./ From 7869cee9a8e5ddedd3f54e629d4c1653278ed28a Mon Sep 17 00:00:00 2001 From: Riley Windsor Date: Wed, 13 Nov 2024 19:52:54 -0500 Subject: [PATCH 3/9] remove google and twitter sign in for now --- apps/frontend/app/components/auth/SignUpModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/frontend/app/components/auth/SignUpModal.tsx b/apps/frontend/app/components/auth/SignUpModal.tsx index 1a0d4bd2..5ceae1ee 100644 --- a/apps/frontend/app/components/auth/SignUpModal.tsx +++ b/apps/frontend/app/components/auth/SignUpModal.tsx @@ -42,7 +42,7 @@ export const SignUpModal = ({ afterSignUp }) => {

-
+ {/*
{ -
+
*/}
Date: Wed, 13 Nov 2024 19:56:13 -0500 Subject: [PATCH 4/9] Update ProtectedRoute.tsx --- apps/frontend/app/components/auth/ProtectedRoute.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/frontend/app/components/auth/ProtectedRoute.tsx b/apps/frontend/app/components/auth/ProtectedRoute.tsx index 7db25976..e9aaa950 100644 --- a/apps/frontend/app/components/auth/ProtectedRoute.tsx +++ b/apps/frontend/app/components/auth/ProtectedRoute.tsx @@ -9,8 +9,8 @@ const ProtectedRoute = ({ children }) => { const router = useRouter(); useEffect(() => { if (session.status != "loading" && !session.data?.user) { - console.log('User is not signed in; redirecting them to /signin'); - router.push('/signin'); + console.log('User is not signed in; redirecting them to landing page'); + router.push('/'); } }, [!session.data?.user, router, session.status]); From a4a5125b1c71c4a94764184feb03dd54e9b92298 Mon Sep 17 00:00:00 2001 From: Riley Windsor Date: Wed, 13 Nov 2024 20:05:18 -0500 Subject: [PATCH 5/9] add google signin --- apps/frontend/app/components/auth/SignUpModal.tsx | 5 +++-- apps/frontend/auth.ts | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/frontend/app/components/auth/SignUpModal.tsx b/apps/frontend/app/components/auth/SignUpModal.tsx index 5ceae1ee..ce51eddb 100644 --- a/apps/frontend/app/components/auth/SignUpModal.tsx +++ b/apps/frontend/app/components/auth/SignUpModal.tsx @@ -42,10 +42,11 @@ export const SignUpModal = ({ afterSignUp }) => {

- {/*
+ -
+ {/*
{ // Logged in users are authenticated, otherwise redirect to login page From 9981225c7beb595a1c1a3674f41eed5db449ee50 Mon Sep 17 00:00:00 2001 From: Riley Windsor Date: Wed, 13 Nov 2024 20:22:44 -0500 Subject: [PATCH 6/9] update deployments to remove firebase --- .../backend/deployment-backend.yaml | 10 ---------- .../frontend/deployment-frontend.yaml | 20 +++++++++---------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/kubernetes_init/backend/deployment-backend.yaml b/kubernetes_init/backend/deployment-backend.yaml index bffaff8e..450eeef8 100644 --- a/kubernetes_init/backend/deployment-backend.yaml +++ b/kubernetes_init/backend/deployment-backend.yaml @@ -33,16 +33,6 @@ spec: secretKeyRef: name: secret-env key: MONGODB_PORT - - name: SERVICE_ROLE_KEY - valueFrom: - secretKeyRef: - name: secret-env - key: SERVICE_ROLE_KEY - - name: FIREBASE_KEY - valueFrom: - secretKeyRef: - name: secret-env - key: FIREBASE_KEY - name: MONGODB_USERNAME valueFrom: secretKeyRef: diff --git a/kubernetes_init/frontend/deployment-frontend.yaml b/kubernetes_init/frontend/deployment-frontend.yaml index 8265d858..46e9696f 100644 --- a/kubernetes_init/frontend/deployment-frontend.yaml +++ b/kubernetes_init/frontend/deployment-frontend.yaml @@ -38,16 +38,6 @@ spec: secretKeyRef: name: secret-env key: MONGODB_PORT - - name: SERVICE_ROLE_KEY - valueFrom: - secretKeyRef: - name: secret-env - key: SERVICE_ROLE_KEY - - name: FIREBASE_KEY - valueFrom: - secretKeyRef: - name: secret-env - key: FIREBASE_KEY - name: MONGODB_USERNAME valueFrom: secretKeyRef: @@ -73,6 +63,16 @@ spec: secretKeyRef: name: secret-env key: AUTH_GITHUB_SECRET + - name: AUTH_GOOGLE_ID + valueFrom: + secretKeyRef: + name: secret-env + key: AUTH_GOOGLE_ID + - name: AUTH_GOOGLE_SECRET + valueFrom: + secretKeyRef: + name: secret-env + key: AUTH_GOOGLE_SECRET - name: AUTH_TRUST_HOST valueFrom: secretKeyRef: From c26cd705951d96ecc890f0a3385bd1d423620c53 Mon Sep 17 00:00:00 2001 From: Riley Windsor Date: Wed, 13 Nov 2024 20:23:26 -0500 Subject: [PATCH 7/9] remove firebase --- apps/backend/job-runner.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/apps/backend/job-runner.yaml b/apps/backend/job-runner.yaml index cbd45305..a27a34f4 100644 --- a/apps/backend/job-runner.yaml +++ b/apps/backend/job-runner.yaml @@ -19,16 +19,6 @@ spec: secretKeyRef: name: secret-env key: MONGODB_PORT - - name: SERVICE_ROLE_KEY - valueFrom: - secretKeyRef: - name: secret-env - key: SERVICE_ROLE_KEY - - name: FIREBASE_KEY - valueFrom: - secretKeyRef: - name: secret-env - key: FIREBASE_KEY - name: MONGODB_USERNAME valueFrom: secretKeyRef: From 92f40611d7a6c890462999a72b9937df0b8a811a Mon Sep 17 00:00:00 2001 From: Riley Windsor Date: Wed, 13 Nov 2024 20:28:47 -0500 Subject: [PATCH 8/9] Update runner.py --- apps/runner/runner.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/apps/runner/runner.py b/apps/runner/runner.py index 32c70981..777f9b58 100644 --- a/apps/runner/runner.py +++ b/apps/runner/runner.py @@ -9,9 +9,6 @@ import base64 import requests -import firebase_admin -from firebase_admin import credentials -from firebase_admin import firestore, storage from bson.binary import Binary from modules.data.types import DocumentId, IncomingStartRequest @@ -31,7 +28,6 @@ logging.error("Failed to import the 'magic' package, you're probably missing a system level dependency") sys.exit(1) -ENV_FIREBASE_CREDENTIALS = "FIREBASE_KEY" DB_COLLECTION_EXPERIMENTS = "Experiments" # set up logger @@ -39,9 +35,6 @@ syslogger = logging.getLogger(SYSTEM_LOGGER) explogger = logging.getLogger(EXPERIMENT_LOGGER) -firebaseCredentials = credentials.Certificate(json.loads(_get_env(ENV_FIREBASE_CREDENTIALS))) -firebaseApp = firebase_admin.initialize_app(firebaseCredentials) -firebaseDb = firestore.client() syslogger.info("GLADOS Runner Started") @@ -87,7 +80,7 @@ def run_batch(data: IncomingStartRequest): except Exception as err: # pylint: disable=broad-exception-caught - explogger.error("Error retrieving experiment data from firebase, aborting") + explogger.error("Error retrieving experiment data from mongo, aborting") explogger.exception(err) close_experiment_run(exp_id) return From fcc68725ea72c5ffbf9d74edda2fb19ff62ae077 Mon Sep 17 00:00:00 2001 From: Riley Windsor Date: Wed, 13 Nov 2024 20:33:22 -0500 Subject: [PATCH 9/9] use dev runner --- apps/backend/job-runner.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/backend/job-runner.yaml b/apps/backend/job-runner.yaml index a27a34f4..52585d6d 100644 --- a/apps/backend/job-runner.yaml +++ b/apps/backend/job-runner.yaml @@ -10,7 +10,7 @@ spec: spec: containers: - name: runner - image: gladospipeline/glados-runner:main + image: gladospipeline/glados-runner:development imagePullPolicy: Always command: [] env: