Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions apps/CineMatch/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# TMDB API Configuration
NEXT_PUBLIC_TMDB_ACCESS_TOKEN=eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJkY2VmNjllZmU2YzBkZjcxOTkwNTZhNWM3OTU5OTkxMyIsIm5iZiI6MTc2Mzg0NDMzNy41NjQsInN1YiI6IjY5MjIyMGYxNzkxMjYxOTRlMWI3NDM1YSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.1IxRDR-05bK8HDVSDpj6Lt_2-0Fjz9W6eLYylsV9N_Q

# AI/LLM Configuration (for natural language processing)
OPENAI_API_KEY=
GOOGLE_AI_API_KEY=AIzaSyBwkmqOt_Wr-9nh43RFKEC3_r-rB96uBlE
GOOGLE_GENERATIVE_AI_API_KEY=AIzaSyBwkmqOt_Wr-9nh43RFKEC3_r-rB96uBlE
# RuVector Configuration (embedded vector database)
# Storage path for persistent vector database (defaults to ./data/media-vectors.db)
RUVECTOR_STORAGE_PATH=./data/media-vectors.db

# GCP Configuration
GCP_PROJECT_ID=
GCP_REGION=us-

# Database (Firestore)
FIRESTORE_PROJECT_ID=

# Feature Flags
ENABLE_PREFERENCE_LEARNING=true
ENABLE_ARW_DISCOVERY=true
51 changes: 51 additions & 0 deletions apps/CineMatch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Multi-stage build for CineMatch Platform
# Optimized for Google Cloud Run deployment

# Stage 1: Dependencies
FROM node:20-alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Copy package files
COPY package.json package-lock.json* ./
RUN npm ci --only=production

# Stage 2: Builder
FROM node:20-alpine AS builder
WORKDIR /app

# Copy dependencies
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Set environment for build
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV production

# Build the application
RUN npm run build

# Stage 3: Runner
FROM node:20-alpine AS runner
WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

# Create non-root user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# Copy built application
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

# Cloud Run uses PORT environment variable
EXPOSE 8080
ENV PORT 8080
ENV HOSTNAME "0.0.0.0"

CMD ["node", "server.js"]
23 changes: 23 additions & 0 deletions apps/CineMatch/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Makefile for Movie Match App

.PHONY: run install build lint test

# Default target
run:
npm run dev

# Install dependencies
install:
npm install

# Build for production
build:
npm run build

# Lint code
lint:
npm run lint

# Run tests
test:
npm run test
59 changes: 59 additions & 0 deletions apps/CineMatch/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Google Cloud Build configuration
# Builds and deploys the Media Discovery Platform to Cloud Run

steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/media-discovery:$COMMIT_SHA'
- '-t'
- 'gcr.io/$PROJECT_ID/media-discovery:latest'
- '.'

# Push to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/media-discovery:$COMMIT_SHA'

- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'gcr.io/$PROJECT_ID/media-discovery:latest'

# Deploy to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'run'
- 'deploy'
- 'media-discovery'
- '--image'
- 'gcr.io/$PROJECT_ID/media-discovery:$COMMIT_SHA'
- '--region'
- '${_REGION}'
- '--platform'
- 'managed'
- '--allow-unauthenticated'
- '--memory'
- '1Gi'
- '--cpu'
- '2'
- '--min-instances'
- '0'
- '--max-instances'
- '10'
- '--set-env-vars'
- 'NODE_ENV=production'

substitutions:
_REGION: us-central1

options:
logging: CLOUD_LOGGING_ONLY

images:
- 'gcr.io/$PROJECT_ID/media-discovery:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/media-discovery:latest'
88 changes: 88 additions & 0 deletions apps/CineMatch/cloudrun.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Cloud Run service configuration
# Media Discovery Platform - Production deployment

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: media-discovery
labels:
app: media-discovery
version: v1
annotations:
run.googleapis.com/description: "AI-native media discovery platform with natural language search"
run.googleapis.com/ingress: all
spec:
template:
metadata:
annotations:
# Performance optimizations
run.googleapis.com/startup-cpu-boost: "true"
run.googleapis.com/cpu-throttling: "false"
run.googleapis.com/execution-environment: gen2

# Scaling configuration
autoscaling.knative.dev/minScale: "0"
autoscaling.knative.dev/maxScale: "20"

# Request handling
run.googleapis.com/container-dependencies: "{}"

spec:
containerConcurrency: 80
timeoutSeconds: 300

containers:
- image: gcr.io/PROJECT_ID/media-discovery:latest
ports:
- containerPort: 8080

resources:
limits:
cpu: "2"
memory: "2Gi"

env:
- name: NODE_ENV
value: "production"
- name: NEXT_TELEMETRY_DISABLED
value: "1"

# TMDB API (from Secret Manager)
- name: NEXT_PUBLIC_TMDB_ACCESS_TOKEN
valueFrom:
secretKeyRef:
name: tmdb-access-token
key: latest

# OpenAI API (from Secret Manager)
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: openai-api-key
key: latest

# RuVector endpoint
- name: RUVECTOR_ENDPOINT
value: "https://ruvector-SERVICE_ID.run.app"

# Health checks
startupProbe:
httpGet:
path: /api/health
port: 8080
initialDelaySeconds: 0
periodSeconds: 2
timeoutSeconds: 2
failureThreshold: 30

livenessProbe:
httpGet:
path: /api/health
port: 8080
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3

traffic:
- percent: 100
latestRevision: true
Loading