Error: Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1

I have a redwoodjs application that I am trying to deploy using the fly launch command. The first time it deployed successfully but then the second time it failed with the v0 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1 error. What am I missing?

I have attached the fly.toml, redwood.toml and the deployment output below

Also how would I change the deployment process to use postgres database from supabase? currently it seems to be using sqllite as the backend database for the application.


app = "usermanagement"
kill_signal = "SIGINT"
kill_timeout = 5
primary_region = "sea"
processes = []
  release_command = ".fly/"
  DATABASE_URL = "file://data/sqlite.db"
  MIGRATE_ON_BOOT = "true"
  PORT = "8910"
  auto_rollback = true
  destination = "/data"
  source = "data"
  http_checks = []
  internal_port = 8910
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
    hard_limit = 25
    soft_limit = 20
    type = "connections"
    force_https = true
    handlers = ["http"]
    port = 80
    handlers = ["tls", "http"]
    port = 443
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"


  title = "Redwood App"
  port = 8910
  apiUrl = "/.redwood/functions" 
  includeEnvironmentVariables = ["SUPABASE_URL", "SUPABASE_KEY"] 
  port = 8913
  open = true
  versionUpdates = ["latest"]

fly launch output:

$ fly launch
An existing fly.toml file was found for app usermanagement
? Would you like to copy its configuration to the new app? Yes
Creating app in /home/ajitgoel/User-Management-App-with-RedwoodJS-Supabase
Scanning source code
Detected a RedwoodJS app
? Choose an app name (leaving blank will default to 'usermanagement')
automatically selected personal organization: Ajit Kumar Goel
Some regions require a paid plan (fra, maa).
See to set up a plan.

? Choose a region for deployment: Seattle, Washington (US) (sea)
Created app 'usermanagement' in organization 'personal'
Admin URL:
? Overwrite "/home/ajitgoel/User-Management-App-with-RedwoodJS-Supabase/.dockerignore"? No
? Overwrite "/home/ajitgoel/User-Management-App-with-RedwoodJS-Supabase/.fly/"? No
? Overwrite "/home/ajitgoel/User-Management-App-with-RedwoodJS-Supabase/.fly/"? No
? Overwrite "/home/ajitgoel/User-Management-App-with-RedwoodJS-Supabase/.fly/"? No
? Overwrite "/home/ajitgoel/User-Management-App-with-RedwoodJS-Supabase/Dockerfile"? No
Created a 1GB volume vol_xme149kq515vowpl in the sea region
? Would you like to set up a Postgresql database now? Yes
? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk
Creating postgres cluster in organization personal
Creating app...
Setting secrets on app usermanagement-db...
Provisioning 1 of 1 machines with image flyio/postgres-flex:15.2@sha256:8e00d751bb9811bc8511d7129db2cc5a515449cf4a7def8f1d60faacb2be91c6
Waiting for machine to start...
Machine 148ed2dda71989 is created
==> Monitoring health checks
  Waiting for 148ed2dda71989 to become healthy (started, 3/3)

Postgres cluster usermanagement-db created
  Username:    postgres
  Password:    aOSDMZdDEkvwj2F
  Hostname:    usermanagement-db.internal
  Flycast:     fdaa:1:94ed:0:1::4
  Proxy port:  5432
  Postgres port:  5433
  Connection string: postgres://postgres:aOSDMZdDEkvwj2F@usermanagement-db.flycast:5432

Save your credentials in a secure place -- you won't be able to see them again!

Connect to postgres
Any app within the Ajit Kumar Goel organization can connect to this Postgres using the above connection string

Now that you've set up Postgres, here's what you need to understand:
Checking for existing attachments
Registering attachment
Creating database
Creating user

Postgres cluster usermanagement-db is now attached to usermanagement
The following secret was added to usermanagement:
Postgres cluster usermanagement-db is now attached to usermanagement
? Would you like to set up an Upstash Redis database now? No
Wrote config file fly.toml

This deployment will run an SQLite on a single dedicated volume. The app can't scale beyond a single instance. Look into 'fly postgres' for a more robust production database that supports scaling up.

? Would you like to deploy now? Yes
==> Building image
Remote builder fly-builder-damp-haze-8863 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
[+] Building 5.0s (0/1)
[+] Building 83.3s (24/24) FINISHED
 => [internal] load remote build context                                                                 0.0s
 => copy /context /                                                                                      0.1s
 => [internal] load metadata for                                   0.9s
 => [base 1/3] FROM  1.3s
 => => resolve  0.0s
 => => sha256:97518928ae5f3d52d4164b314a7e73654eb686ecd8aafa0b79acd980773a740d 2.82MB / 2.82MB           0.1s
 => => sha256:784cd1fd612b7ef9870aa1d85ca7285010993bc089f1a00ae1dcd6644074a398 34.81MB / 34.81MB         0.3s
 => => sha256:0ec5d186b713b05c9f9ebb40df5c7c3f3b67133a2effbf3e3215756220136363 2.35MB / 2.35MB           0.1s
 => => sha256:98dc27ad6276f18e415689e0d39332e7cac56ed95b678093f61193bb0bd9db01 451B / 451B               0.0s
 => => sha256:60ef0bed1dc2ec835cfe3c4226d074fdfaba571fd619c280474cc04e93f0ec5b 1.43kB / 1.43kB           0.0s
 => => sha256:5277c7d171e02ee76417bb290ef488aa80e4e64572119eec0cb9fffbcffb8f6a 1.16kB / 1.16kB           0.0s
 => => sha256:44e24535dfbf4b537a7ac13e92c524712c3226af52c0e1037eba7415c16a5828 6.53kB / 6.53kB           0.0s
 => => extracting sha256:97518928ae5f3d52d4164b314a7e73654eb686ecd8aafa0b79acd980773a740d                0.1s
 => => extracting sha256:784cd1fd612b7ef9870aa1d85ca7285010993bc089f1a00ae1dcd6644074a398                0.8s
 => => extracting sha256:0ec5d186b713b05c9f9ebb40df5c7c3f3b67133a2effbf3e3215756220136363                0.1s
 => => extracting sha256:98dc27ad6276f18e415689e0d39332e7cac56ed95b678093f61193bb0bd9db01                0.0s
 => [base 2/3] RUN mkdir /app                                                                            0.3s
 => [base 3/3] WORKDIR /app                                                                              0.0s
 => [dependencies 1/9] COPY .yarn .yarn                                                                  0.0s
 => [dependencies 2/9] COPY .yarnrc.yml .yarnrc.yml                                                      0.0s
 => [dependencies 3/9] COPY package.json package.json                                                    0.0s
 => [dependencies 4/9] COPY web/package.json web/package.json                                            0.0s
 => [dependencies 5/9] COPY api/package.json api/package.json                                            0.0s
 => [dependencies 6/9] COPY yarn.lock yarn.lock                                                          0.0s
 => [dependencies 7/9] RUN --mount=type=cache,target=/root/.yarn/berry/cache     --mount=type=cache,ta  37.6s
 => [dependencies 8/9] COPY redwood.toml .                                                               0.0s
 => [dependencies 9/9] COPY graphql.config.js .                                                          0.0s
 => [api_build 1/2] COPY api api                                                                         0.0s
 => [web_build 1/2] COPY web web                                                                         0.0s
 => [web_build 2/2] RUN yarn rw build web                                                               34.9s
 => [api_build 2/2] RUN yarn rw build api                                                               11.8s
 => [stage-4 1/4] COPY --from=web_build /app/web/dist /app/web/dist                                      0.0s
 => [stage-4 2/4] COPY --from=api_build /app/api /app/api                                                0.0s
 => [stage-4 3/4] COPY --from=api_build /app/node_modules/.prisma /app/node_modules/.prisma              0.0s
 => [stage-4 4/4] COPY .fly .fly                                                                         0.0s
 => exporting to image                                                                                   8.1s
 => => exporting layers                                                                                  8.1s
 => => writing image sha256:db5eaad600b8fbd3c443955dd5cf26c0bf53ab122ea092aa3b63117f7066b6b3             0.0s
 => => naming to                    0.0s
--> Building image done
==> Pushing image to fly
The push refers to repository []
c9216316e4de: Pushed
b80bfb3d992f: Pushed
a5cb28d64c86: Pushed
c3867bf81963: Pushed
df92f2194a61: Pushed
f39a4c23634b: Pushed
bc130949e53e: Pushed
85d5447250bc: Pushed
ecc9c00cd612: Pushed
148e2edb436f: Pushed
91aa2cd9d296: Pushed
1984d0089994: Pushed
137ecaaa34bf: Pushed
5f70bf18a086: Pushed
269e53973a26: Pushed
ff64ee97d76a: Pushed
480f61641fa1: Pushed
b3eaed7a085d: Pushed
1a058d5342cc: Pushed
deployment-01GWRBAVA1N3MT26W85VDT6G9J: digest: sha256:7e94425b5b0d5d480fe00ffb053b43f01ef2d29f7f2ac9c0068c561ec4eda962 size: 4284
--> Pushing image done
image size: 652 MB
==> Creating release
--> release v2 created

--> You can detach the terminal anytime without stopping the deployment
==> Release command detected: .fly/

--> This release will not be available until the release command succeeds.
         Starting instance
         Configuring virtual machine
         Pulling container image
         Unpacking image
         Starting init (commit: 8e03fa6)...
         2023/03/30 04:12:48 listening on [fdaa:1:94ed:a7b:121:1386:fd7:2]:22 (DNS: [fdaa::3]:53)
         + '[' '!' -n true ]
         Starting instance
         Configuring virtual machine
         Pulling container image
         Unpacking image
         Preparing kernel init
         Configuring firecracker
         Starting virtual machine
         Starting init (commit: 8e03fa6)...
         Preparing to run: `sh .fly/` as root
         2023/03/30 04:12:48 listening on [fdaa:1:94ed:a7b:121:1386:fd7:2]:22 (DNS: [fdaa::3]:53)
         + '[' '!' -n true ]
         Starting clean up.
         Starting clean up.
==> Monitoring deployment

 1 desired, 1 placed, 0 healthy, 1 unhealthy [restarts: 2] [health checks: 1 total]
Failed Instances

Failure #1

ce1dcba4        app     0       sea     run     running 1 total         2               29s ago

Recent Events
TIMESTAMP               TYPE            MESSAGE
2023-03-30T04:12:51Z    Received        Task received by client
2023-03-30T04:12:51Z    Task Setup      Building Task Directory
2023-03-30T04:13:03Z    Started         Task started by client
2023-03-30T04:13:09Z    Terminated      Exit Code: 1
2023-03-30T04:13:09Z    Restarting      Task restarting in 1.215615719s
2023-03-30T04:13:15Z    Started         Task started by client
2023-03-30T04:13:21Z    Terminated      Exit Code: 1
2023-03-30T04:13:21Z    Restarting      Task restarting in 1.022358845s
2023-03-30T04:13:26Z    Started         Task started by client

2023-03-30T04:13:25Z   [info]Configuring firecracker
2023-03-30T04:13:25Z   [info]Starting virtual machine
2023-03-30T04:13:26Z   [info]Starting init (commit: 8e03fa6)...
2023-03-30T04:13:26Z   [info]Mounting /dev/vdc at /data w/ uid: 0, gid: 0 and chmod 0755
2023-03-30T04:13:26Z   [info]Preparing to run: `sh .fly/` as root
2023-03-30T04:13:26Z   [info]2023/03/30 04:13:26 listening on [fdaa:1:94ed:a7b:121:6:4933:2]:22 (DNS: [fdaa::3]:53)
2023-03-30T04:13:26Z   [info]+ '[' -n true ]
2023-03-30T04:13:26Z   [info]+ dirname .fly/
2023-03-30T04:13:26Z   [info]+ .fly/
2023-03-30T04:13:26Z   [info]+ npx prisma migrate deploy --schema /app/api/db/schema.prisma
2023-03-30T04:13:28Z   [info]Prisma schema loaded from api/db/schema.prisma
2023-03-30T04:13:28Z   [info]Datasource "db": SQLite database
2023-03-30T04:13:28Z   [info]Error: Prisma schema validation - (get-config wasm)
2023-03-30T04:13:28Z   [info]Error code: P1012
2023-03-30T04:13:28Z   [info]error: Error validating datasource `db`: the URL must start with the protocol `file:`.
2023-03-30T04:13:28Z   [info]  -->  schema.prisma:3
2023-03-30T04:13:28Z   [info]   |
2023-03-30T04:13:28Z   [info] 2 |   provider = "sqlite"
2023-03-30T04:13:28Z   [info] 3 |   url      = env("DATABASE_URL")
2023-03-30T04:13:28Z   [info]   |
2023-03-30T04:13:28Z   [info]Validation Error Count: 1
2023-03-30T04:13:28Z   [info][Context: getConfig]
2023-03-30T04:13:28Z   [info]Prisma CLI Version : 4.11.0
2023-03-30T04:13:29Z   [info]npm notice
2023-03-30T04:13:29Z   [info]npm notice New major version of npm available! 8.1.0 -> 9.6.2
2023-03-30T04:13:29Z   [info]npm notice Changelog: <>
2023-03-30T04:13:29Z   [info]npm notice Run `npm install -g npm@9.6.2` to update!
2023-03-30T04:13:29Z   [info]npm notice
2023-03-30T04:13:30Z   [info]Umarting clean up.
2023-03-30T04:13:30Z   [info]Umounting /dev/vdc from /data
--> v0 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1

--> Troubleshooting guide at
Error abort

I’m not super familiar with redwood but I did find this: redwoodjs-supabase-quickstart/.env.defaults at main · redwoodjs/redwoodjs-supabase-quickstart · GitHub

In that example it does file: instead of the usual protocol style file://. Sort of an odd thing! I’d maybe try switching that DATABASE_URL to file:/data/sqlite.db to start.