Roots Discourse

Doing production builds without downtime?



We are working on getting our build tooling set up for our production site. One of our requirements is that we should not have any downtime whenever we deploy changes. We are following the Sage 9 book recommended practice of building on the production server. However, the build process for Sage 9 when the user runs yarn build:production results in about a 10 second timeframe where the ./dist directory is completely deleted while assets are rebuilt.

We would like to modify this behavior so that the assets are built in a different directory on our production server, then we delete ./dist and move the built assets into the same location to prevent downtime during the build.

Has anyone else done this, or can point me towards documentation on either yarn, webpack, or the appropriate tooling that I can start reading on?


Hey @pkarjala,

Your simplest options may be to either have Trellis compile and deploy your assets if you’re using Trellis (discussed in the same section of the Sage book) or to use a service like DeployBot to handle this (see this guide).

Those are just two options and other folks may have additional suggestions or be able to give you pointers on modifying Sage’s build process like you described.


Trellis deploys still have a tiny downtime while PHP restarts but it’s much smaller than the Sage rebuild window.