build 1 -> deploy 1 -> wait -> build 2 -> deploy 2 setup
martinerko
HOBBYOP

a year ago

Hi

I have a specific setup of my app and would love your advice on the setup.

Its a monorepo that hosts two apps:

- backend (medusajs)

- storefront (nextjs)

First I need to build and deploy backend app which provides API services that storefront depends on. This app lives in apps/backend and has /health check exposed.

Once it is deployed and running just then I can start building storefront, because storefront app makes a bunch of API calls to backend app in order to generate static pages.

Storefront does not have healthcheck endpoint since its completely static.

How can I achive the order of build 1 -> deploy 1 -> wait -> build 2 -> deploy 2

Lastly, time to time I need to execute db migrations, what would be the best way to do it, knowing that migration files exists in a particular folder, so we can detect changes in this folder.

Thank you

Solved

2 Replies

jaredlunde
EMPLOYEE

a year ago

You should be able to use npx wait-on [service] && next build in your build script to achieve this.

https://www.npmjs.com/package/wait-on#cli-usage

Migrations can be run in the same way e.g. prisma migrate && npx wait-on [service] && next build


martinerko
HOBBYOP

a year ago

thank you!


Loading...