mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
9a3fc8a44e
Co-authored-by: SAWADA Takayoshi <sawadasuiren@gmail.com> |
||
---|---|---|
.. | ||
pages | ||
ecosystem.config.js | ||
nuxt.config.ts | ||
package.json | ||
README.md | ||
tsconfig.json |
Nuxt.ts with PM2 example
pm2 ia an advanced process manager for production Node.js applications. Load balancer, logs facility, startup script, micro service management and more.
Gracefull zero-downtime restart
ecosystem.config.js
- configuration file for pm2
listen_timeout
option depends on your need
Zero-downtime deployment
*all depends on your deployment method. It's just example
Directories:
$PROJECT_ROOT
- your project root path on server/current
- root dir for nginx(if you are using proxy configuration)/_tmp
- Temporary dir to install and build project/_old
- Previous build. Can be useful for fast reverting
Steps:
- deploy project to $PROJECT_ROOT/_tmp
cd $PROJECT_ROOT/_tmp
npm i
nuxt build
or if you are using TypeScriptnuxt-ts build
mv $PROJECT_ROOT/current $PROJECT_ROOT/_old
mv $PROJECT_ROOT/_tmp $PROJECT_ROOT/current
cd $PROJECT_PATH/current
pm2 startOrReload ecosystem.config.js