Predeploy hook failing with goose in golang app: bash: goose: command not found

I have a simple golang server deployed with Render. Im using goose (GitHub - pressly/goose: A database migration tool. Supports SQL migrations and Go functions.) for db migrations. Goose is working normally in development on my machine. When I deploy using the predeploy hook: GOOSE_DRIVER=postgres GOOSE_DBSTRING=“user=dbname=sslmode=” goose -dir ./db/migrations up (removed values for post) I get this error and the deploy fails:
bash: goose: command not found

Anyone have experience with this? WOuld like to get it solved so I can deploy my most recent changes.

Hi,

I’m not a Golang expert, but is goose being installed as part of your build?

Kind regards

Alan

Thanks for the response. I am installing goose as part of the build step, but unfortunately still getting that error. Might try a different db migration tool : /

If you’re still seeing bash: goose: command not found then it’s not being installed successfully.

Maybe share your build command and the logs around it being run to show a little more detail.

Alan

build command: go get -u github.com/pressly/goose/v3/cmd/goose && go build -tags netgo -ldflags ‘-s -w’ -o cmd/web/app ./cmd/web

pre-deploy: ./goose -dir ./migrations postgres “db info” up

It’s hard to suggest anything without the accompanying deploy logs around those commands.

If you don’t want to share these details on the community forum, please feel free to raise a ticket from the “Help” or “Contact Support” links while logged into the Dashboard.

Alan

Sorry about that, here are logs + updated pre-deploy script with the build command listed above:
==> Build successful :tada:

Jan 19 12:26:29 PM==> Starting pre-deploy: GOOSE_DRIVER=postgres GOOSE_DBSTRING=“” goose migrate up

Jan 19 12:27:10 PM==> Pre-deploy has failed

Jan 19 12:27:08 PM==> Using Node version 20.10.0 (default)

Jan 19 12:27:08 PM==> Docs on specifying a Node version: Setting Your Node.js Version | Render Docs

Jan 19 12:27:09 PM==> Running ‘GOOSE_DRIVER=postgres GOOSE_DBSTRING=“removed” goose migrate up’

Jan 19 12:27:09 PMbash: goose: command not found

Those logs don’t show the Build Command that is being run prior to that.

Maybe raise a ticket from the “Help” or “Contact Support” links while logged into the Dashboard, so that we can take a look at your setup from our side.

Alan

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