mirror of
https://github.com/sissbruecker/linkding
synced 2024-11-22 03:13:02 +00:00
Update backup docs
This commit is contained in:
parent
d7c68c2818
commit
a130daa0f0
1 changed files with 49 additions and 24 deletions
|
@ -1,52 +1,77 @@
|
||||||
# Backups
|
# Backups
|
||||||
|
|
||||||
This page describes some options on how to create backups.
|
Linkding stores all data in the application's data folder.
|
||||||
|
The full path to that folder in the Docker container is `/etc/linkding/data`.
|
||||||
## What to backup
|
|
||||||
|
|
||||||
Linkding stores all data in a SQLite database, so all you need to backup are the contents of that database.
|
|
||||||
|
|
||||||
The location of the database file is `data/db.sqlite3` in the application folder.
|
|
||||||
If you are using Docker then the full path in the Docker container is `/etc/linkding/data/db.sqlite`.
|
|
||||||
As described in the installation docs, you should mount the `/etc/linkding/data` folder to a folder on your host system, from which you then can execute the backup.
|
As described in the installation docs, you should mount the `/etc/linkding/data` folder to a folder on your host system, from which you then can execute the backup.
|
||||||
|
|
||||||
Below, we describe several methods to create a backup of the database:
|
The data folder contains the following contents:
|
||||||
|
- `db.sqlite3` - the SQLite database
|
||||||
|
- `favicons` - folder that contains downloaded favicons
|
||||||
|
|
||||||
- Manual backup using the export function from the UI
|
The following sections explain how to back up the individual contents.
|
||||||
- Create a copy of the SQLite database with the SQLite backup function
|
|
||||||
- Create a plain textfile with the contents of the SQLite database with the SQLite dump function
|
|
||||||
|
|
||||||
Choose the method that fits you best.
|
## Database
|
||||||
|
|
||||||
## Exporting from the UI
|
This section describes several methods on how to back up the contents of the SQLite database.
|
||||||
|
|
||||||
The least technical option is to use the bookmark export in the UI.
|
> [!WARNING]
|
||||||
Go to the settings page and open the *Data* tab.
|
> While the SQLite database is just a single file, it is not recommended to just copy that file.
|
||||||
Then click on the *Download* button to download an HTML file containing all your bookmarks.
|
> This method is not transaction safe and may result in a [corrupted database](https://www.sqlite.org/howtocorrupt.html).
|
||||||
You can backup this file on a drive, or an online file host.
|
> Use one of the official SQLite backup methods described below.
|
||||||
|
|
||||||
## Using the SQLite backup function
|
### Using the SQLite backup function
|
||||||
|
|
||||||
Requires [SQLite](https://www.sqlite.org/index.html) to be installed on your host system.
|
Requires [SQLite](https://www.sqlite.org/index.html) to be installed on your host system.
|
||||||
|
|
||||||
With this method you create a new SQLite database, which is a copy of your linkding database.
|
With this method you create a new SQLite database, which is a copy of your linkding database.
|
||||||
This method uses the backup command in the [Command Line Shell For SQLite](https://sqlite.org/cli.html).
|
This method uses the backup command in the [Command Line Shell For SQLite](https://sqlite.org/cli.html).
|
||||||
|
To create a backup, execute the following command in the data folder:
|
||||||
```shell
|
```shell
|
||||||
sqlite3 db.sqlite3 ".backup 'backup.sqlite3'"
|
sqlite3 db.sqlite3 ".backup 'backup.sqlite3'"
|
||||||
```
|
```
|
||||||
After you have created the backup database `backup.sqlite` you have to move it to another system, for example with rsync.
|
This creates a `backup.sqlite3` file which you can copy to your backup location.
|
||||||
|
|
||||||
## Using the SQLite dump function
|
To restore the backup, just copy the backup file as `db.sqlite3` to the data folder of your new installation before starting the Docker container.
|
||||||
|
|
||||||
|
### Using the SQLite dump function
|
||||||
|
|
||||||
Requires [SQLite](https://www.sqlite.org/index.html) to be installed on your host system.
|
Requires [SQLite](https://www.sqlite.org/index.html) to be installed on your host system.
|
||||||
|
|
||||||
With this method you create a plain text file with the SQL statements to recreate the SQLite database.
|
With this method you create a plain text file with the SQL statements to recreate the SQLite database.
|
||||||
|
To create a backup, execute the following command in the data folder:
|
||||||
```shell
|
```shell
|
||||||
sqlite3 db.sqlite3 .dump > backup.sql
|
sqlite3 db.sqlite3 .dump > backup.sql
|
||||||
```
|
```
|
||||||
|
This creates a `backup.sql` which you can copy to your backup location.
|
||||||
|
As this is a plain text file you can also commit it to any revision management system, like git.
|
||||||
|
Using git, you can commit the changes, followed by a git push to a remote repository.
|
||||||
|
|
||||||
As this is a plain text file you can commit it to any revision management system, like git.
|
### Exporting bookmarks from the UI
|
||||||
Using git you can commit the changes, followed by a git push to a remote repository.
|
|
||||||
|
|
||||||
|
This is the least technical option to back up bookmarks, but has several limitations:
|
||||||
|
- It does not export user profiles.
|
||||||
|
- It only exports your own bookmarks, not those of other users.
|
||||||
|
- It does not export archived bookmarks.
|
||||||
|
- It does not export URLs of snapshots on the Internet Archive Wayback machine.
|
||||||
|
- It does not export favicons.
|
||||||
|
|
||||||
|
Only use this method if you are fine with the above limitations.
|
||||||
|
|
||||||
|
To export bookmarks from the UI, open the general settings.
|
||||||
|
In the Export section, click on the *Download* button to download an HTML file containing all your bookmarks.
|
||||||
|
Then move that file to your backup location.
|
||||||
|
|
||||||
|
To restore bookmarks, open the general settings on your new installation.
|
||||||
|
In the Import section, click on the *Choose file* button to select the HTML file you downloaded before.
|
||||||
|
Then click on the *Import* button to import the bookmarks.
|
||||||
|
|
||||||
|
## Favicons
|
||||||
|
|
||||||
|
Doing a backup of the icons is optional, as they can be downloaded again.
|
||||||
|
|
||||||
|
If you choose not to back up the icons, you can just restore the database and then click the _Refresh Favicons_ button in the general settings.
|
||||||
|
This will download all missing icons again.
|
||||||
|
|
||||||
|
If you want to back up the icons, then you have to copy the `favicons` folder to your backup location.
|
||||||
|
|
||||||
|
To restore the icons, copy the `favicons` folder back to the data folder of your new installation.
|
||||||
|
|
Loading…
Reference in a new issue