|
@@ -1,81 +1,65 @@
|
|
|
# Backup
|
|
# Backup
|
|
|
|
|
|
|
|
-FreshRSS global settings are in `./data/config.php` and users' settings are in `./data/users/*/config.php`. You can also back up the whole `./data/` directory but exclude the things you do not want.
|
|
|
|
|
|
|
+## What to back up
|
|
|
|
|
|
|
|
-If you use extensions, then each directory in `./extensions` the folder `static` contains the user’s extension settings.
|
|
|
|
|
|
|
+- `./data/` - **required**. You can skip `cache/` and `favicons/`; FreshRSS rebuilds them.
|
|
|
|
|
+- `./extensions/` - **recommended** if you use third-party extensions.
|
|
|
|
|
+- `./i/themes/` - **optional**, only if you have added custom themes.
|
|
|
|
|
+- **External database** (MySQL, MariaDB, or PostgreSQL) - back up separately with `mysqldump`/`pg_dump`. SQLite is covered by `./data/` above. See [Exporting your data](#exporting-your-data) for per-user SQLite export.
|
|
|
|
|
|
|
|
-## Full-Installation Backup
|
|
|
|
|
|
|
+All other folders belong to the source code and are restored by a fresh install or upgrade.
|
|
|
|
|
+
|
|
|
|
|
+## Full installation backup
|
|
|
|
|
|
|
|
Do this before an upgrade.
|
|
Do this before an upgrade.
|
|
|
|
|
|
|
|
-This following tutorial demonstrates commands for backing up FreshRSS. It assumes that your main FreshRSS directory is `/usr/share/FreshRSS`. If you’ve installed it somewhere else, substitute your path as necessary.
|
|
|
|
|
|
|
+The following commands assume your FreshRSS directory is `/usr/share/FreshRSS`; substitute your path if installed elsewhere.
|
|
|
|
|
+
|
|
|
|
|
+> ℹ️ It is safer to stop your web server and cron during maintenance operations.
|
|
|
|
|
|
|
|
### Creating a database backup
|
|
### Creating a database backup
|
|
|
|
|
|
|
|
-Back-up all users respective database to `data/users/*/backup.sqlite`
|
|
|
|
|
|
|
+Back up each user's database to `./data/users/*/backup.sqlite`:
|
|
|
|
|
|
|
|
```sh
|
|
```sh
|
|
|
cd /usr/share/FreshRSS/
|
|
cd /usr/share/FreshRSS/
|
|
|
./cli/db-backup.php
|
|
./cli/db-backup.php
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-### Creating a Backup of all Files
|
|
|
|
|
|
|
+### Creating a backup of all files
|
|
|
|
|
|
|
|
-Enter the directory you wish to save your backup to.
|
|
|
|
|
-Here, for example, we’ll save the backup to the user home directory
|
|
|
|
|
|
|
+Save the backup to your home directory:
|
|
|
|
|
|
|
|
```sh
|
|
```sh
|
|
|
cd ~
|
|
cd ~
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-Next, we’ll create a gzipped tar archive of the FreshRSS directory. The following command will archive the entire contents of your FreshRSS installation in it’s current state.
|
|
|
|
|
|
|
+Create a gzipped tar archive of the FreshRSS directory:
|
|
|
|
|
|
|
|
```sh
|
|
```sh
|
|
|
tar -czf FreshRSS-backup.tgz -C /usr/share/FreshRSS/ .
|
|
tar -czf FreshRSS-backup.tgz -C /usr/share/FreshRSS/ .
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-And you’re done!
|
|
|
|
|
-
|
|
|
|
|
-### Restoring Files from a Backup
|
|
|
|
|
-
|
|
|
|
|
-First, copy the backup previously made into your FreshRSS directory
|
|
|
|
|
-
|
|
|
|
|
-```sh
|
|
|
|
|
-cp ~/FreshRSS-backup.tgz /usr/share/FreshRSS/
|
|
|
|
|
-```
|
|
|
|
|
-
|
|
|
|
|
-Next, change to your FreshRSS directory
|
|
|
|
|
-
|
|
|
|
|
-```sh
|
|
|
|
|
-cd /usr/share/FreshRSS/
|
|
|
|
|
-```
|
|
|
|
|
-
|
|
|
|
|
-Extract the backup
|
|
|
|
|
-
|
|
|
|
|
-```sh
|
|
|
|
|
-tar -xzf FreshRSS-backup.tgz
|
|
|
|
|
-```
|
|
|
|
|
|
|
+### Restoring files from a backup
|
|
|
|
|
|
|
|
-And optionally, as cleanup, remove the copy of your backup from the FreshRSS directory
|
|
|
|
|
|
|
+Extract the backup into your FreshRSS directory:
|
|
|
|
|
|
|
|
```sh
|
|
```sh
|
|
|
-rm FreshRSS-backup.tgz
|
|
|
|
|
|
|
+tar -xzf ~/FreshRSS-backup.tgz -C /usr/share/FreshRSS/
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-### Restore a database backup
|
|
|
|
|
-
|
|
|
|
|
-> ℹ️ It is safer to stop your Web server and cron during maintenance operations.
|
|
|
|
|
|
|
+### Restoring a database backup
|
|
|
|
|
|
|
|
-Restore all users respective database from `data/users/*/backup.sqlite`
|
|
|
|
|
|
|
+Restore each user's database from `./data/users/*/backup.sqlite`:
|
|
|
|
|
|
|
|
```sh
|
|
```sh
|
|
|
cd /usr/share/FreshRSS/
|
|
cd /usr/share/FreshRSS/
|
|
|
./cli/db-restore.php --delete-backup --force-overwrite
|
|
./cli/db-restore.php --delete-backup --force-overwrite
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-## Migrate database
|
|
|
|
|
|
|
+## Migrating the database
|
|
|
|
|
|
|
|
-Start by making an automatic backup of the all the user databases to SQLite files:
|
|
|
|
|
|
|
+First, back up all user databases to SQLite files:
|
|
|
|
|
|
|
|
```sh
|
|
```sh
|
|
|
cd /usr/share/FreshRSS/
|
|
cd /usr/share/FreshRSS/
|
|
@@ -83,57 +67,59 @@ cd /usr/share/FreshRSS/
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Change your database setup:
|
|
Change your database setup:
|
|
|
-- if you like to change database type (e.g. from MySQL to PostgreSQL), edit `data/config.php` accordingly.
|
|
|
|
|
-- if you upgrade to a major PostgreSQL version, after a PostgreSQL backup, you may delete the old instance and start a new instance (remove the PostgreSQL volume if using Docker).
|
|
|
|
|
|
|
|
|
|
-Restore all the user databases from the SQLite files:
|
|
|
|
|
|
|
+- to change the database type (e.g. from MySQL to PostgreSQL), edit `./data/config.php` accordingly.
|
|
|
|
|
+- to upgrade to a major PostgreSQL version, after a PostgreSQL backup, delete the old instance and start a new one (remove the PostgreSQL volume if using Docker).
|
|
|
|
|
+
|
|
|
|
|
+Restore all user databases from the SQLite files:
|
|
|
|
|
|
|
|
```sh
|
|
```sh
|
|
|
|
|
+cd /usr/share/FreshRSS/
|
|
|
./cli/db-restore.php --delete-backup --force-overwrite
|
|
./cli/db-restore.php --delete-backup --force-overwrite
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-See also our [Docker documentation to migrate database](https://github.com/FreshRSS/FreshRSS/blob/edge/Docker/README.md#migrate-database).
|
|
|
|
|
|
|
+See also our [Docker documentation for migrating the database](https://github.com/FreshRSS/FreshRSS/blob/edge/Docker/README.md#migrate-database).
|
|
|
|
|
|
|
|
## Backing up selected content
|
|
## Backing up selected content
|
|
|
|
|
|
|
|
-### Feed list Export
|
|
|
|
|
|
|
+### Feed list export
|
|
|
|
|
+
|
|
|
|
|
+You can export your feed list in OPML format either from the web interface, or from the [command-line interface](https://github.com/FreshRSS/FreshRSS/blob/edge/cli/README.md).
|
|
|
|
|
|
|
|
-You can export your feed list in OPML format either from the web interface, or from the [Command-Line Interface](https://github.com/FreshRSS/FreshRSS/blob/edge/cli/README.md).
|
|
|
|
|
|
|
+The OPML export only includes the standard OPML parameters; it omits FreshRSS-specific attributes like refresh frequency, credentials, user agent, and XPath web scraping rules.
|
|
|
|
|
|
|
|
-The OPML export only exports the standard OPML parameters and does not export things such as desired refresh frequency, custom attributes such as passwords, user agent, XPath Web scraping, etc.
|
|
|
|
|
|
|
+For a full export including these, use the SQLite export described below.
|
|
|
|
|
|
|
|
-To export all that, use a full back-up with export-to-sqlite, as described in the following section.
|
|
|
|
|
|
|
+### Exporting your data
|
|
|
|
|
|
|
|
-### Saving Articles
|
|
|
|
|
|
|
+#### MySQL or MariaDB
|
|
|
|
|
|
|
|
-**If you are using MySQL**
|
|
|
|
|
-You can use [phpMyAdmin](https://www.phpmyadmin.net/) or MySQL tools, where `<db_user>` is your database username, `<db_host>` is the hostname of your web server containing your FreshRSS database, and `<freshrss_db>` is the database used by FreshRSS:
|
|
|
|
|
|
|
+You can use [phpMyAdmin](https://www.phpmyadmin.net/) or `mysqldump`. Replace `<db_user>` with your database username, `<db_host>` with your database server hostname, and `<freshrss_db>` with the FreshRSS database name:
|
|
|
|
|
|
|
|
```sh
|
|
```sh
|
|
|
mysqldump --skip-comments --disable-keys --user=<db_user> --password --host <db_host> --result-file=freshrss.dump.sql --databases <freshrss_db>
|
|
mysqldump --skip-comments --disable-keys --user=<db_user> --password --host <db_host> --result-file=freshrss.dump.sql --databases <freshrss_db>
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-**From any database**
|
|
|
|
|
-You can use the [Command-Line Interface](https://github.com/FreshRSS/FreshRSS/blob/edge/cli/README.md) to export your database to a SQLite database file:
|
|
|
|
|
|
|
+#### Any database
|
|
|
|
|
+
|
|
|
|
|
+Export your database to a SQLite file with the [command-line interface](https://github.com/FreshRSS/FreshRSS/blob/edge/cli/README.md):
|
|
|
|
|
|
|
|
```sh
|
|
```sh
|
|
|
./cli/export-sqlite-for-user.php --user <username> --filename </path/to/db.sqlite>
|
|
./cli/export-sqlite-for-user.php --user <username> --filename </path/to/db.sqlite>
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-> Note that the database filename needs the `sqlite` extension in order to work properly.
|
|
|
|
|
-
|
|
|
|
|
-You can use the [Command-Line Interface](https://github.com/FreshRSS/FreshRSS/blob/edge/cli/README.md) again to import the SQLite database file into your database:
|
|
|
|
|
|
|
+Import the SQLite file back into your database:
|
|
|
|
|
|
|
|
```sh
|
|
```sh
|
|
|
./cli/import-sqlite-for-user.php --user <username> --filename </path/to/db.sqlite>
|
|
./cli/import-sqlite-for-user.php --user <username> --filename </path/to/db.sqlite>
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-> Again, note that the database filename needs the `sqlite` extension in order to work properly.
|
|
|
|
|
|
|
+> ℹ️ The database filename must use the `.sqlite` extension for both commands to work.
|
|
|
|
|
|
|
|
-The SQLite process is useful when you need to:
|
|
|
|
|
|
|
+The export/import flow is useful when you need to:
|
|
|
|
|
|
|
|
-- export a user fully,
|
|
|
|
|
-- backup your service,
|
|
|
|
|
|
|
+- fully export a user,
|
|
|
|
|
+- back up your service,
|
|
|
- migrate the service to another server,
|
|
- migrate the service to another server,
|
|
|
-- change database type,
|
|
|
|
|
-- fix database corruptions.
|
|
|
|
|
|
|
+- change the database type,
|
|
|
|
|
+- fix database corruption.
|