Skip to content

Releases: pjt3591oo/mungrever

클러스터 모드 추가

26 Jun 02:16
Compare
Choose a tag to compare
  • 클러스터 모드 실행옵션

클러스터 모드로 생성된 프로세스는 exception 등으로 종료될 경우 다시 실행

외부 signal로 인해 죽을경우 다시 생성하지 않으며 종료된 프로세스는 제거됩니다

$ mungrever start example/simple-server.js -i [인스턴스 수]
  • 프로세스 목록조회

프로세스 타입은 다음과 같이 나뉜다

fork, cluster

$ mungrever list

info:    BASE Directory: /Users/jeongtaepark/.mungrever
info:    Forever processes running
┌─────────┬───────────┬───────┬───────────┬──────────────────────────────────────────────────────────────────┬───────────────┐
│ (index) │ mungrever │  pid  │   mode    │                              script                              │    uptime     │
├─────────┼───────────┼───────┼───────────┼──────────────────────────────────────────────────────────────────┼───────────────┤
│    0    │   51938   │ 51964 │ 'cluster''/usr/local/lib/node_modules/mungrever/example/simple-server.js' │ 1656209686563 │
│    1    │   51938   │ 51966 │ 'cluster''/usr/local/lib/node_modules/mungrever/example/simple-server.js' │ 1656209686567 │
└─────────┴───────────┴───────┴───────────┴──────────────────────────────────────────────────────────────────┴───────────────┘
  • 프로세스 삭제

클러스터 모드의 프로세스가 삭제될 경우 해당 인스턴스는 모두 삭제된다

$ mungrever delete [index]
  • 프로세스 로그

클러스터 모드의 프로세스는 개별적인 PID를 할당받으므로, 개별적으로 로그가 관리된다

$ mungrever log [index]
  • 프로세스 로그 모니터링

클러스터 모드의 프로세스는 개별적인 PID를 할당받으므로, 개별적으로 로그가 관리된다

$ mungrever monit [index]

커맨드 옵션 추가 및 문서포맷 변경

23 Jun 05:36
Compare
Choose a tag to compare
  • start options
$ mungrever help start
Usage: mungrever start [options] <string>

create process by [*.js]

Arguments:
  string       *.js

Options:
  -w, --watch  Watch for file changes
  -d, --debug  Forces forever to log debug output
  -i <number>  cluster count
  -h, --help   display help for command
  • 커맨드 실행
# rust 프로세스
$ mungrever start ./ -c './example/test'

# golang 프로세스
$ mungrever start ./ -c 'go run ./example/test.go'

# python 프로세스
$ mungrever start ./ -c 'python ./example/test.py'

실행옵션 추가 & pid 관리 개선

22 Jun 04:25
Compare
Choose a tag to compare

pid 관리 개선

mungrever로 실행중인 monitor 프로세스가 kill 시그널을 통해 죽을경우 process.on('시그널') 핸들러에서 mungrever이 관리중인 .mungrever/mungrever.pid에서 해당 프로세스를 제거

실행옵션 추가

$ mungrever help start
Usage: mungrever start [options] <string>

create process by [*.js]

Arguments:
  string       *.js

Options:
  -w, --watch  Watch for file changes
  -d, --debug  Forces forever to log debug output
  -i <number>  cluster count
  -h, --help   display help for command
  • 디버그모드

모니터 프로세스로 동작중인 프로세스의 출력(표준출력/에러)을 터미널 세션으로 출력

$ mungrever start example/simple-server.js -d
  • 와치모드

실행중인 스크립트가 존재하는 디렉터리를 기준으로 변경이 감지되면 스크립트 재시작.

와치 모드는 기본적으로 디버깅 모드로 동작한다.

$ mungrever start example/simple-server.js -w

monit 기능 추가

21 Jun 07:53
Compare
Choose a tag to compare
  • help
$ mungrever help
Usage: mungrever [options] [command]

CLI to process management

Options:
  -V, --version             output the version number
  -h, --help                display help for command

Commands:
  start [options] <string>  create process by [*.js]
  log <number>              view log by process index
  delete <number>           process delete by process index
  list                      managed process lise
  monit <number>            show log monitor
  help [command]            display help for command
  • command
$ mungrever log [index]

mungrever open

21 Jun 07:55
Compare
Choose a tag to compare

mungrever

mungrever는 forever를 모방한 프로세스 관리 도구입니다.

$ npm install -g mungrever
$ mungrever help
Usage: mungrever [options] [command]

CLI to process management

Options:
  -V, --version             output the version number
  -h, --help                display help for command

Commands:
  start [options] <string>  create process by [*.js]
  log <number>                  view log by process index
  delete <number>             process delete by process index
  list                                     managed process lise
  help [command]              display help for command
  • 프로세스 생성
// example/simple-server.js
const http = require('http');

let count = 0;

console.log(`I a'm server`)

const server = http.createServer(function (req, res) {
  console.log(`[example/simple-server1.js] ${++count}`)
  res.writeHead(200, {'Content-Type': 'text/html'});
  if (count % 2 === 0) {
    throw 'error 에러발생~'
  } else {
    res.end('<h1 style="color: green;">Hello World ~~@!##@</h1>');
  }
})

server.listen(3000, () => {
  console.log('server running');
})
$ mungrever start example/simple-server.js
  • 프로세스 목록조회
$ mungrever list
  • 프로세스 삭제
$ mungrever delete [index]
  • 프로세스 로그
$ mungrever log [index]