npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hookagent

v0.7.3

Published

Git webhook agent for server auto-deployment.

Downloads

19

Readme

Git webhook deploy agent

For sysadmins simply setup a post hook agent on server to deploy git projects like PaaS from your using third-party git service.

Usage

Requirement

  • node version >= 10
  • PM2 installed in global: sudo npm install -g pm2

On your server

$ npm install -g hookagent

After installed you can use this commands to start the agent:

$ hookagent config
$ hookagent start

Get ready your repository

Additional things about git you should make sure:

  • Project repository alread cloned once from 3rd-party git service.

  • All repository files(folders) is own by the specific user(s) you configured in the config file (~/.hookagent/config.json, see below).

  • Within the user, the ssh-key has been generated (no password), and set as deploy key in 3rd-party git service.

  • The ssh-key has been used at least once, to make sure it has been add to the list of known hosts of the service.

Post hook

Set a git post hook in the admin panel of your repository like this:

[POST]:http://user:[email protected]:6060/project/id@remote/branch
  • user:password is reqired part in post URL. The agent will check the request with HTTP basic authentication to avoid mistake request.

  • 6060 as port is set in the config, you can change it as you wish.

  • /project/:id is the router, @remote/branch is optional default to origin/master. If branch (or with remote) is set in hook URL, the part after @ should be exactly match the config (see below).

Configuration

Before start the agent first time, run hookagent config to generate a config file named config.json in ~/.hookagent folder(C:\Users\YourName for windows).

Here is a sample of configuration structure:

{
    // The HTTP listening port
    "port": 6060,
    // Default remote will be used if not set in post request
    "defaultRemote": "origin",
    // Default branch which will be updated when not set in post request
    "defaultBranch": "master",

    // Projects map. ID: object
    "projects": {
        "sample": {
            // branch
            "master": {
                // Project path
                "path": "/var/www/sample",

                // Task to be run after git pull, such as build etc.
                // "shell": "./build.sh",

                // Users in list allow to trigger deploy
                "users": ["abc"]
            },
            "dev": {
                "path": "/var/www/test",
                "users": ["abc"]
            }
        }
    },

    // Users list for HTTP basic authentication. ID: password
    // Each user ID should match server user name.
    "users": {
        "abc": "ba1f2511fc30423bdbb183fe33f3dd0f"
    },
    // add git path for windows server
    "gitPath": "C:\Program Files\Git\bin\git.exe"
}

Make sure that when using different branches in one project, the path of branch shouldn't be same on one server. This is just for different usage (such as testing) base on branch mapping.

Once the config file generated, run the hookagent config will open the content with vim.

When you use it on Windows server, you should use node as default open method to javascript.

Roadmap

  • Add logger.
  • Add Github/Bitbucket/Gitlab post data parsing to avoid none updated pulling.
  • Add admin panel using basic authentication.
  • Use SQLite or other database to manage config data.
  • Add RSA authentication instead of basic HTTP.

MIT Licensed

-EOF-