Next.js integration for Capistrano with systemd support.
Add this line to your application's Gemfile:
gem 'capistrano-nextjs'And then execute:
bundle installAdd the following to your Capfile:
require 'capistrano/pnpm'
require 'capistrano/nextjs'
install_plugin Capistrano::NextjsPlugin
install_plugin Capistrano::NextjsSystemdAdd the following to your config/deploy.rb:
# Next.js configuration
set :nextjs_roles, :app
set :nextjs_env, fetch(:stage)cap nextjs:start- Start Next.js applicationcap nextjs:stop- Stop Next.js applicationcap nextjs:restart- Restart Next.js applicationcap nextjs:status- Check Next.js application statuscap nextjs:install- Install systemd servicecap nextjs:uninstall- Uninstall systemd servicecap nextjs:build- Build Next.js applicationcap nextjs:check- Check Next.js application (lint)
The gem automatically integrates with your deployment process:
- Stops the service before deployment
- Starts the service after successful deployment
- Restarts the service if deployment fails
- Node.js
- pnpm
- systemd (for service management)
The gem is available as open source under the terms of the LGPL-3.0 License.