Skip to content

Instantly share code, notes, and snippets.

@spinscale
Last active November 21, 2023 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spinscale/65030c4ea36dd7fdab4e73253651487e to your computer and use it in GitHub Desktop.
Save spinscale/65030c4ea36dd7fdab4e73253651487e to your computer and use it in GitHub Desktop.
Litestream S3 issue
exec: /app/openpixel-sqlite-tracker/bin/openpixel-sqlite-tracker
dbs:
- path: /tmp/sqlite.db
replicas:
- type: s3
region: eu-central-1
bucket: THE_BUCKET
path: /db
access-key-id: AWS_ACCESS_KEY_ID
secret-access-key: AWS_SECRET_ACCESS_KEY
- type: file
path: /tmp/replica-sqlite/
$ litestream replicate -config litestream-s3.yml -exec ./build/install/openpixel-sqlite-tracker/bin/openpixel-sqlite-tracker
litestream v0.3.9
initialized db: /tmp/sqlite.db
replicating to: name="s3" type="s3" bucket="THE_BUCKET" path="/db" region="eu-central-1" endpoint="" sync-interval=1s
replicating to: name="file" type="file" path="/tmp/replica-sqlite"
[main] INFO de.spinscale.tracker.App - Using db [/tmp/sqlite.db]
[main] INFO org.eclipse.jetty.util.log - Logging initialized @245ms to org.eclipse.jetty.util.log.Slf4jLog
[main] INFO de.spinscale.tracker.App - Read pixel.gif with [43] bytes
[main] INFO io.javalin.Javalin -
__ __ _ __ __
/ /____ _ _ __ ____ _ / /(_)____ / // /
__ / // __ `/| | / // __ `// // // __ \ / // /_
/ /_/ // /_/ / | |/ // /_/ // // // / / / /__ __/
\____/ \__,_/ |___/ \__,_//_//_//_/ /_/ /_/
https://javalin.io/documentation
[main] INFO io.javalin.Javalin - Starting Javalin ...
[main] INFO io.javalin.Javalin - You are running Javalin 4.6.4 (released July 8, 2022).
[main] INFO io.javalin.Javalin - Static file handler added: StaticFileConfig(hostedPath=/public, directory=/public, location=CLASSPATH, precompress=false, aliasCheck=null, headers={Cache-Control=max-age=0}, skipFileFunction=Function1<javax.servlet.http.HttpServletRequest, java.lang.Boolean>). File system location: 'jar:file:/Users/alr/devel/openpixel-sqlite-tracker/build/install/openpixel-sqlite-tracker/lib/openpixel-sqlite-tracker-openpixel-tracker.jar!/public'
[main] INFO io.javalin.Javalin - Listening on http://0.0.0.0:8080/
[main] INFO io.javalin.Javalin - Javalin started in 71ms \o/
/tmp/sqlite.db(s3): snapshot written 5bf64df0be2c78f2/00000003
/tmp/sqlite.db(s3): monitor error: cannot determine replica position: no snapshot available: generation=5bf64df0be2c78f2
/tmp/sqlite.db(s3): snapshot written 5bf64df0be2c78f2/00000003
/tmp/sqlite.db(s3): monitor error: cannot determine replica position: no snapshot available: generation=5bf64df0be2c78f2
/tmp/sqlite.db(s3): snapshot written 5bf64df0be2c78f2/00000003
/tmp/sqlite.db(s3): monitor error: cannot determine replica position: no snapshot available: generation=5bf64df0be2c78f2
/tmp/sqlite.db(s3): snapshot written 5bf64df0be2c78f2/00000003
/tmp/sqlite.db(s3): monitor error: cannot determine replica position: no snapshot available: generation=5bf64df0be2c78f2
^Csignal received, litestream shutting down
[Thread-1] INFO io.javalin.Javalin - Stopping Javalin ...
sending signal to exec process
waiting for exec process to close
/tmp/sqlite.db(s3): snapshot written 5bf64df0be2c78f2/00000003
error closing db: path=/tmp/sqlite.db err=cannot determine replica position: no snapshot available: generation=5bf64df0be2c78f2
litestream shut down
cannot determine replica position: no snapshot available: generation=5bf64df0be2c78f2
@cr1cr1
Copy link

cr1cr1 commented Nov 21, 2023

remove the trailing /: /db should be db. There seems to be an issue when reading from a bucket that has a / prefix.

@spinscale
Copy link
Author

I tested with a newer version about a month ago and it worked fine actually, so maybe somethign else changed as well.

@cr1cr1
Copy link

cr1cr1 commented Nov 21, 2023

Well, for me did not work with "/", got the above error, but worked with "" as path. litestream:0.3.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment