undb icon indicating copy to clipboard operation
undb copied to clipboard

🐛 [BUG] - Litestream in docker compose not working

Open B4rtware opened this issue 1 year ago • 2 comments

Description

I'm getting errors the way the docker compose file is being written right now.

When starting the undb service the following error occurs: cannot fetch generations: cannot lookup bucket region: InvalidAccessKeyId: The AWS Access Key Id you provided does not exist in our records.

It seems like someone else got the same issue and opened an issue (provides a fix): https://github.com/benbjohnson/litestream/discussions/478

When mounting this fix through docker compose ./litestream.yml:/etc/litestream.yml

litestream.yml:

access-key-id:     minioadmin
secret-access-key: minioadmin

dbs:
  - path: /var/opt/.undb/undb.db
    replicas:
      - type: s3
        bucket: undb
        path: undb.db
        endpoint: http://minio:9000

I am able to execute litestream replicate manually but I think because this line in the start.mjs: https://github.com/undb-xyz/undb/blob/c8322050fb569ac41d1d5462828dff326ff2e575/scripts/start.mjs#L10 the command does not use the provided replicas? Maybe using an endpoint environment variable could fix it.

And with this line, the client threw a warning about one should use anonymous: https://github.com/undb-xyz/undb/blob/c8322050fb569ac41d1d5462828dff326ff2e575/docker/docker-compose.minio.yaml#L37C7-L37C53 /usr/bin/mc anonymous set public undb_minio/undb; This seems to fix the warning.

If you think this makes sense, I can also create a pull request.

Reproduction URL

No response

Reproduction steps

Execute the current docker compose file via `docker compose up`.

Screenshots

No response

Logs

undb                  | No database found, restoring from replica if exists
undb                  | $ litestream restore -v -if-replica-exists -o /var/opt/.undb/undb.db "s3://undb.minio:9000/undb.db"
undb                  | cannot fetch generations: cannot lookup bucket region: InvalidAccessKeyId: The AWS Access Key Id you provided does not exist in our records.
undb                  |         status code: 403, request id: HTE4KMS9T..., host id: gmSnCk7hkA6gsYBTR7PpbOtR+lslV4t3F5gTPTyUxvtd...
undb                  | Error: cannot fetch generations: cannot lookup bucket region: InvalidAccessKeyId: The AWS Access Key Id you provided does not exist in our records.
undb                  |         status code: 403, request id: HTE4KMS9T..., host id: gmSnCk7hkA6gsYBTR7PpbOtR+lslV4t3F5gTPTyUxvtddrk8...
undb                  |     at file:///undb/scripts/start.mjs:10:12
undb                  |     exit code: 1
undb exited with code 1

Browsers

Chrome

B4rtware avatar Jul 22 '23 10:07 B4rtware

I have now tested it with Backblaze B2 as well. It works with litestream's provided config from https://litestream.io/guides/backblaze/. The restore documentation states that using the replica_url does not use the configuration file. So maybe using the database path might be an option With a database path:

root@c11b18bbf5f1:/undb# litestream restore -if-db-not-exists -if-replica-exists /var/opt/.undb/undb.db
database already exists, skipping

B4rtware avatar Jul 22 '23 13:07 B4rtware

thanks I will take a look

nichenqin avatar Jul 24 '23 11:07 nichenqin