notoriousb1t / web-deploy-for-node

HTTP server that runs deployment scripts when a GET request is sent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web Deploy for Node

Web Deploy for Node automatically deploys your site by listening for specific HTTP requests and executing CLI commands on your webserver. This application makes it easy to automatically deploy a site hosted on Git provider that supports webhooks.

Getting Started

Configuring the Web Server

  • [Option 1] download the repo as zip from here and unzip the file to the correct path on the webserver
  • [Option 2] login to the webserver and in the command line or terminal, run the following commands
cd /path/to/wwwroot
git clone https://github.com/notoriousb1t/web-deploy-for-node.git
  • rename deploy.sample.json to deploy.json
  • configure deploy.json (see below)
  • run the following command to start the node server
node server.js
  • configure a process manager like pm2 + nginx to keep the web deploy alive or deploy to IIS+Node

Automatic Deployment on Git Push

Manual Deployment

Configuration

(This sample configuration has the scripts to update from a remote git repository)

deploy.json

{
    "port": 8080,
    "sites": [
        {
            "url": "/my-relative-url",
            "workingDir": "/path/to/directory",
            "scripts": [
                "echo $PWD",
                "git status",
                "whoami",
                "git pull",
                "git status",
                "git submodule sync",
                "git submodule update",
                "git submodule status",
                "npm i"
            ]
        }
    ]
}

Config Properties

Property Explanation
port port of the HTTP server
sites Site configuration; see below

Site Properties

Property Explanation
url url path that activates this deployment strategy
workingDir directory that contains your application. this is where your scripts should run
scripts list of commands to run from the CLI

About

HTTP server that runs deployment scripts when a GET request is sent


Languages

Language:JavaScript 100.0%