Package: drumee-schemas
Directory: schemas/
Debian package: drumee-schemas
Current version: 2.7.2
Helper source: git@github.com:drumee/setup-schemas → /var/lib/drumee/setup-schemas/
Purpose
Bootstraps the Drumee database layer. The post-install script (bin/install) restores a MariaDB snapshot from seeds, creates system accounts (nobody, guest, system, admin), provisions the initial hubs and media filesystem, generates the RSA key pair, and sends a welcome email with the admin password-reset link.
Flow at a glance
setup-schemas is the stateful half of provisioning (its counterpart, setup-infra, generates config files). A thin bash orchestrator (bin/install) does the physical DB restore, then hands off to a Node domain layer (populate.js + lib/) that stands up the first organization:
bin/install (bash, root)
└─ mariabackup --copy-back (restore seeds.tgz → live datadir)
└─ node populate.js (Node)
├─ lib/organization.js → sys_conf/domain/vhost/organisation/settings + nobody/guest/system/admin
├─ lib/drumate.js → create users & hubs (drumate_create / desk_create_hub procs)
├─ lib/mfs.js → import wallpapers + tutorials over HTTP (calls currently disabled)
└─ lib/schema.js → low-level entity (hub/drumate DB) provisioner (entity_create + template SQL)
└─ bin/acknowledge.js (welcome email) + apply pending patches
Domain layer (lib/)
| Module | Responsibility |
|---|---|
organization.js | populate() seeds the yp system rows; createNobody/Guest/SystemUser/Admin() build the fixed accounts; remove() tears an org down. |
drumate.js | create() a user (via the drumate_create proc) and createHub() (via desk_create_hub). updateEntries() remaps a freshly-created entity's id to a pre-allocated uid across six tables (entity, drumate, hub, vhost, privilege, disk_usage) and moves its home_dir — the trickiest step. |
mfs.js | Imports remote content (importContent/importFile/importTutorial) into MFS by downloading over HTTP, then mfs_create_node + copy into __storage__/. |
schema.js | Low-level entity provisioner: entity_create → load per-type template SQL → create the MFS/media root, with rollback on failure (the pool/factory path). |
Source Repos
| Repo | Branch | Destination |
|---|---|---|
setup-schemas | main | /var/lib/drumee/setup-schemas/ |
schemas | preview | /var/lib/drumee/schemas/ |
Build Prerequisites
Seeds archive required. The build looks for a seeds archive in this order:
schemas/var/tmp/drumee/seeds.tgz— pre-existing archive in the repo$SEEDS_DIR/directory (default:$HOME/docker/data/seeds/) — packed from a live MariaDB instance
If neither exists, the build exits. Seeds are a mariabackup snapshot of the base Drumee database needed to bootstrap a fresh instance.
schemas/seeds/ is gitignored — it contains large MariaDB binary files (aria_log, ibdata1) unsuitable for version control.
Creating seeds.tgz from a live instance
SEEDS_DIR=/path/to/mariabackup/snapshot schemas/build.sh
schemas/Dockerfile
Provides a containerised build environment for producing seeds without a local MariaDB installation. Uses mariabackup to snapshot and prepare the database.
Build
schemas/build.sh
schemas/build.sh takes no flags — version and email come from schemas/debian/changelog. Set SEEDS_DIR to point at the mariabackup snapshot used to create the seeds archive (see Build Prerequisites). Invoking the script with rebuild in its path forces the existing seeds.tgz to be regenerated.
Installed Paths
/var/lib/drumee/
├── setup-schemas/ # bin/install, populate.js, lib/ (domain layer), asset/welcome.html
└── schemas/ # schema source (preview branch)
/var/tmp/drumee/
└── seeds.tgz # mariabackup snapshot archive
Dependencies
binutils, nodejs, mariadb-server, mariadb-client
Post-Install: bin/install
Runs as root. Two-phase execution:
Phase 1 — Database restore (bash)
- Sources
/etc/drumee/drumee.shfor environment variables. - Stops MariaDB.
- Manages the DB directory (
$DRUMEE_DB_DIR, default/srv/db):- Archives any existing
run/toorig/<date>/(rollback point). - Creates a fresh
run/directory.
- Archives any existing
- Extracts seeds from
/var/tmp/drumee/seeds.tgz. - Restores via
mariabackup --copy-backinto$DRUMEE_DB_DIR/run/. - Sets ownership (
mysql:mysql) and permissions (750dirs,rwfiles). - Starts MariaDB.
- Creates the system Unix-socket user:
CREATE OR REPLACE USER '$DRUMEE_SYSTEM_USER'@'localhost' IDENTIFIED VIA unix_socket;
GRANT ALL PRIVILEGES ON *.* TO '$DRUMEE_SYSTEM_USER'@'localhost'; - Sets global collation to
utf8mb4_general_ciif supported.