Skip to content

Commit 939eb7b

Browse files
Update README.md
1 parent 2153fc1 commit 939eb7b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,22 @@ The Litestream `replicate` command supports the following options, which can be
157157

158158
You can restore any replicated database at any point using the gem's provided `litestream:restore` rake task. This rake task requires that you specify which specific database you want to restore. As with the `litestream:replicate` task, you pass arguments to the rake task via argument forwarding. For example, to restore the production database, you would do the following:
159159

160-
Note: During the restoration process, you need to prevent any interaction with ActiveRecord/SQLite. If there is any interaction, Rails might regenerate the production database and prevent restoration via litestream. If this happens, you might get a "cannot restore, output path already exists" error.
161-
1. Rename the production databases (RECOMMENDED) or alternatively delete (production.sqlite3/production.sqlite3-shm/production.sqlite3-wal). To delete the production databases locally, you can run the following at your own risk:
160+
> [!NOTE]
161+
> During the restoration process, you need to prevent any interaction with ActiveRecord/SQLite, such as from a running `rails server` or `rails console` instance. If there is any interaction, Rails might regenerate the production database and prevent restoration via litestream. If this happens, you might get a "cannot restore, output path already exists" error.
162+
163+
1. Rename the production (`production.sqlite3`, `production.sqlite3-shm`, and `production.sqlite3-wal`) databases (**recommended**) or alternatively delete. To delete the production databases locally, you can run the following at your own risk:
162164
```shell
163165
# DANGEROUS OPERATION, consider renaming database files instead
164166
bin/rails db:drop DISABLE_DATABASE_ENVIRONMENT_CHECK=1
165167
```
168+
166169
2. Run restore command:
167170
```shell
168171
bin/rails litestream:restore -- --database=storage/production.sqlite3
169172
# or
170173
bundle exec rake litestream:restore -- --database=storage/production.sqlite3
171174
```
175+
172176
3. Restart your Rails application or Docker container if applicable.
173177

174178
You can restore any of the databases specified in your `config/litestream.yml` file. The `--database` argument should be the path to the database file you want to restore and must match the value for the `path` key of one of your configured databases. The `litestream:restore` rake task will automatically load the configuration file and set the environment variables before calling the Litestream executable.

0 commit comments

Comments
 (0)