Backups and updates
keep your data, replace the code.
Everything Leadlantern knows is in one folder, data, plus your .env file. Back up those two and you can rebuild the installation anywhere. An update replaces only the code; the database upgrades itself on the next start.
01What to back up
| File | Holds |
|---|---|
data/leadlantern.sqlite | Leads, searches, website checks, report links, messages, notes, tasks, history, the do-not-contact list. |
data/admin.sqlite | Settings, encrypted keys, team, sessions, audit log, settings history. |
data/.admin-secret-key | Only when you did not set ADMIN_SECRET_KEY yourself. |
.env | Your ADMIN_SECRET_KEY and other variables. Without the key the saved keys in admin.sqlite cannot be read. |
Keep backups somewhere other than the server, and keep them private: they contain your leads and your team's sign-in data.
02Make a backup
The commands on this page are written for macOS and Linux shells. On a Windows PC run them inside WSL (Ubuntu) or in Git Bash; production belongs on a Linux server. See Windows.
Either stop the server and copy the folder:
sudo systemctl stop leadlantern
sudo tar czf /path/to/backups/leadlantern-$(date +%F).tgz -C /path/to/leadlantern/source data .env
sudo systemctl start leadlantern
or, without stopping, let SQLite write a consistent copy of each database (install the sqlite3 tool first: sudo apt-get install -y sqlite3):
cd /path/to/leadlantern/source
sqlite3 data/leadlantern.sqlite ".backup '/path/to/backups/leadlantern.sqlite'"
sqlite3 data/admin.sqlite ".backup '/path/to/backups/admin.sqlite'"
A settings-only copy as JSON: Export / Import.
03Restore
- Stop the server.
- Put the backed-up files into
data/and the.envnext topackage.json, owned by theleadlanternuser. - Start the server.
04Update to a new version
- Read the changelog of the new version (Changelog).
- Back up
data/and.env(above). - Stop the server:
sudo systemctl stop leadlantern. - Replace the code with the new
sourcefolder, keepingdata/and.env. - Install, compile and start:
cd /path/to/leadlantern/source
sudo -u leadlantern pnpm install
sudo -u leadlantern pnpm build
sudo systemctl start leadlantern
The database is upgraded by itself on start; there is no separate migration step. Forgetting pnpm build leaves the old compiled code in dist/ running. Afterwards open Status and check that every line is as before.