litestream-ruby icon indicating copy to clipboard operation
litestream-ruby copied to clipboard

config.database_path issues

Open richjdsmith opened this issue 1 year ago • 2 comments

Since updating to 0.5.1, I am unable to configure the $LITESTREAM_DATABASE_PATH via the litestream.rb config file. It seems to be pulling in just the project directory:

time=2024-04-17T17:40:30.666-07:00 level=ERROR msg="sync error" db=/home/richsmith/workspace/retiredmortgages error="unable to open database file: is a directory"

Not quite sure how to begin fixing this, or if the project moved away from that method?

richjdsmith avatar Apr 18 '24 00:04 richjdsmith

Yes, we are moving away from using LITESTREAM_DATABASE_PATH as it restricts Litestream to only backing up one database. The new install generator introspects your database.yml and sets up Litestream to backup all SQLite databases used in production.

If you past your config/litestream.yml file contents (redacted as you see fit), I can tell you how to update it to get things working again.

fractaledmind avatar Apr 18 '24 07:04 fractaledmind

@richjdsmith: Have you gotten this sorted?

fractaledmind avatar May 05 '24 14:05 fractaledmind

Hey Stephen,

I apologize! I did not notice this notification.

I did end up sorting it, and for anyone who comes across this, here's my litestream.yml

# This is the actual configuration file for litestream.
#
# You can either use the generated `config/initializers/litestream.rb`
# file to configure the litestream-ruby gem, which will populate these
# ENV variables when using the `rails litestream:replicate` command.
#
# Or, if you prefer, manually manage ENV variables and this configuration file.
# In that case, simply ensure that the ENV variables are set before running the
# `replicate` command.
#
# For more details, see: https://litestream.io/reference/config/
dbs:
  # - path: ./db/development/data.sqlite3
  - path: ./db/development/data.sqlite3
  # - path: $LITESTREAM_DATABASE_PATH
    replicas:
      - type: s3
        endpoint: $LITESTREAM_REPLICA_BUCKET
        bucket: REDACTED-db-backup
        region: us-east-1
        # path: ./db/production/data.sqlite3
        # path: $LITESTREAM_DATABASE_PATH
        access-key-id: $LITESTREAM_ACCESS_KEY_ID
        secret-access-key: $LITESTREAM_SECRET_ACCESS_KEY

This is now working perfectly with Litestack!

Sorry for leaving this open!

richjdsmith avatar Jul 18 '24 19:07 richjdsmith