Skip to content

Railway Deployment

Deployment target

Item Value
Railway project bk-RAG-test
Environment testing
Project ID 45bb0e8d-9eca-4973-8026-a3eddbd092b6
Environment ID 6c80a4d1-c8e3-4410-b712-a27f89012046
Application chat.rapiddraft.ai
Configuration repository adeelyj/librechat-railway-config
Runtime implementation branch codex/optimize-librechat-file-search
Verified runtime commit 49a9ee690a9e776d01dc2e118f0f84c05f24f4a2
Bauer Twin deployment branch agent/configure-librechat-railway
Verified Bauer Twin commit 2815a8f2ba1b7db04d40a80934544f092e54518b

Deployed services

Service Source Replicas Region Health
LibreChat Repository services/librechat-custom overlay on immutable upstream digest 1 US East /health
RAG API Repository services/rag-api-custom overlay on immutable upstream digest 1 US East /health
Bauer Twin API GitHub repository root Dockerfile 1 US East /health
VectorDB pgvector/pgvector:pg16 1 US East Internal database checks
MongoDB mongo 1 US East Internal database checks
Meilisearch getmeili/meilisearch:v1.11.3 1 US East Internal service checks

All six services reported a successful deployment and one running replica on 2026-07-22.

Source deployment model

The deployment uses two source paths:

  • LibreChat and RAG API: Railway builds small reviewed overlays from services/librechat-custom and services/rag-api-custom. Their Dockerfiles pin immutable upstream image digests and verify the expected upstream source checksums before applying the batch-search changes. LibreChat continues to load librechat.yaml from a commit-pinned GitHub raw URL through CONFIG_PATH.
  • Bauer Twin API: Railway builds the repository root Dockerfile from agent/configure-librechat-railway. The thin root image installs and starts services/bauer-twin-api.

The custom files are overlays rather than a full LibreChat fork. The deployed upstream bases are:

Runtime Upstream source commit Upstream image digest
LibreChat 8e5ef1fb31e9d63b735c089b21cbc82c50acce46 sha256:3d0a3031a97afb58dd79d1cffd9c5ad3572e1dc13d8084575814c6bbadc18daf
RAG API 12a446950f952a00ad16d5d90d2163bb69f81de1 sha256:c0ad82657b556c1e16dcfca85d045788f67caa223e25e70eb687f4d16b41dedc

Railway produced deployment image digests sha256:0d76104e5da9589a5dd823c068a7b216dd2abb4c98f3013df97565306578302d for LibreChat and sha256:fbd680a0172211b9889ddebb6d5970f01a1ecca7676d420f93ede3db4e139a5d for the RAG API on 2026-07-21.

Non-secret runtime contract

Service Required configuration groups
LibreChat Application domain, Mongo URI, Meilisearch host/key, RAG URL, S3 endpoint/bucket/credentials, Local AI chat endpoint/key, Bauer MCP URL/key, JWT and credential-encryption secrets
RAG API PostgreSQL connection fields, Local AI embedding endpoint/key, embedding provider and model, JWT secret
Bauer Twin API Dedicated database URL, Local AI embedding endpoint/key/model, MCP bearer key, database-required and seed controls
MongoDB Root username/password and persistent volume
Meilisearch Master key, database path, analytics control, and persistent volume
VectorDB PostgreSQL database/user/password, PGDATA, and persistent volume

The current safe settings are:

ALLOW_EMAIL_LOGIN=true
ALLOW_REGISTRATION=false
ALLOW_SOCIAL_LOGIN=false
ALLOW_SOCIAL_REGISTRATION=false
BAN_VIOLATIONS=true
ENDPOINTS=agents,custom
LIMIT_CONCURRENT_MESSAGES=true
CONCURRENT_MESSAGE_MAX=2
EMBEDDINGS_PROVIDER=openai
EMBEDDINGS_MODEL=local/embed-engineering
BAUER_TWIN_ALLOW_UNAUTHENTICATED=false
BAUER_TWIN_REQUIRE_DATABASE=true
ALLOW_FALLBACK_EMBEDDINGS=false
SEED_ON_START=false

SEED_ON_START=false prevents a full catalogue and embedding rebuild. The Bauer Twin entrypoint still applies the small additive terminology migration and upserts its version-controlled aliases before serving requests.

Secret values belong only in Railway variables or encrypted local credentials. They are not committed to Git or copied into the wiki.

Configuration release

LibreChat configuration

  1. Change and validate librechat.yaml in the configuration repository.
  2. Commit and push the change.
  3. Change CONFIG_PATH to the raw URL for that exact commit.
  4. Redeploy LibreChat.
  5. Verify /health, /api/config, login, both Agents, and a grounded query.

Pinning CONFIG_PATH to a commit prevents an unreviewed branch change from altering a running deployment.

LibreChat and RAG runtime overlays

  1. Run the JavaScript and Python overlay unit tests.
  2. Review the pinned upstream commit, image digest, and source-file checksums in both UPSTREAM.md files.
  3. Deploy services/rag-api-custom first.
  4. Verify RAG /health and confirm the OpenAPI QueryMultipleBody includes entity_id.
  5. Deploy services/librechat-custom.
  6. Verify LibreChat /health and run provision-knowledge-bases.ps1 -SkipUploads -RunQueryTests.
  7. Confirm RAG logs contain one successful /query_multiple call per Agent file-search action.

No database migration or corpus re-ingestion is part of this release.

Bauer Twin service

  1. Run the service test suite locally.
  2. Push the configuration branch.
  3. Confirm Railway builds the expected commit.
  4. Verify /health reports PostgreSQL mode, 12 projects, 75 parts, 8 documents, and 74 terminology aliases.
  5. Run the 19-query live benchmark and MCP round trip.
  6. Restart LibreChat only when the MCP input schema changed, then run B12 and B14 through the production Agent.

Rollback

  • LibreChat configuration: restore CONFIG_PATH to the previous known-good commit and redeploy.
  • Runtime overlays: redeploy LibreChat deployment 0dc80ad2-09fc-4a5d-b0cf-59f32a762a81 and RAG API deployment deb0f4c3-abe7-45a4-adb6-baa85fdbfee4, or redeploy the recorded upstream digests.
  • Bauer Twin: redeploy a previous successful Railway deployment or revert the responsible Git commit.
  • Database schema: use additive migrations. Do not rely on an application rollback to remove or reverse persistent data.

The pre-Option-B Bauer Twin source is commit 65504fefc524ab6878d30a6c9d86fc9b35ae3ac1, Railway deployment c8cdd391-63d7-412e-b982-65d536f81c68, and local archive D:\02_Code\LibreChat_Setup-baseline-65504fef.zip with SHA-256 A80686D522ACFC5E87CC47D919F6C79EBB101A43EFC7E1E32CCD376F41C7041E. Roll back Git with a normal revert commit; do not force-push the deployment branch. The additive terminology table may remain after an application rollback.

Current deployment risks

LibreChat and the RAG API are now pinned and source-checked. MongoDB still uses a mutable image tag, so a database-service redeploy can introduce an upstream change without a Git change. Pin and test the database image before production use.

The environment has one replica per service. This is suitable for testing and demonstrations but does not provide high availability.

Sources

  • Railway project
  • D:\02_Code\LibreChat_Setup\railway.json
  • D:\02_Code\LibreChat_Setup\Dockerfile
  • D:\02_Code\LibreChat_Setup\librechat.yaml
  • Railway deployment, MCP, and Agent verification captured on 2026-07-22