bitswired / fuseai

Self-Hosted and Open-Source web app to interact with OpenAI APIs. Currently supports ChatGPT, but DALLE and Whisper support is coming.
290 stars 44 forks source link

secret missing in docker image. #31

Open P6g9YHK6 opened 1 year ago

P6g9YHK6 commented 1 year ago

the new docker image produce this error on my side:

[next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'yarn add sharp', and Next.js will use it automatically for Image Optimization. Read more: https://nextjs.org/docs/messages/sharp-missing-in-production [next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret Please define a secret in production. MissingSecret [MissingSecretError]: Please define a secret in production. at assertConfig (/app/node_modules/next-auth/core/lib/assert.js:42:12) at AuthHandler (/app/node_modules/next-auth/core/index.js:70:52) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async NextAuthHandler (/app/node_modules/next-auth/next/index.js:24:19) at async /app/node_modules/next-auth/next/index.js:60:32 at async Object.apiResolver (/app/node_modules/next/dist/server/api-utils/node.js:372:9) at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:514:9) at async Object.fn (/app/node_modules/next/dist/server/next-server.js:828:35) at async Router.execute (/app/node_modules/next/dist/server/router.js:243:32) at async NextNodeServer.runImpl (/app/node_modules/next/dist/server/base-server.js:432:29) { code: 'NO_SECRET' } [next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret [next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret [next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret [next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret Please define a secret in production. MissingSecret [MissingSecretError]: Please define a secret in production.

thomasWos commented 1 year ago
docker run -p 3000:3000 -e NEXTAUTH_SECRET=<random strong password> docker.io/bitswired/ai-chat-app

But then I'm stuck after sign in

Screenshot 2023-03-19 at 12 35 18 pm
jimzer commented 1 year ago

Hi guys,

With the new version you need to run the Docker image with environment variables as follows:

docker run -p 3000:3000 --env-file=.env aichatapp

Inside the .env file you need the following variables for the single user setup:

 DATABASE_URL="file:./db.sqlite"
NEXTAUTH_SECRET="secret"
NEXTAUTH_URL="http://localhost:3000"

ADMIN_EMAIL=admin@admin.com
ADMIN_PASSWORD=password

For the multi-user setup:

DATABASE_URL="file:./db.sqlite"
NEXTAUTH_SECRET="secret"
NEXTAUTH_URL="http://localhost:3000"

ADMIN_EMAIL=admin@admin.com

NEXT_PUBLIC_MULTI_USER=1
EMAIL_SERVER_HOST=smtp.gmail.com
EMAIL_SERVER_PORT=465
EMAIL_SERVER_USER=user@gmail.com
EMAIL_SERVER_PASSWORD=password
EMAIL_FROM=ai-chat-app@ai-chat-app.com

If you use the single-user setup, it uses the ADMIN_EMAIL and ADMIN_PASSWORD for login.

Otherwise, it uses password-less authentication.

Does it solves your issue?

thomasWos commented 1 year ago

Thanks for that. For some reasons... the URL with double quotes doesn't work . Using DATABASE_URL=file:./db.sqlite instead of DATABASE_URL="file:./db.sqlite" fixes the problem.

But then, same result, I cannot login, the page stays blocked on Sign In

jimzer commented 1 year ago

@thomasWos

Could you try this exact command? It's the one I use, and it works for me. It''s for the single user setup.

docker run -p 3000:3000 \
  -e DATABASE_URL=file:./db.sqlite \
  -e NEXTAUTH_SECRET=secret \
  -e NEXTAUTH_URL=http://localhost:3000/ \
  -e ADMIN_EMAIL=admin@admin.com \
  -e ADMIN_PASSWORD=password \
  bitswired/ai-chat-app:single-user-latest

Then you should be able to log in with:

thomasWos commented 1 year ago

It works with this exact command. I can login, thanks!

jimzer commented 1 year ago

I'm glad it works for you now @thomasWos :)

thomasWos commented 1 year ago

yeah it works! still have no chat output, but that's another issue.