sinpro.dev
Docs
Team sinProject
Funny Apps
  • Company Information
    • Portfolio
    • About
    • Services
    • Events
  • Dev Environment
    • macOS Settings
    • Chrome Extensions
    • VSCode Workspace Settings
    • VSCode Workspace Extensions
    • Global NPM Packages
    • npm-check-updates
    • SvelteKit
    • Customize Zsh
    • ChatGPT Prompts
    • Tailwind CSS
    • Warp
    • Keyboard Shortcuts
  • Assets
    • Assets
    • JPG/PNG to AVIF
    • TTF to WOFF2
  • Clean Code
    • Clean Code
    • Format
    • Quality
    • Variables
    • Functions
    • Objects and Data Structures
    • Classes
    • Concurrency
    • Error handling
    • Comments
  • Code Style
    • TypeScript Config
    • Prettier
    • ESLint
    • Stylelint
  • Testing
    • Vitest
    • Playwright
  • Git
    • Git Branches and Commits
    • Git Hooks
    • Git User Profiles
    • Git for Windows
  • GitHub
    • GitHub Issues
    • GitHub Pull Requests
    • GitHub Repository Settings
    • GitHub Branch Protection
    • GitHub Actions
  • Code Quality
    • SonarCloud Coverage
  • Server
    • SSH
    • PM2
    • Caddy
    • Updating the server
    • ngrok
  • Team sinProject
    • Our Team Policy
    • Equipment and Supplies
    • Books
    • Slack
    • Locales
    • Funny Apps
    • Docs History
  • Talk
    • Talk
    • Creating a Project
    • App Structure

Server

PM2

Edit this page

PM2 is a daemon process manager that will help you manage and keep your application online 24/7.

PM2 Quick Start >

Installation

Bash
npm install pm2@latest -g

Starting

Bash
pm2 start app.js

Monitoring

Bash
pm2 monit

Microservice

list all processes:

Bash
pm2 list

display logs:

Bash
pm2 logs

Act on them:

Bash
pm2 stop [app_name | all]
pm2 restart [app_name | all]
pm2 delete [app_name | all]

Troubleshooting

If the ‘stop’ or ‘delete’ commands do not work, execute the following command.

Bash
pm2 reload [app_name | all]

Ecosystem File

ecosystem.config.cjs
module.exports = {
	apps: [
		{
			name: 'sinpro-dev',
			script: 'build',
			interpreter: 'node',
			interpreterArgs: '--loader tsx',
			instances: '-1',
			exec_mode: 'cluster',
			watch: false,
			ignore_watch: ['logs'],
			env: {
				PORT: 3001,
			},
		},
	],
}
[talk]ecosystem.config.cjs
module.exports = {
	apps: [
		{
			name: 'talk',
			script: './server/index.ts',
			interpreter: 'node',
			interpreterArgs: '--loader tsx',
			instances: '-1',
			exec_mode: 'cluster',
			watch: false,
			ignore_watch: ['logs'],
			env: {
				PORT: 3002,
			},
		},
	],
}

Start it easily:

Bash
pm2 start ecosystem.config.cjs

More info >

SSH Caddy
© sinProject. v0.73.0
On this page
  • PM2
  • Installation
  • Starting
  • Monitoring
  • Microservice
  • Troubleshooting
  • Ecosystem File