promptfoo / promptfoo

Test your prompts, agents, and RAGs. Redteaming, pentesting, vulnerability scanning for LLMs. Improve your app's quality and catch problems. Compare performance of GPT, Claude, Gemini, Llama, and more. Simple declarative configs with command line and CI/CD integration.

Home Page:https://www.promptfoo.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploying Promptfoo to Railway

tonimatas1 opened this issue · comments

I've just deployed promptfoo on Railway. I created a volume and my evals are saved and persistant between deploys. But when I access to prompts and datasets there is nothing there.
I've also configured the Share variables, but got an error from Railway when I click share button on UI.
Is there any super savvy guru here who can help me?

Hi @tonimatas1, what's the error when you click the share button in the UI? Are you setting the PROMPTFOO_REMOTE_API_BASE_URL and PROMPTFOO_REMOTE_APP_BASE_URL environment variables locally before running promptfoo view or promptfoo share?

Screenshot 2024-03-28 at 14 49 25 Completely opaque, as you can see.

I think I have issues understanding the path and the folders in Railway deployment and, as the system does everything by itself and I have no access to folders info, I feel completely lost.
The evaluations run fine, and the evals are persistent, but prompts and datasets does not appear in their sections and share yields the error I pasted before.

Anything in the browser console/network tab?

Are you running evals through the web UI, or are you sending them to the server with promptfoo share?

I'm running the evals through the web UI.
I'm not sure what I've changed but now there is not the same error when sharing but the 404 Eval not found.
Again everything is running fine but prompts and datasets are not showing up and evals are persisting when I do a new deployment in Railway so the files should be there.

This is the mount path where I mounted the volume:

Mount Path
Directory that this volume is mounted to in promptfoo
/root/.promptfoo

And these are the environtment variables except OPENAI:
NEXT_PUBLIC_PROMPTFOO_REMOTE_API_BASE_URL=https://promptfoo.up.railway.app
PROMPTFOO_REMOTE_API_BASE_URL=${{RAILWAY_PUBLIC_DOMAIN}}
PROMPTFOO_REMOTE_APP_BASE_URL=${{RAILWAY_PUBLIC_DOMAIN}}
PROMPTFOO_SHARE_STORE_PATH=/root/.promptfoo/share-store
PROMPTFOO_SHARE_STORE_TYPE=filesystem

${{RAILWAY_PUBLIC_DOMAIN}} is promptfoo.up.railway.app

Yes, tons of errors in the browser console:

setup/:1 The resource https://promptfoo.up.railway.app/_next/static/css/87fb00eed311e9cd.css was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally.
api/prompts/:1

   Failed to load resource: the server responded with a status of 404 ()

prompts/:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
api/datasets/:1

   Failed to load resource: the server responded with a status of 404 ()

datasets/:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
api/prompts/:1

   Failed to load resource: the server responded with a status of 404 ()

prompts/:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
api/datasets/:1

   Failed to load resource: the server responded with a status of 404 ()

datasets/:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
api/prompts/:1

   Failed to load resource: the server responded with a status of 404 ()

prompts/:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
api/prompts/:1

   Failed to load resource: the server responded with a status of 404 ()

prompts/:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
api/datasets/:1

   Failed to load resource: the server responded with a status of 404 ()

datasets/:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

As an evirontment variable, you mean?
Yes, it's:
NEXT_PUBLIC_PROMPTFOO_REMOTE_API_BASE_URL=https://promptfoo.up.railway.app

Ok, sorry about that, I understand the issues you're reporting now:

  • The share modal always displays the app.promptfoo.dev prefix, even though it's shared to the local instance (promptfoo.up.railway.app)
  • The self-hosted instance currently doesn't support the prompts and datasets API endpoint

Both are fairly easy fixes that can be prioritized. I'll keep this issue open and let you know once the fixes are in!

That sounds great!
So I understand there is no wrong configuration on my side, so I can go on working with this version till these issues will be fixed. I can work with it as is.
If it's ok for you, I'm going to change the deployment URL to avoid leaving it public here.

Of course. Sounds good 👍

These fixes are released in 0.50.1

Note that the build arg variable has changed to NEXT_PUBLIC_PROMPTFOO_BASE_URL, because it applies to both the app and api :)