DATA_DIR isn't set as a Railway environment variable
hanleycp
PROOP

5 days ago

I'm using claude code to push through git to railway and created a blog page on my site. when i push new versions, the blogs get wiped. claude says to do this but the exact paths to do this don't seem to be in my railway dashboard.

The problem is clear. When DATA_DIR isn't set as a Railway environment variable, posts write to the container's project directory — which gets wiped every time a new deploy runs. Events aren't affected because the scraper rebuilds them automatically, but blog posts have no way to come back.

The posts are gone unfortunately — Railway doesn't keep runtime files from the old container. Here's the fix:

In your Railway dashboard:

Go to your service → Volumes tab → Add Volume

Mount path: /data

Then go to Variables tab → add: DATA_DIR = /data

That gives you a persistent disk that survives every future redeploy. Blog posts, uploaded photos, and events cache will all live there safely.

Solved$20 Bounty

Pinned Solution

5 days ago

Right click your service and click Attach volume, set it to /data.

CleanShot 2026-07-02 at 17.15.45@2x.png

Then go to the variables tab, and add a DATA_DIR=/data env var.

CleanShot 2026-07-02 at 17.16.34@2x.png

2 Replies

Status changed to Awaiting Railway Response Railway 5 days ago


Railway
BOT

5 days ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway 5 days ago


5 days ago

Right click your service and click Attach volume, set it to /data.

CleanShot 2026-07-02 at 17.15.45@2x.png

Then go to the variables tab, and add a DATA_DIR=/data env var.

CleanShot 2026-07-02 at 17.16.34@2x.png


hanleycp
PROOP

4 days ago

thank you.


Status changed to Solved brody 4 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...