You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you deploy on your own server, and if you do build as described in the docs - the site goes off for a minute.
I wanted to share my zero-downtime build script.
Create a file build.sh in the root folder:
#zero downtime deployment docusaurusecho"Deploy starting..."# Clear changes. This in case some files were accidentally changed on the remote server - they will block the "git pull" action.
git stash push --include-untracked
# Get updates
git pull
# Install new deps
npm install ||exit# Build into a "temp" directory in the root folder
npx docusaurus build --out-dir ./temp ||exit# If "temp" folder couldn't be created - exitif [ !-d"temp" ];thenecho'\033[31m temp directory not exists!\033[0m'exit 1;fi# Rename current build folder to build_old
mv build build_old
# Rename new build folder to build
mv temp build
# Delete old build folder
rm -rf build_old
# Reload the server (if you use pm2)
pm2 reload your_process_name --update-env
echo"Deploy done."
Then when you need to build the project and restart the server - just go the root folder and do this:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi guys,
If you deploy on your own server, and if you do build as described in the docs - the site goes off for a minute.
I wanted to share my zero-downtime build script.
Create a file
build.sh
in the root folder:Then when you need to build the project and restart the server - just go the root folder and do this:
Beta Was this translation helpful? Give feedback.
All reactions