Deploy SQLite | Database on a Volume with a Web UI
SQLite on a volume with a web UI, current Python and enforced auth
Just deployed
/data
Deploy and Host SQLite on Railway
A SQLite database on a persistent volume, with a web UI in front of it, on a Python that still gets security patches.
About Hosting SQLite
The SQLite template on Railway builds from a repository last touched in January 2024, and its Dockerfile begins:
FROM python:3.7-alpine3.17
RUN pip install gevent sqlite_web
Python 3.7 reached end of life in June 2023 - no security patches for over two years. The two packages are then installed unpinned into that runtime, so pip resolves whatever last version still claimed 3.7 support. A third of its deployments never come up, and some that build fail at runtime with peewee.OperationalError: unable to open database file.
This one runs Python 3.13 with both packages pinned, and fixes two things the original leaves to chance.
It refuses to start without a password. The original leaves WEB_USERNAME empty as a required field. This one checks WEB_PASSWORD in the entrypoint and exits with a clear message rather than ever putting an unauthenticated database browser on a public domain.
It turns on WAL. PRAGMA journal_mode=WAL lets readers and the writer work at the same time instead of blocking each other. Without it SQLite serialises everything, which is most of why people conclude it does not work for web apps.
Common Use Cases
- A small app database that costs nothing beyond the volume it sits on
- Browsing, querying and exporting data through a UI rather than a shell
- A staging or side-project database where running Postgres would be overkill
Dependencies for SQLite Hosting
- A persistent volume, included, mounted at /data. SQLite is a file - without a volume it is deleted on every deploy.
Deployment Dependencies
- sqlite-web: https://github.com/coleifer/sqlite-web
- SQLite: https://sqlite.org/docs.html
- Source: https://github.com/ak40u/sqlite-web-railway-starter
Implementation Details
Open the domain and log in with the generated WEB_PASSWORD, which you will find in the service variables. The database is created on first boot with one example table.
To use it from another service, mount the same volume and point your application at /data/database.db. SQLite is a file, not a server - there is no connection string and nothing listening on a port.
overlapSeconds: 0 in railway.json matters more than it looks. Railway normally runs the old and new containers briefly side by side during a deploy; with one SQLite file on one volume that means two writers on the same database. Setting it to zero stops the old container first.
When not to use SQLite
One writer at a time, and the file lives on a single volume, so it does not survive being scaled to several replicas. For one small service it is excellent and costs nothing extra; past that, deploy Postgres.
Why Deploy SQLite on Railway?
A database with a UI, a volume and TLS from one deploy, and no database server to size, patch or pay for.
Template Content