How to deploy Rails app with Sqlite DB?

Hi all, I’ve been trying to add a Rails app with sqllite db server but it doesn’t work at all. Somehow I’ve got the app deployed but now the sqlite3 db doesn’t seem to work.

ActionView::Template::Error (SQLite3::SQLException: no such table: businesses: SELECT  "businesses".* FROM "businesses" ORDER BY "businesses"."id" ASC LIMIT ?)

This is the error I get when I visit the web site.
My fly.toml looks like this

# fly.toml file generated for dawn-glitter-6907 on 2022-07-12T10:21:00+05:30

app = "test-app"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[build]
  [build.args]
    BUNDLER_VERSION = "1.17.3"
    NODE_VERSION = "14"
    RUBY_VERSION = "2.6.9"

[deploy]
  release_command = "bundle exec rails db:migrate"

[env]
  PORT = "3000"
  SERVER_COMMAND = "bundle exec puma -C config/puma.rb"


[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 3000
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

[[statics]]
  guest_path = "/app/public"
  url_prefix = "/"

Some help would be appreciated.

PS: The only reason I’m deploying the app with sqlite3 db is because of the existing production data is in the db and migrating the data from sqlite to postgresql seemed like a lot of pain.

Hello! I think you need to create + attach a Volume if you want data stored in your SQLite DB to persist across deploys. I didn’t see any [mounts] section in your fly.toml so I think that’s what’s missing. Hope that helps!