Question

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

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 :)


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
May 10, 2023

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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel