mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-18 08:26:35 +00:00
Add SQLite store self hosted guide (#100)
This commit is contained in:
BIN
public/docs-static/img/selfhosted/sqlite-erd.png
Normal file
BIN
public/docs-static/img/selfhosted/sqlite-erd.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 380 KiB |
@@ -38,6 +38,7 @@ export const docsNavigation = [
|
|||||||
links: [
|
links: [
|
||||||
{ title: 'Quickstart guide', href: '/selfhosted/selfhosted-quickstart' },
|
{ title: 'Quickstart guide', href: '/selfhosted/selfhosted-quickstart' },
|
||||||
{ title: 'Advanced guide', href: '/selfhosted/selfhosted-guide' },
|
{ title: 'Advanced guide', href: '/selfhosted/selfhosted-guide' },
|
||||||
|
{ title: 'Management SQLite Store', href: '/selfhosted/sqlite-store'},
|
||||||
{ title: 'Supported IdPs', href: '/selfhosted/identity-providers' },
|
{ title: 'Supported IdPs', href: '/selfhosted/identity-providers' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
77
src/pages/selfhosted/sqlite-store.mdx
Normal file
77
src/pages/selfhosted/sqlite-store.mdx
Normal file
@@ -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:
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img src="/docs-static/img/selfhosted/sqlite-erd.png" alt="high-level-dia" className="imagewrapper"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## 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.
|
||||||
Reference in New Issue
Block a user