Issue Deploying SpiceDB on Railway
mahmud963
HOBBYOP

13 days ago

Hello Railway Community,

I’m currently trying to deploy SpiceDB on Railway, but I’m running into an issue during startup related to migrations and datastore configuration. The error indicates that it’s unable to migrate to the head revision.

I’ve configured the datastore to use PostgreSQL and set the required environment variables, including SPICEDB_DATASTORE_CONN_URI and SPICEDB_GRPC_PRESHARED_KEY, but the service still fails during initialization.

Has anyone encountered a similar issue while deploying SpiceDB on Railway? I would appreciate any guidance or suggestions.

Thank you in advance.

Best regards,

Solved$10 Bounty

Pinned Solution

mahmud963
HOBBYOP

13 days ago

The issue has been resolved.

The problem was that I was using the same PostgreSQL database as my main application (which already contained existing tables and an alembic_version table). SpiceDB requires a clean, empty database on first startup in order to run its migrations successfully.

After creating a separate, fresh PostgreSQL instance dedicated only to SpiceDB, the service started correctly and the migrations completed without errors.

Thank you to everyone who helped.

Best regards,

3 Replies

did you set  SPICEDB_DATASTORE_ENGINE=postgres in you env?


mahmud963
HOBBYOP

13 days ago

The issue has been resolved.

The problem was that I was using the same PostgreSQL database as my main application (which already contained existing tables and an alembic_version table). SpiceDB requires a clean, empty database on first startup in order to run its migrations successfully.

After creating a separate, fresh PostgreSQL instance dedicated only to SpiceDB, the service started correctly and the migrations completed without errors.

Thank you to everyone who helped.

Best regards,


Status changed to Solved noahd 13 days ago


dharmateja

did you set  SPICEDB_DATASTORE_ENGINE=postgres in you env?

mahmud963
HOBBYOP

13 days ago

Hi,

Thanks for your suggestion. Yes, SPICEDB_DATASTORE_ENGINE=postgres was set correctly.

The issue turned out to be that I was using a database that already had existing tables. SpiceDB required a clean, empty database for migrations. After creating a fresh PostgreSQL instance, it worked.

Appreciate your help.


Status changed to Awaiting Railway Response Railway 13 days ago


Status changed to Solved noahd 13 days ago


Loading...