diff --git a/.env.example b/.env.example index 1f4b295..fe6a86b 100644 --- a/.env.example +++ b/.env.example @@ -6,7 +6,7 @@ POSTGRES_DIRECT_URL= AUTH= AUTH_TRUST_HOST= AUTH_SECRET= -NEXTAUTH_URL= +AUTH_URL= DRIVE_CLIENT_ID= DRIVE_CLIENT_SECRET= \ No newline at end of file diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 0f0237a..ecaa832 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -12,7 +12,7 @@ jobs: SQLITE_URL: file:./prisma/dev.db DB: sqlite AUTH_SECRET: test-secret - NEXTAUTH_URL: http://localhost:3000 + AUTH_URL: http://localhost:3000 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4daee35..d53a9d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [0.1.27] - 2025-10-31 + +### PR: [Dev](https://github.com/openchatui/openchat/pull/98) + +### Changed +- Standardize environment variable from NEXTAUTH_URL to AUTH_URL across code, config, CI, and docs to align with Auth.js and simplify setup. (https://github.com/openchatui/openchat/commit/8268c21ec9561750b8fe638d8d97d7ace0fc1850) +- Set SQLite path in Dockerfile to /app/data/openchat.db to persist data in a mounted volume and avoid stage inconsistencies. (https://github.com/openchatui/openchat/commit/16c20992b076e39e244584e87d57aa64600546fe) +- Update docker-compose to reference SQLITE_URL=file:/app/prisma/dev.db and remove the unused prisma volume for a cleaner default. (https://github.com/openchatui/openchat/commit/1ecf4aa49e33441c0621b413ab24f7c3e4dabbf2) + ## [0.1.26] - 2025-10-31 ### PR: [dev to main: update apple icon and workflows ](https://github.com/openchatui/openchat/pull/91) diff --git a/Dockerfile b/Dockerfile index c3b4458..f1fab34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN pnpm install --frozen-lockfile COPY prisma ./prisma # Generate Prisma Client early so it is cached with node_modules ENV DB=sqlite -ENV SQLITE_URL=file:./prisma/dev.db +ENV SQLITE_URL=file:/app/data/openchat.db RUN pnpm exec prisma generate --schema prisma/schema.sqlite.prisma FROM base AS builder @@ -23,7 +23,7 @@ COPY --from=deps /app/node_modules ./node_modules COPY . . # Set build-time env vars so Next.js static generation doesn't fail ENV DB=sqlite -ENV SQLITE_URL=file:./dev.db +ENV SQLITE_URL=file:/app/data/openchat.db ENV AUTH_SECRET=build-time-secret-will-be-overridden ENV AUTH_URL=http://localhost:3000 # Build Next.js @@ -35,7 +35,7 @@ ENV NODE_ENV=production ENV PORT=3000 ENV HOSTNAME=0.0.0.0 ENV DB=sqlite -ENV SQLITE_URL=file:./dev.db +ENV SQLITE_URL=file:/app/data/openchat.db ENV AUTH_TRUST_HOST=true ENV AUTH_URL=http://localhost:3000 ENV AUTH=true diff --git a/README.md b/README.md index 3108083..d8b5cea 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Pull and run with defaults (port 3000 inside the container): docker pull ghcr.io/openchatui/openchatui:latest docker run --name openchat \ -p 3000:3000 \ - -e NEXTAUTH_URL="http://localhost:3000" \ + -e AUTH_URL="http://localhost:3000" \ -e AUTH_SECRET="$(openssl rand -base64 32)" \ -v "$(pwd)/data/prisma:/prisma" \ --restart unless-stopped \ @@ -74,7 +74,7 @@ Examples: ```bash docker run \ -p 3000:3000 \ - -e NEXTAUTH_URL="http://localhost:3000" \ + -e AUTH_URL="http://localhost:3000" \ -e AUTH_SECRET="$(openssl rand -base64 32)" \ -e AUTH=false \ -v "$(pwd)/data/prisma:/prisma" \ @@ -108,7 +108,7 @@ docker compose down ``` > [!TIP] -> - Change the external port by editing `ports` and the internal app port by `environment: PORT` and `NEXTAUTH_URL`. +> - Change the external port by editing `ports` and the internal app port by `environment: PORT` and `AUTH_URL`. > - Persist data: by default `./prisma:/prisma` stores the SQLite database on the host. > - Switch to PostgreSQL: set `DB=postgres` and provide `DATABASE_URL` in `environment`. You can add a separate Postgres service if needed. diff --git a/docker-compose.yml b/docker-compose.yml index 6cc39e5..ad06c1d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: AUTH: "true" DEBUG_AUTH: "true" # DB: "sqlite" - # SQLITE_URL: "file:./dev.db" + # SQLITE_URL: "file:/app/prisma/dev.db" # DATABASE_URL: "postgresql://user:pass@host/db" # NODE_ENV: "production" # OPENAI_API_KEY: "sk-..." @@ -24,7 +24,6 @@ services: # DRIVE_CLIENT_ID: "your-google-client-id" # DRIVE_CLIENT_SECRET: "your-google-client-secret" volumes: - - ./prisma:/prisma - ./data:/app/data - ./public/profiles:/app/public/profiles restart: unless-stopped diff --git a/lib/api/http.ts b/lib/api/http.ts index dbe0b1f..53e064c 100644 --- a/lib/api/http.ts +++ b/lib/api/http.ts @@ -59,7 +59,7 @@ export async function httpFetch(input: RequestInfo, init?: RequestInit): Promise // When behind a reverse proxy, forward the external host for Auth.js validation // Auth.js with trustHost:true will validate against these headers - const externalUrl = process.env.AUTH_URL || process.env.NEXTAUTH_URL + const externalUrl = process.env.AUTH_URL if (externalUrl) { try { const url = new URL(externalUrl) diff --git a/lib/modules/drive/providers/google-drive.service.ts b/lib/modules/drive/providers/google-drive.service.ts index 9e5e919..bff608f 100644 --- a/lib/modules/drive/providers/google-drive.service.ts +++ b/lib/modules/drive/providers/google-drive.service.ts @@ -32,7 +32,7 @@ async function getUserAccount(userId: string) { function getOAuthClient() { const clientId = process.env.DRIVE_CLIENT_ID const clientSecret = process.env.DRIVE_CLIENT_SECRET - const redirectUri = process.env.NEXTAUTH_URL+'/api/auth/callback/google-drive' + const redirectUri = process.env.AUTH_URL+'/api/auth/callback/google-drive' if (!clientId || !clientSecret) { return new google.auth.OAuth2() } diff --git a/package.json b/package.json index 3f2bd1c..425e5e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openchatui", - "version": "0.1.26", + "version": "0.1.27", "private": true, "scripts": { "dev": "next dev --turbopack",