Giter VIP home page Giter VIP logo

next-express-deploy-demo's Introduction

准备

  1. 本机和服务器都要生成 ssh key:ssh-keygen -t rsa -C [email protected]
  2. ssh key 打通本地和服务器,要不会频繁输密码:ssh-copy-id [email protected],或者把公钥拷贝服务器的 ~/.ssh/authorized_keys
  3. 本地和服务器上有 node 环境和安装好 pm2

pm2 配置

通过 pm2 ecosystem 生成 pm2 配置文件 ecosystem.config.js

module.exports = {
  apps : [{
    name: 'next-express-demo',
    script: './bin/server.js',
    instances: 1,
    autorestart: true,
    watch: false,
    max_memory_restart: '1G',
    log_date_format: "YYYY-MM-DD HH:mm Z",
    env: {
      NODE_ENV: 'development'
    },
    env_dev: {
      NODE_ENV: 'development'
    },
    env_production: {
      NODE_ENV: 'production'
    }
  }],

  deploy : {
    dev : {
      user : 'root1',
      host : '192.168.126.25',
      ref  : 'origin/master',
      repo : '[email protected]:vanni-li/next-express-deploy-demo.git',
      path : '/usr/local/sandai/next-express-demo',
      'post-deploy' : 'npm install && npm run pm2:start',
      env: {
        NODE_ENV: 'dev'
      }
    }
  }
};

初次执行之前要初始化:pm2 deploy ecosystem.config.js production setup

next-express-deploy-demo's People

Contributors

vinneli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.