New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pierrot

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pierrot

pm2 bouncy plugin

latest
Source
npmnpm
Version
0.0.0-beta.1
Version published
Weekly downloads
5
-73.68%
Maintainers
1
Weekly downloads
 
Created
Source

Pierrot NPM version Build Status Coverage Status

pm2 virtual-host and deploy cli

Installation

$ npm install pm2 bouncy pierrot --global

Define pierrot.yml

Can use $ sudo pierrot vhost if define one or more apps in ./pierrot.yml.

apps:
  homepage:
    repo: https://github.com/59naga/berabou.me.git
    from: 59naga.localhost
    to: 59798

Start the virtual host using 80 port.

$ sudo pierrot vhost
#[PM2] Spawning PM2 daemon
#[PM2] PM2 Successfully daemonized
#process name not found
#┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
#│ App name │ id │ mode │ pid   │ status │ restart │ uptime │ memory      │ watching │
#├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
#│ VHOST    │ 0  │ fork │ 85314 │ online │ 0       │ 0s     │ 29.520 MB   │ disabled │
#└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘
#
#successfully `vhost`.
#
#  Please fix:
#
#  $ sudo chmod -R 777 ~/.pm2
#
#  See: https://github.com/Unitech/PM2/issues/837
#
$ sudo chmod -R 777 ~/.pm2

Deploy the app in local.

$ pierrot apps
? apps homepage
? task initialize
? really Yes
# apps: git clone https://github.com/59naga/berabou.me.git homepage
# apps/homepage: npm install --production
# apps/homepage: delete and start pm2 process
# process name not found
# 
# homepage was successfully the `initialize`
# 
# ┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
# │ App name │ id │ mode │ pid   │ status │ restart │ uptime │ memory      │ watching │
# ├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
# │ VHOST    │ 0  │ fork │ 85314 │ online │ 0       │ 3m     │ 29.520 MB   │ disabled │
# │ homepage │ 1  │ fork │ 85830 │ online │ 0       │ 0s     │ 34.074 MB   │ disabled │
# └──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘

Becomes...

$ tree
# .
# ├── node_modules
# ├── package.json
# ├── pierrot.yml
# └── apps
#      └── homepage
#          ├── node_modules
#          ├── package.json
#          └── ...

And be available the http://59naga.localhost if Add 127.0.0.1 59naga.localhost to /etc/hosts.

Pierrot tasks

Always set the production to process.env.NODE_ENV.

reload

  • Pulling repositories in specified apps (eg cd apps/name && git pull).
  • Reload the processes. (eg pm2 reload <apps...>)

update

  • Pulling repositories in specified apps (eg cd apps/name && git pull).
  • Install dependencies. (eg npm install --production)
  • Reload the processes. (eg pm2 reload <apps...>)

deleteAndStart

  • Remove the processes. (eg pm2 delete <apps...>)
  • Start the processes using pierrot.yml11. (eg pm2 start <apps...>)

initialize

  • Delete the folder of apps if has apps/repo. (eg rm -rf <apps/name>)
  • Clone the apps/repo as apps/name. (eg git clone apps/repoValue apps/name)
  • Install dependencies. (eg cd apps/name && npm install --production)
  • Start the processes using pierrot.yml. (eg pm2 start <apps...>)

302 redirect

VHOST sends the Location header in the 302 if specify app/to as string.

  oldSite:
    from: oldsite.example.com
    to: renewal.example.com
pm2 reload VHOST
# ...

curl oldsite.example.com/foo/bar?baz --head
# HTTP/1.1 302 Found
# Location: http://renewal.example.com/foo/bar?baz
# Date: Mon, 02 Nov 2015 03:36:34 GMT
# Connection: keep-alive

https

Define key and cert fields to ./pierrot.yml. Becomes add the port 443(secure mode) at pierrot vhost.

key: /path/to/private.key
cert: /path/to/public.cert

apps:
  homepage:
    repo: https://github.com/59naga/berabou.me.git
    from: 59naga.localhost
    to: 59798
$ sudo pierrot vhost
$ pm2 logs VHOST
# PIERROT_VHOST listening at http://localhost:80/
# PIERROT_VHOST listening at http://localhost:443/

License

MIT

Footnotes

  • Defined in the apps of pierrot.yml. originally, it shall be defined in the app.json. 2

Keywords

pm2

FAQs

Package last updated on 29 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts