ryanlelek.daemon-nodejs

守护进程 - Node.js

使用 Upstart 以守护进程方式运行 Node.js 进程(很快将迁移至 Systemd)

要求

必需:

  • Node.js(通过角色:nodesource.node)

推荐:

  • Git(通过角色:ryanlelek.packages)

角色变量

  • daemon_name:nodejs_daemon
  • daemon_command:npm start
  • daemon_envvars:[]

依赖

  • nodesource.node

示例剧本

# 以 Root 身份运行
- hosts: all
  become: yes
  roles:
    - ryanlelek.packages
    - nodesource.node

# 以用户身份运行
- hosts: all
  roles:

    # 克隆 Node.js Git 仓库
    - role: ryanlelek.git-repo
      git_repo_name:    raneto
      git_repo_url:     https://github.com/gilbitron/Raneto.git
      git_repo_command: npm install

    # 转换为守护进程
    - role: ryanlelek.daemon-nodejs
      daemon_name:    raneto
      daemon_command: npm start
      daemon_envvars:
        - { key: NODE_ENV, value: PRODUCTION }
        - { key: PORT,     value: 3000 }

许可

MIT

作者信息

创建者:Ryan Lelek
部分内容来自 AnsibleTutorials.com

关于项目

Run Node.js process as a Daemon with Upstart

安装
ansible-galaxy install ryanlelek.daemon-nodejs
许可证
mit
下载
761
拥有者