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

pull-proxy

v0.0.3

Published

Git pull powered deployment solution

Downloads

9

Readme

pull-proxy

Zero downtime redeploys of websites or services pulled down from a git repo.

Works with HTTP, Websockets and raw TCP.

Usage

Create a new proxy that pulls ghub.io from github and serves it on port 8000. The website's stdout and stderr will be printed on the terminal.

var Proxy = require('pull-proxy');

var proxy = new Proxy(
  'git://github.com/juliangruber/ghub.io.git',
  __dirname + '/repos'
);

proxy.createManagementServer().listen(8001);
proxy.createProxyServer().listen(8000);

proxy.stdout.pipe(process.stdout);
proxy.stderr.pipe(process.stderr);

The site is served at http://localhost:8000.

Then, when you want to redeploy, send a special request to the management server that listens on port 8001:

curl -XPUT http://localhost:8001/deploy/

You don't need to spin up a management server if redeploying is not of concern to you or you're using the JavaScript api.

Modifying checked out code

If you want to insert extra steps into the deployment process, like running npm install, listen to the source event:

proxy.on('source', function (dir, done) {
  var ps = spawn('npm', ['install'], { cwd: dir });
  ps.once('exit', done);
});

All listeners for the source event muss call done() when finished.

Management interface

PUT /deploy(?branch=branch)(?remote=remote)

Redeploy, and optionally overwrite branch, which defaults to master, and remote, which defaults to the remote you passed to the Proxy() constructor.

Authentication

Authentication is basically up to you, since this only gives you a node core http server. Some easy ways would be to wrap the http server in something that does basic auth, or to make it listen on a unix socket that's only accessible via ssh.

CLI

Install with:

$ npm install -g pull-proxy

Usage:

$ pull-proxy
Git pull based deployment solution.
Usage: pull-proxy [options]

Options:
  --git, -g           Git url to pull from             [required]
  --proxy, -p         Proxy port                       [required]
  --repos, -r         Path to pull repositories into   [default: "./repos"]
  --manage, -m        Management port                
  --no-zero-downtime  Turn of zero downtime deploys    [boolean]  [default: false]
  --stdout, --out     Forward stdout output            [boolean]  [default: false]
  --stderr, --err     Forward stderr output            [boolean]  [default: false]
  --log, -l           Print internal events on stdout  [boolean]  [default: false]
  --help, -h          Print usage instruction        

Missing required arguments: git, proxy

API

Proxy(remote[, repos])

Create a new proxy that serves the repo at remote. It will store the local checkouts of repos in repos, which defaults to __dirname/repos.

Proxy#noZeroDowntime()

Turn off zero downtime deploys. This way there's always only one instance of the site running.

Proxy#createManagementServer()

Create a http server for managing the proxy.

Proxy#createProxyServer()

Create a http server that proxies requests to your site and ensures zero downtime redeploys.

Proxy#stdout, Proxy#stderr

Readable streams that contain the stdout or stderr from the spawned childprocess of the website that is being proxied to.

Proxy#deploy([{remote, branch}][,cb])

Redeploy. Optionally override remote and branch and get called back when it's done.

Installation

With npm do

$ npm install pull-proxy

License

(MIT)

Copyright (c) 2013 Wayla <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.