Deploy BookStack | (Just Updated) Wiki With REST API, Admin and API Token Generated
BookStack wiki + MariaDB, admin and API token generated, no setup needed
mariadb
Just deployed
/var/lib/mysql
bookstack
Just deployed
/config
Deploy and Host BookStack on Railway
BookStack is the open-source wiki that organises documentation as shelves, books, chapters and pages, with a full REST API. This template deploys BookStack with its own MariaDB database, a persistent volume, and everything an AI agent needs already generated - nothing to fill in, no browser step, no default password left behind.
Easy for an LLM agent to use. There is no manual deploy step: deploy, read the variables below, and call the API. The admin login and a working API token pair are generated at deploy time (BookStack's well-known admin@admin.com / password is replaced on first boot), the contract block below lists every URL and variable name, and one curl against /api/books works as soon as the service is healthy.
About Hosting BookStack
Two services run in one Railway project:
- bookstack - the
linuxserver/bookstackimage (pinned by digest: nginx, PHP-FPM, queue worker and cron in one container). The uploads, images, themes and config live on a volume mounted at/config. - mariadb - the official
mariadbimage (pinned by digest) on its own volume. The data directory is a subfolder of the mount, so the filesystem'slost+foundnever lands inside it. The database password is generated and wired into BookStack over the private network.
On first boot the start command derives a valid Laravel APP_KEY (base64: plus 32 bytes) from a generated seed, waits for MariaDB, lets BookStack run its migrations, then a boot step (a) rewrites the default admin with the generated email and password and (b) creates the API token pair in the database. On every later boot the same step finds both already in place and changes nothing, so redeploys are safe.
Agent contract
- Base URL:
https://(also in variableAPP_URL) - Health path:
GET /status- unauthenticated, returns{"database":true,"cache":true,"session":true} - Admin login (
/login): email inBOOKSTACK_ADMIN_EMAIL, password inBOOKSTACK_ADMIN_PASSWORD - API token id:
BOOKSTACK_API_TOKEN_ID, token secret:BOOKSTACK_API_TOKEN_SECRET(admin role, expires in 100 years) - API header:
Authorization: Token : - API reference:
/api/docs(after logging in) - Database (private network only): service
mariadb, host inDB_HOST, password inDB_PASSWORD, database and userbookstack - Generated variables, all on the
bookstackservice:BOOKSTACK_KEY_SEED,BOOKSTACK_ADMIN_PASSWORD,BOOKSTACK_API_TOKEN_ID,BOOKSTACK_API_TOKEN_SECRET
One working call:
curl -s https:///api/books \
-H "Authorization: Token $BOOKSTACK_API_TOKEN_ID:$BOOKSTACK_API_TOKEN_SECRET"
# {"data":[],"total":0}
Create a book and a page:
curl -s https:///api/books -X POST \
-H "Authorization: Token $BOOKSTACK_API_TOKEN_ID:$BOOKSTACK_API_TOKEN_SECRET" \
-H 'content-type: application/json' -d '{"name":"Runbooks","description":"Team runbooks"}'
Why Deploy BookStack 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 BookStack 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.
- No default credentials - the stock
admin@admin.com/passwordaccount is rewritten on first boot; the generated password is in your variables. - API token ready - a token pair is created at boot, so an agent can read and write the wiki without opening the UI.
- Zero configuration - no variable asks you for anything;
APP_URLfollows the public domain and the database is wired automatically. - Data survives redeploys - uploads, images and the database each sit on a volume, verified with a write, a redeploy and a read.
Common Use Cases
- Agent memory and knowledge base - let an LLM agent write structured notes and look them up through the REST API.
- Team documentation and runbooks - a Confluence alternative with shelves, books, chapters, search and permissions.
- Internal handbooks and onboarding - a wiki non-technical colleagues can edit in a visual or Markdown editor.
Dependencies for BookStack Hosting
- A volume at
/configon thebookstackservice and a volume at/var/lib/mysqlon themariadbservice (both included in this template).
Deployment Dependencies
- BookStackApp/BookStack - upstream project
- linuxserver/docker-bookstack - the image this template deploys
- mariadb on Docker Hub - the database image
Template Content
mariadb
mariadb:11.8bookstack
linuxserver/bookstack