mirror of
https://github.com/sissbruecker/linkding
synced 2024-11-22 03:13:02 +00:00
Add backup document (#89)
* Added backup document * Improve and reference backup docs Co-authored-by: matto <matto@matto.nl> Co-authored-by: Sascha Ißbrücker <sissbruecker@lyska.io>
This commit is contained in:
parent
1c5d92dc73
commit
496c5badbf
2 changed files with 53 additions and 5 deletions
|
@ -80,11 +80,7 @@ The application runs in a web-server called [uWSGI](https://uwsgi-docs.readthedo
|
|||
|
||||
### Backups
|
||||
|
||||
For backups you have two options: manually or automatic.
|
||||
|
||||
For manual backups you can export your bookmarks from the UI and store them on a backup device or online service.
|
||||
|
||||
For automatic backups you want to backup the applications database. As described above, for production setups you should [mount](https://stackoverflow.com/questions/23439126/how-to-mount-a-host-directory-in-a-docker-container) the `/etc/linkding/data` directory from the Docker container to a directory on your host system. You can then use a backup tool of your choice to backup the contents of that directory.
|
||||
Check the [backups document](docs/backup.md) for options on how to create backups.
|
||||
|
||||
## API
|
||||
|
||||
|
|
52
docs/backup.md
Normal file
52
docs/backup.md
Normal file
|
@ -0,0 +1,52 @@
|
|||
# Backups
|
||||
|
||||
This page describes some options on how to create backups.
|
||||
|
||||
## 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.
|
||||
|
||||
Below, we describe two methods to create a backup of the database:
|
||||
|
||||
- Manual backup using the export function from the UI
|
||||
- Create a copy of the SQLite databse 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.
|
||||
|
||||
## Exporting from the UI
|
||||
|
||||
The least technical option is to use the bookmark export in the UI.
|
||||
Go to the settings page and open the *Data* tab.
|
||||
Then click on the *Download* button to download an HTML file containing all your bookmarks.
|
||||
Then backup this file on a drive, or an online file host.
|
||||
|
||||
## Using the SQLite backup function
|
||||
|
||||
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.
|
||||
This method uses the backup command in the [Command Line Shell For SQLite](https://sqlite.org/cli.html).
|
||||
```shell
|
||||
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.
|
||||
|
||||
## Using the SQLite dump function
|
||||
|
||||
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.
|
||||
|
||||
```shell
|
||||
sqlite3 db.sqlite3 .dump > backup.sql
|
||||
```
|
||||
|
||||
As this is a plain text file you can 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.
|
||||
|
||||
|
Loading…
Reference in a new issue