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/connor/local redis #14

Merged
merged 42 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a863589
feat: add dev environment
cdirks4 Jan 20, 2025
5072cd0
fix: mainly adding openssl for db
cdirks4 Jan 21, 2025
0ce1fc5
WIP: made a large accidental deletion will likely buggy
cdirks4 Jan 21, 2025
ed8ad25
fix: add demo audio for all
cdirks4 Jan 21, 2025
b1fd613
feat: update chat ui to be draggable
cdirks4 Jan 21, 2025
e67e250
fix: package lock updates next
cdirks4 Jan 21, 2025
1b9ee86
feat: redis caching notebooks and chats
cdirks4 Jan 21, 2025
0f09956
feat: google drive docs can be selected
cdirks4 Jan 22, 2025
fb26bcb
build: local redis + migrate on entry
cdirks4 Jan 27, 2025
0636497
QOL: docker cleanup redis test
cdirks4 Jan 27, 2025
17e9509
feat: redis initialization + remove dupe notebooks
cdirks4 Jan 27, 2025
426dcc9
build: fix deps
cdirks4 Jan 28, 2025
e3fbab6
fix: update redis initialization to match vlads change
cdirks4 Jan 28, 2025
7e03497
fix: missed a redis usage location
cdirks4 Jan 28, 2025
c8162f8
fix: redis used on server
cdirks4 Jan 28, 2025
b54e943
fix: remove unused notebook layout
cdirks4 Jan 28, 2025
2c56d0d
build: ignore linting from next
cdirks4 Jan 28, 2025
6a89751
fix: user fake user dont hardcode
cdirks4 Jan 28, 2025
13acbc3
fix: clean up
cdirks4 Jan 29, 2025
2e74253
fix: make sure to use both db and redis
cdirks4 Jan 29, 2025
d4e81a9
feat: add dev environment
cdirks4 Jan 20, 2025
974c323
fix: mainly adding openssl for db
cdirks4 Jan 21, 2025
1bfed57
WIP: made a large accidental deletion will likely buggy
cdirks4 Jan 21, 2025
10afde1
fix: add demo audio for all
cdirks4 Jan 21, 2025
a8a771b
feat: update chat ui to be draggable
cdirks4 Jan 21, 2025
53ecd6b
fix: package lock updates next
cdirks4 Jan 21, 2025
e498d18
feat: redis caching notebooks and chats
cdirks4 Jan 21, 2025
64e2931
feat: google drive docs can be selected
cdirks4 Jan 22, 2025
c547a6b
build: local redis + migrate on entry
cdirks4 Jan 27, 2025
d739006
QOL: docker cleanup redis test
cdirks4 Jan 27, 2025
ae6ff16
feat: redis initialization + remove dupe notebooks
cdirks4 Jan 27, 2025
076b8bd
build: fix deps
cdirks4 Jan 28, 2025
446bf1d
fix: update redis initialization to match vlads change
cdirks4 Jan 28, 2025
53feaa8
fix: missed a redis usage location
cdirks4 Jan 28, 2025
df180ff
fix: redis used on server
cdirks4 Jan 28, 2025
9fa761f
fix: remove unused notebook layout
cdirks4 Jan 28, 2025
16a4b98
build: ignore linting from next
cdirks4 Jan 28, 2025
7d0847c
fix: user fake user dont hardcode
cdirks4 Jan 28, 2025
90c55ba
fix: clean up
cdirks4 Jan 29, 2025
66e2f04
fix: make sure to use both db and redis
cdirks4 Jan 29, 2025
74c04e1
Merge branch 'feat/connor/local-redis' of github.com:open-biz/OpenBoo…
cdirks4 Jan 29, 2025
9cf66de
Merge branch 'main' into feat/connor/local-redis
VDuda Feb 5, 2025
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
28 changes: 19 additions & 9 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,44 +1,54 @@
# Version control

.git
.gitignore

# Dependencies

node_modules
.next

# Environment files

.env
.env.*
.env.\*

# Documentation

README.md

# Docker files

.dockerignore
Dockerfile
docker-compose.yml

# Logs
*.log

\*.log

# Python virtual environment

venv/
__pycache__/
*.pyc
*.pyo
*.pyd
**pycache**/
_.pyc
_.pyo
\*.pyd

# OS files

.DS_Store
Thumbs.db

# Build artifacts

dist/
build/
*.tsbuildinfo
\*.tsbuildinfo

# Development files

.vscode/
.idea/
*.swp
*.swo
_.swp
_.swo
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ RUN apt-get update && \
apt-get install -y openssl python3 make g++

# Copy package files
COPY package.json pnpm-lock.yaml* ./
COPY package.json ./
COPY pnpm-lock.yaml ./
COPY prisma ./prisma/

# Install dependencies
RUN pnpm install
# Clean install dependencies
RUN pnpm install --frozen-lockfile

# Development image
FROM base AS development
Expand All @@ -33,10 +34,13 @@ COPY . .
# Generate Prisma Client for development
RUN npx prisma generate

COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Expose port
EXPOSE 3000

# Start development server
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["pnpm", "dev"]

# Rebuild the source code only when needed
Expand Down
40 changes: 35 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3.8'

services:
app:
platform: linux/arm64/v8
build:
context: .
target: development
Expand All @@ -15,10 +16,9 @@ services:
- REDIS_URL=redis://redis:6379
ports:
- "3000:3000"
- "9229:9229" # For debugging
- "9229:9229"
environment:
- NODE_ENV=development
- DATABASE_URL=${DATABASE_URL}
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=${NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY}
- CLERK_SECRET_KEY=${CLERK_SECRET_KEY}
- CEREBRAS_API_KEY=${CEREBRAS_API_KEY}
Expand All @@ -39,6 +39,7 @@ services:
- redis

db:
platform: linux/arm64/v8
image: postgres:16
ports:
- "5432:5432"
Expand All @@ -48,15 +49,44 @@ services:
- POSTGRES_DB=openbooklm
volumes:
- postgres_data:/var/lib/postgresql/data
deploy:
resources:
limits:
memory: 512M
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5

redis:
image: redis:7-alpine
platform: linux/arm64/v8
image: redis:7
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --save 60 1 --loglevel warning
deploy:
resources:
limits:
memory: 256M
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5

redis-insight:
image: redislabs/redisinsight:latest
platform: linux/arm64/v8 # For M1/M2 Macs
ports:
- "8001:8001"
depends_on:
- redis



volumes:
postgres_data:
redis_data:
redis_data:
13 changes: 13 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
set -e

# Wait for database to be ready
echo "Waiting for database to be ready..."
npx wait-on tcp:db:5432 -t 60000

# Run migrations
echo "Running database migrations..."
npx prisma migrate deploy

# Then run the main container command
exec "$@"
28 changes: 28 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# fly.toml app configuration file generated for openbooklm on 2025-01-20T16:40:22-05:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'openbooklm'
primary_region = 'dfw'

[build]
dockerfile = 'Dockerfile'

[env]
HOSTNAME = '0.0.0.0'
NODE_ENV = 'production'
PORT = '3000'

[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 1
processes = ['app']

[[vm]]
cpu_kind = 'shared'
cpus = 1
memory_mb = 1024
10 changes: 8 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
}
output: "standalone",
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
};

export default nextConfig;
17 changes: 14 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,23 @@
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-slot": "^1.0.2",
"ioredis": "^5.3.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"date-fns": "^4.1.0",
"fns": "^1.0.0",
"googleapis": "^144.0.0",
"ioredis": "^5.4.2",
"lucide-react": "^0.309.0",
"next": "14.0.4",
"next": "14.1.0",
"next-auth": "^4.24.11",
"next-themes": "^0.2.1",
"perf_hooks": "^0.0.1",
"prisma": "^6.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.3.5",
"react-markdown": "^9.0.3",
"sonner": "^1.4.0",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7"
},
Expand All @@ -41,6 +47,11 @@
"eslint-config-next": "14.0.4",
"postcss": "^8.4.33",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3"
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"wait-on": "^8.0.2"
},
"prisma": {
"seed": "npx ts-node --compiler-options '{\"module\":\"CommonJS\"}' prisma/seed.ts"
}
}
Loading
Loading