Deploy libSQL - Primary Node
SQLite with features like embedded replicas and remote access.
LibSQL- Primary Node
Just deployed
/var/lib/sqld/
Deploy and Host libSQL - Primary Node on Railway
libSQL - Primary Node is the authoritative writable node in a libSQL deployment. It accepts writes, maintains the source database state, and provides the replication source for one or more replica nodes. This template is specifically designed for a primary node, not a replica or public-facing database endpoint.
About Hosting libSQL - Primary Node
Hosting libSQL - Primary Node means running the main writable database instance that acts as the source of truth for your libSQL deployment.
This Railway template runs the official libSQL server in primary mode and stores persistent database data under /data/sqld. A Railway Volume should be mounted at that path so database state survives restarts and redeployments.
The primary node is intentionally designed to remain inside Railway's private network. It should communicate with replica nodes over private networking rather than being exposed directly to the public internet. Public application traffic should be handled by replica nodes deployed separately.
Common Use Cases
- Run the authoritative writable database for a libSQL deployment.
- Provide the replication source for one or more libSQL replica nodes.
- Keep the primary database isolated on Railway's private network while exposing replica nodes to applications through public networking.
Dependencies for libSQL - Primary Node Hosting
- The official
ghcr.io/tursodatabase/libsql-server:latestDocker image. - A persistent Railway Volume mounted at
/data/sqld. - Railway Private Networking for communication between the primary node and replica nodes.
Implementation Details
Run libSQL explicitly in primary mode:
SQLD_NODE=primary
SQLD_HTTP_LISTEN_ADDR=0.0.0.0:8080
SQLD_GRPC_LISTEN_ADDR=0.0.0.0:5001
Use the official Docker image:
ghcr.io/tursodatabase/libsql-server:latest
Mount persistent storage at:
/data/sqld
The primary exposes its services internally for database operations and replication. Replica nodes can connect to the primary through Railway Private Networking, including the gRPC replication endpoint.
Networking Model
This template intentionally does not enable Railway Public Networking for the primary node.
The primary database should remain private and act as the authoritative writable source for the deployment. Replica nodes should connect to the primary over Railway's internal private network.
If the database needs to be accessed by an application over the public internet, deploy a separate libSQL replica and enable Public Networking on that replica instead.
A typical deployment topology is:
Application
│
│ Public Networking
▼
libSQL Replica
│
│ Railway Private Networking
▼
libSQL Primary
│
▼
/data/sqld
This keeps the primary node isolated from direct public traffic while allowing replicas to provide externally accessible database endpoints.
This template does not configure a replica node and does not require a replica source URL. Replica nodes should be deployed separately and configured to use this primary node as their replication source.
Why Deploy libSQL - Primary Node on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying libSQL - Primary Node on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
LibSQL- Primary Node
ghcr.io/tursodatabase/libsql-server:latest