Report this

What is the reason for this report?

App platform [Go App]: How to install `goose` package for migrations

Posted on April 29, 2023

How to install additional packages which are not part of the go.mod, for example the goose package: https://github.com/pressly/goose I’m using goose package for managing migrations, and I can’t find a way to install it on App Platform.

I tried adding go install https://github.com/pressly/goose/v3/cmd/goose@latest to Build Command section, and the package is installed, but I can’t access it through Console. Then I tried: go install https://github.com/pressly/goose/v3/cmd/goose@latest && goose up (this is inside Build Command) which should execute the migrations, but in the build logs I get error that goose is not found.

I hope someone will have answers for my problems :)



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

I would suggest including the module in your go.mod file so that it will be auto-detected and installed during the build process. Do you have any specific concerns about including the module there?

Regarding the migration step itself, usually, it is best to run your migrations during the deployment/run process rather than the build process itself. That way if the deploy porcess fails but the build process completes and your migrations are executed, then you will end up in a sutiation where your running code might not be compatible with the new schema changes.

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.