fractaledmind / litestream-ruby

MIT License
71 stars 6 forks source link

config.database_path issues #19

Closed richjdsmith closed 1 month ago

richjdsmith commented 4 months ago

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?

fractaledmind commented 4 months ago

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 commented 3 months ago

@richjdsmith: Have you gotten this sorted?

richjdsmith commented 1 month ago

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!