initialDeployHook running after startCommand

It’s not entirely clear in the Blueprint, but based on running the blueprint, it seems the initialDeployHook actually runs after startCommand and not before as it I would expect.

The example given for initialDeployHook in the documentation is:

You may want to run custom initialization for your preview environment after it is created but not on subsequent deploys, for example to seed a newly created database or download files to disk

It seems if you’re going to seed the database, you should do it before the startCommand where the service actually starts.

In my case, my initialDeployHook imports a small snapshot of my development data into the database in order the PR review app to work. However, my app is failing because the startCommand runs first and attempts to launch the app before the database is properly seeded, causing the app to fail.

Isn’t this a bug? Any suggestions appreciated.

Conrad

1 Like

Hey Conrad,

This is working as intended but not the implementation that you want here.

Customers have been requesting https://feedback.render.com/features/p/release-phase-script which sounds more like what you want which would run before the service is deployed. Make sure to upvote that feedback item.

Regards,

John B

1 Like

Hi John,

I noticed initialDeployHook times out after 15-minute. Is there a way to extend that out?

I’m importing a larger database to seed our preview environments, and I noticed there was a 15-minute out.

Apr 27 01:38:24 AM  /home/render/after-first-deploy.sh: line 38:   139 Killed                  timeout -s KILL "$duration" /bin/sh -c -- "$cmd"
Apr 27 01:38:24 AM  ==> Post Deploy Command Failed 😞
Apr 27 01:38:24 AM  ==> It ran too long and was stopped.

Hi there,
It’s not possible to change the timeout but you could use our API to trigger a ‘job’ to run which will run to completion - see https://render.com/docs/jobs in your script there

John B

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.