hu3rror / memos-litestream

✍️ Run memos with litestream.
GNU General Public License v3.0
25 stars 5 forks source link

Broken when trying to restore using litestream #28

Closed putraeka closed 4 months ago

putraeka commented 4 months ago

Hello,

I'm using your image more than 1 year and still using the image till now. Originally I hosted the instance on fly.io but I changed my mind and deploy it on a vps.

When I tried to restore the instance using the same setting, litestream was broken because the -v option from this command litestream restore -v -if-replica-exists "$DB_PATH" on your run.sh

I tried running litestream my self to restore a backup and found out that remove -v solve the issue.

That's I would like to report.

hu3rror commented 4 months ago

Thank you for the report. Could you provide more detailed logs? The -v parameter generates verbose output, but I believe it won't impact the outcome of the litestream restore command.

putraeka commented 4 months ago

Here is the logs

✔ Volume "usememos_data"  Created                                                                                                                          0.0s
 ✔ Container usememos      Started                                                                                                                          0.1s
usememos exited with code 1
usememos  | No database found, attempt to restore from a replica.
usememos  | flag provided but not defined: -v
usememos  |
usememos  | The restore command recovers a database from a previous snapshot and WAL.
usememos  |
usememos  | Usage:
usememos  |
usememos  |     litestream restore [arguments] DB_PATH
usememos  |
usememos  |     litestream restore [arguments] REPLICA_URL
usememos  |
usememos  | Arguments:
usememos  |
usememos  |     -config PATH
usememos  |         Specifies the configuration file.
usememos  |         Defaults to /etc/litestream.yml
usememos  |
usememos  |     -no-expand-env
usememos  |         Disables environment variable expansion in configuration file.
usememos  |
usememos  |     -replica NAME
usememos  |         Restore from a specific replica.
usememos  |         Defaults to replica with latest data.
usememos  |
usememos  |     -generation NAME
usememos  |         Restore from a specific generation.
usememos  |         Defaults to generation with latest data.
usememos  |
usememos  |     -index NUM
usememos  |         Restore up to a specific hex-encoded WAL index (inclusive).
usememos  |         Defaults to use the highest available index.
usememos  |
usememos  |     -timestamp TIMESTAMP
usememos  |         Restore to a specific point-in-time.
usememos  |         Defaults to use the latest available backup.
usememos  |
usememos  |     -o PATH
usememos  |         Output path of the restored database.
usememos  |         Defaults to original DB path.
usememos  |
usememos  |     -if-db-not-exists
usememos  |         Returns exit code of 0 if the database already exists.
usememos  |
usememos  |     -if-replica-exists
usememos  |         Returns exit code of 0 if no backups found.
usememos  |
usememos  |     -parallelism NUM
usememos  |         Determines the number of WAL files downloaded in parallel.
usememos  |         Defaults to 8
usememos  |
usememos  |     -v
usememos  |         Verbose output.
usememos  |
usememos  |
usememos  | Examples:
usememos  |
usememos  |     # Restore latest replica for database to original location.
usememos  |     $ litestream restore /path/to/db
usememos  |
usememos  |     # Restore replica for database to a given point in time.
usememos  |     $ litestream restore -timestamp 2020-01-01T00:00:00Z /path/to/db
usememos  |
usememos  |     # Restore latest replica for database to new /tmp directory
usememos  |     $ litestream restore -o /tmp/db /path/to/db
usememos  |
usememos  |     # Restore database from latest generation on S3.
usememos  |     $ litestream restore -replica s3 /path/to/db
usememos  |
usememos  |     # Restore database from specific generation on S3.
usememos  |     $ litestream restore -replica s3 -generation xxxxxxxx /path/to/db
usememos  |
usememos  | 2024/05/11 13:06:02 ERROR failed to run error="flag provided but not defined: -v"

I deploy the exact compose yaml as my previous one but with different service name and container name.

The container exit and doesn't run

My first workaround was copying memos_prod.db to docker volume directly as I have the backup. Then I run docker compose again.

hu3rror commented 4 months ago

Thank you for your log. I've replicated the issue on my system, and it appears to be due to an upstream source removing this parameter. For more details, see: https://github.com/benbjohnson/litestream/issues/533

Fixed :) #29