diff --git a/public/docs-static/img/selfhosted/sqlite-erd.png b/public/docs-static/img/selfhosted/sqlite-erd.png new file mode 100644 index 00000000..5e34a22b Binary files /dev/null and b/public/docs-static/img/selfhosted/sqlite-erd.png differ diff --git a/src/components/NavigationDocs.jsx b/src/components/NavigationDocs.jsx index 4d6c2370..3d010150 100644 --- a/src/components/NavigationDocs.jsx +++ b/src/components/NavigationDocs.jsx @@ -38,6 +38,7 @@ export const docsNavigation = [ links: [ { title: 'Quickstart guide', href: '/selfhosted/selfhosted-quickstart' }, { title: 'Advanced guide', href: '/selfhosted/selfhosted-guide' }, + { title: 'Management SQLite Store', href: '/selfhosted/sqlite-store'}, { title: 'Supported IdPs', href: '/selfhosted/identity-providers' }, ], }, diff --git a/src/pages/selfhosted/sqlite-store.mdx b/src/pages/selfhosted/sqlite-store.mdx new file mode 100644 index 00000000..cbbaa951 --- /dev/null +++ b/src/pages/selfhosted/sqlite-store.mdx @@ -0,0 +1,77 @@ +# Management SQLite Store + +In NetBird, the management system traditionally relies on JSON file storage. +Starting from version 0.24.0, we have introduced **experimental** support for SQLite. +This addition aims to provide users with enhanced performance and scalability options. + +## SQLite Entity Relationship Diagram + +For a high-level overview of the SQLite schema, refer to the Entity Relationship Diagram (ERD) below: + +

+ high-level-dia +

+ +## Using SQLite for Fresh Installations + +As of version 0.24.0, the default configuration for fresh installations is JSON file storage. +However, users have the option to leverage the benefits of SQLite for new instances. +To enable SQLite, update your management.json as follows: + +```json + "StoreKind": "Sqlite", +``` + +Alternatively, you can explicitly set the store to JSON file storage: + +```json + "StoreKind": "JsonFile", +``` + +## Migration from JSON Store + +Starting from version 0.24.0, NetBird management provides a subcommand to facilitate migration to SQLite: + +``` +$ netbird-mgmt sqlite-migration +Contains sub-commands to perform JSON file store to SQLite store migration and rollback + +Usage: + netbird-mgmt sqlite-migration [command] + +Available Commands: + downgrade Rollback SQLite store to JSON file store. Please make a backup of the SQLite file before running this command. + upgrade Migrate JSON file store to SQLite store. Please make a backup of the JSON file before running this command. + +Flags: + --datadir string server data directory location (default "/var/lib/netbird/") + -h, --help help for sqlite-migration + +Global Flags: + --log-file string sets Netbird log path. If console is specified the the log will be output to stdout (default "/var/log/netbird/management.log") + --log-level string (default "info") + +Use "netbird-mgmt sqlite-migration [command] --help" for more information about a command. +``` + +Follow these steps for migration: + +1. Stop NetBird management service. +2. Backup your data store (`store.json` in `datadir` - default "/var/lib/netbird/"). +3. Run the migration to SQLite subcommand. Example: `netbird-mgmt sqlite-migration upgrade --log-file console` +4. Enable SQLite in management following [the instruction in the previous section](#using-sq-lite-for-fresh-installations). +5. Run NetBird management service. + + +## Rollback to JSON File Store + +To rollback to the JSON file store, follow these steps: + +1. Stop the NetBird management service. +2. Backup your SQLite data store (`store.db` in `datadir` - default "/var/lib/netbird/"). +3. Run the rollback to JSON file subcommand (Example: `netbird-mgmt sqlite-migration downgrade --log-file console`). +4. Enable JSON file store in management following [the instructions for fresh installations](#using-sq-lite-for-fresh-installations). +5. Restart the NetBird management service. + +This migration process allows users to seamlessly transition between storage options while maintaining data integrity. +Ensure you perform backups before any migration or rollback operations. \ No newline at end of file