feat: 초기 프로젝트 설정 및 룰.md 파일 추가
This commit is contained in:
35
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/launchd.tpl
generated
vendored
Normal file
35
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/launchd.tpl
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.PM2</string>
|
||||
<key>UserName</key>
|
||||
<string>%USER%</string>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/bin/sh</string>
|
||||
<string>-c</string>
|
||||
<string>%PM2_PATH% resurrect</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>OnDemand</key>
|
||||
<false/>
|
||||
<key>LaunchOnlyOnce</key>
|
||||
<true/>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>PATH</key>
|
||||
<string>%NODE_PATH%</string>
|
||||
<key>PM2_HOME</key>
|
||||
<string>%HOME_PATH%</string>
|
||||
</dict>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/tmp/com.PM2.err</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/tmp/com.PM2.out</string>
|
||||
</dict>
|
||||
</plist>
|
||||
52
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/openrc.tpl
generated
vendored
Normal file
52
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/openrc.tpl
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2013-2022 the PM2 project authors. All rights reserved.
|
||||
# Init script automatically generated by pm2 startup
|
||||
|
||||
description="Production process manager for Node.js apps with a built-in load balancer."
|
||||
|
||||
extra_started_commands="reload"
|
||||
|
||||
PM2="%PM2_PATH%"
|
||||
user=${PM2_USER:-%USER%}
|
||||
export PM2_HOME=$(eval echo ~${user})"/.pm2/"
|
||||
# Options for start-stop-daemon (default start function)
|
||||
command=${PM2}
|
||||
command_user=${user}
|
||||
command_args="resurrect"
|
||||
pidfile=${PM2_HOME}/pm2.pid
|
||||
|
||||
run_pm2_as_user() {
|
||||
einfo "${PM2} $@"
|
||||
eval su -l ${user} -c \'${PM2} $@\'
|
||||
}
|
||||
|
||||
depend() {
|
||||
need net
|
||||
need localmount
|
||||
after bootmisc
|
||||
}
|
||||
|
||||
start_post() {
|
||||
if [ "${user}" == "root" ]; then
|
||||
ewarn "PM2: Better run this daemon as a non root user. To set this user create"
|
||||
ewarn "PM2: /etc/conf.d/pm2 file and define 'PM2_USER=user' there."
|
||||
ewarn "PM2: Note user MUST have home directory for PM2 logs/state/etc..."
|
||||
fi
|
||||
einfo "PM2: Process Manager started. To start services run:"
|
||||
einfo "PM2: # su -l ${user} -c '$PM2 start /path/to/app'"
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping PM2 process manager..."
|
||||
run_pm2_as_user dump
|
||||
run_pm2_as_user kill
|
||||
eend $?
|
||||
}
|
||||
|
||||
reload() {
|
||||
ebegin "Reloading pm2"
|
||||
run_pm2_as_user reload all
|
||||
eend $?
|
||||
}
|
||||
|
||||
# vim: ts=4
|
||||
86
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/pm2-init-amazon.sh
generated
vendored
Normal file
86
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/pm2-init-amazon.sh
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# pm2 Process manager for NodeJS
|
||||
#
|
||||
# chkconfig: 345 80 20
|
||||
#
|
||||
# description: PM2 next gen process manager for Node.js
|
||||
# processname: pm2
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: pm2
|
||||
# Required-Start: $local_fs $remote_fs
|
||||
# Required-Stop: $local_fs $remote_fs
|
||||
# Should-Start: $network
|
||||
# Should-Stop: $network
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: PM2 init script
|
||||
# Description: PM2 is the next gen process manager for Node.js
|
||||
### END INIT INFO
|
||||
|
||||
NAME=pm2
|
||||
PM2=%PM2_PATH%
|
||||
USER=%USER%
|
||||
|
||||
export PATH=%NODE_PATH%:$PATH
|
||||
export PM2_HOME="%HOME_PATH%"
|
||||
|
||||
lockfile="/var/lock/subsys/pm2-init.sh"
|
||||
|
||||
super() {
|
||||
su - $USER -c "PATH=$PATH; PM2_HOME=$PM2_HOME $*"
|
||||
}
|
||||
|
||||
start() {
|
||||
echo "Starting $NAME"
|
||||
super $PM2 resurrect
|
||||
retval=$?
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo "Stopping $NAME"
|
||||
super $PM2 kill
|
||||
rm -f $lockfile
|
||||
}
|
||||
|
||||
restart() {
|
||||
echo "Restarting $NAME"
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
echo "Reloading $NAME"
|
||||
super $PM2 reload all
|
||||
}
|
||||
|
||||
status() {
|
||||
echo "Status for $NAME:"
|
||||
super $PM2 list
|
||||
RETVAL=$?
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
reload)
|
||||
reload
|
||||
;;
|
||||
*)
|
||||
echo "Usage: {start|stop|status|restart|reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit $RETVAL
|
||||
41
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/rcd-openbsd.tpl
generated
vendored
Normal file
41
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/rcd-openbsd.tpl
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# from /usr/ports/infrastructure/templates/rc.template
|
||||
|
||||
daemon="/usr/local/bin/pm2"
|
||||
#daemon_flags=
|
||||
#daemon_rtable=0
|
||||
#daemon_timeout="30"
|
||||
daemon_user="%USER%"
|
||||
|
||||
. /etc/rc.d/rc.subr
|
||||
|
||||
pexp="node: PM2.*God Daemon.*"
|
||||
#rc_bg= # (undefined)
|
||||
#rc_reload= # (undefined)
|
||||
#rc_usercheck=YES
|
||||
|
||||
#rc_pre() {
|
||||
#}
|
||||
|
||||
rc_start() {
|
||||
${rcexec} "${daemon} ${daemon_flags} resurrect"
|
||||
}
|
||||
|
||||
#rc_check() {
|
||||
# pgrep -T "${daemon_rtable}" -q -xf "${pexp}"
|
||||
#}
|
||||
|
||||
rc_reload() {
|
||||
${rcexec} "${daemon} reload all"
|
||||
#pkill -HUP -T "${daemon_rtable}" -xf "${pexp}"
|
||||
}
|
||||
|
||||
#rc_stop() {
|
||||
# pkill -T "${daemon_rtable}" -xf "${pexp}"
|
||||
#}
|
||||
|
||||
#rc_post() {
|
||||
#}
|
||||
|
||||
rc_cmd $1
|
||||
44
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/rcd.tpl
generated
vendored
Normal file
44
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/rcd.tpl
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
# PROVIDE: pm2
|
||||
# REQUIRE: LOGIN
|
||||
# KEYWORD: shutdown
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="%SERVICE_NAME%"
|
||||
rcvar="%SERVICE_NAME%_enable"
|
||||
|
||||
start_cmd="pm2_start"
|
||||
stop_cmd="pm2_stop"
|
||||
reload_cmd="pm2_reload"
|
||||
status_cmd="pm2_status"
|
||||
extra_commands="reload status"
|
||||
|
||||
pm2()
|
||||
{
|
||||
env PATH="$PATH:%NODE_PATH%" PM2_HOME="%HOME_PATH%" su -m "%USER%" -c "%PM2_PATH% $*"
|
||||
}
|
||||
|
||||
pm2_start()
|
||||
{
|
||||
pm2 resurrect
|
||||
}
|
||||
|
||||
pm2_stop()
|
||||
{
|
||||
pm2 kill
|
||||
}
|
||||
|
||||
pm2_reload()
|
||||
{
|
||||
pm2 reload all
|
||||
}
|
||||
|
||||
pm2_status()
|
||||
{
|
||||
pm2 list
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
43
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/smf.tpl
generated
vendored
Normal file
43
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/smf.tpl
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
|
||||
<service_bundle type="manifest" name="%SERVICE_NAME%">
|
||||
<service name="application/%SERVICE_NAME%" type="service" version="1">
|
||||
<create_default_instance enabled="false"/>
|
||||
<single_instance/>
|
||||
|
||||
<dependency name="network" grouping="require_all" restart_on="error" type="service">
|
||||
<service_fmri value="svc:/milestone/network:default"/>
|
||||
</dependency>
|
||||
|
||||
<dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
|
||||
<service_fmri value="svc:/system/filesystem/local"/>
|
||||
</dependency>
|
||||
|
||||
<method_context>
|
||||
<method_environment>
|
||||
<envvar name='PATH' value="%NODE_PATH%:/usr/local/sbin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin"/>
|
||||
<envvar name='PM2_HOME' value="%HOME_PATH%"/>
|
||||
</method_environment>
|
||||
</method_context>
|
||||
|
||||
<exec_method type="method" name="start" exec="%PM2_PATH% resurrect" timeout_seconds="60"/>
|
||||
<exec_method type="method" name="refresh" exec="%PM2_PATH% reload all" timeout_seconds="60"/>
|
||||
<exec_method type="method" name="stop" exec="%PM2_PATH% kill" timeout_seconds="60"/>
|
||||
|
||||
<property_group name="startd" type="framework">
|
||||
<propval name="duration" type="astring" value="contract"/>
|
||||
<propval name="ignore_error" type="astring" value="core,signal"/>
|
||||
</property_group>
|
||||
|
||||
<property_group name="application" type="application"></property_group>
|
||||
<stability value="Evolving"/>
|
||||
|
||||
<template>
|
||||
<common_name>
|
||||
<loctext xml:lang="C">
|
||||
PM2 process manager
|
||||
</loctext>
|
||||
</common_name>
|
||||
</template>
|
||||
</service>
|
||||
</service_bundle>
|
||||
22
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/systemd-online.tpl
generated
vendored
Normal file
22
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/systemd-online.tpl
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=PM2 process manager
|
||||
Documentation=https://pm2.keymetrics.io/
|
||||
After=network-online.target
|
||||
Restart=on-failure
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=%USER%
|
||||
LimitNOFILE=infinity
|
||||
LimitNPROC=infinity
|
||||
LimitCORE=infinity
|
||||
Environment=PATH=%NODE_PATH%:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
|
||||
Environment=PM2_HOME=%HOME_PATH%
|
||||
PIDFile=%HOME_PATH%/pm2.pid
|
||||
|
||||
ExecStart=%PM2_PATH% resurrect
|
||||
ExecReload=%PM2_PATH% reload all
|
||||
ExecStop=%PM2_PATH% kill
|
||||
|
||||
[Install]
|
||||
WantedBy=network-online.target
|
||||
22
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/systemd.tpl
generated
vendored
Normal file
22
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/systemd.tpl
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=PM2 process manager
|
||||
Documentation=https://pm2.keymetrics.io/
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=%USER%
|
||||
LimitNOFILE=infinity
|
||||
LimitNPROC=infinity
|
||||
LimitCORE=infinity
|
||||
Environment=PATH=%NODE_PATH%:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
|
||||
Environment=PM2_HOME=%HOME_PATH%
|
||||
PIDFile=%HOME_PATH%/pm2.pid
|
||||
Restart=on-failure
|
||||
|
||||
ExecStart=%PM2_PATH% resurrect
|
||||
ExecReload=%PM2_PATH% reload all
|
||||
ExecStop=%PM2_PATH% kill
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
103
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/upstart.tpl
generated
vendored
Normal file
103
api.hyungi.net/node_modules/pm2/lib/templates/init-scripts/upstart.tpl
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: pm2
|
||||
# Required-Start: $local_fs $remote_fs $network
|
||||
# Required-Stop: $local_fs $remote_fs $network
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: PM2 Init script
|
||||
# Description: PM2 process manager
|
||||
### END INIT INFO
|
||||
|
||||
NAME=pm2
|
||||
PM2=%PM2_PATH%
|
||||
USER=%USER%
|
||||
DEFAULT=/etc/default/$NAME
|
||||
|
||||
export PATH=%NODE_PATH%:$PATH
|
||||
export PM2_HOME="%HOME_PATH%"
|
||||
|
||||
# The following variables can be overwritten in $DEFAULT
|
||||
|
||||
# maximum number of open files
|
||||
MAX_OPEN_FILES=
|
||||
|
||||
# overwrite settings from default file
|
||||
if [ -f "$DEFAULT" ]; then
|
||||
. "$DEFAULT"
|
||||
fi
|
||||
|
||||
# set maximum open files if set
|
||||
if [ -n "$MAX_OPEN_FILES" ]; then
|
||||
ulimit -n $MAX_OPEN_FILES
|
||||
fi
|
||||
|
||||
get_user_shell() {
|
||||
local shell
|
||||
shell=$(getent passwd "${1:-$(whoami)}" | cut -d: -f7 | sed -e 's/[[:space:]]*$//')
|
||||
|
||||
if [[ $shell == *"/sbin/nologin" ]] || [[ $shell == "/bin/false" ]] || [[ -z "$shell" ]];
|
||||
then
|
||||
shell="/bin/bash"
|
||||
fi
|
||||
|
||||
echo "$shell"
|
||||
}
|
||||
|
||||
super() {
|
||||
local shell
|
||||
shell=$(get_user_shell $USER)
|
||||
su - "$USER" -s "$shell" -c "PATH=$PATH; PM2_HOME=$PM2_HOME $*"
|
||||
}
|
||||
|
||||
start() {
|
||||
echo "Starting $NAME"
|
||||
super $PM2 resurrect
|
||||
}
|
||||
|
||||
stop() {
|
||||
super $PM2 kill
|
||||
}
|
||||
|
||||
restart() {
|
||||
echo "Restarting $NAME"
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
echo "Reloading $NAME"
|
||||
super $PM2 reload all
|
||||
}
|
||||
|
||||
status() {
|
||||
echo "Status for $NAME:"
|
||||
super $PM2 list
|
||||
RETVAL=$?
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
reload)
|
||||
reload
|
||||
;;
|
||||
force-reload)
|
||||
reload
|
||||
;;
|
||||
*)
|
||||
echo "Usage: {start|stop|status|restart|reload|force-reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit $RETVAL
|
||||
Reference in New Issue
Block a user