Code Monkey home page Code Monkey logo

ploy's Introduction

ploy

git push at this http router and it will host your branches on subdomains

think bouncy + cicada

example

create an auth file and start the ploy server:

$ echo '{ "beep": "boop" }' > auth.json
$ sudo ploy ./data -p 80 -a auth.json

then from a git repo with a server.js and/or a scripts.start in its package.json:

server.js should host its http server on process.env.PORT.

$ git remote add ploy http://beep:boop@localhost/_ploy/server.git
$ git push ploy master

Now your server.js will be running on http://localhost/. If you push again to master, in a few seconds the new master code will be running on http://localhost/.

To launch a staging instance on a subdomain, just push to a non-master branch:

$ git push ploy master:staging

Now go to http://staging.localhost/ to see your staging instance. (Edit /etc/hosts or set up dns wildcards with dnsmasq to test locally.)

Use ploy ls to list the running branches:

$ ploy ls
master

details

ploy does not detach your server processes. When the ploy server goes down, it takes the processes it started with it.

However, when the ploy server is started back up, it will attempt to restart all of the processes it was previously running.

When you git push code at a ploy server, your server will be started and any previous server running under the same branch name will be killed.

methods

var ploy = require('ploy')

usage

usage:

  ploy DIRECTORY PORT
  ploy { -d DIRECTORY | -p PORT | -a AUTHFILE }

    Create a ploy http server, hosting repositories in DIRECTORY and listening
    on PORT for incoming connections.
 
    If AUTHFILE is given, it should be a json file that maps usernames to
    token strings to use for basic auth protection for ploy actions.
 
  ploy ls { -r REMOTE }
 
    List the running process branch names at REMOTE.
 
  ploy mv SRC DST { -r REMOTE }
 
    Move the branch name SRC to the DST branch name at REMOTE.
 
  ploy rm NAME { -r REMOTE }
 
    Remove the branch name at NAME, killing any running processes.
 
  ploy help
 
    Show this message. 

OPTIONS

  For `ploy ls`, `ploy mv`, `ploy rm` commands that take a REMOTE parameter:
  
  REMOTE can be a git remote name or a remote URL to a ploy server. If there
  is exactly one ploy remote in set up as a git remote, it will be used by
  default.

var server = ploy(opts)

Create a new ploy instance, splitting opts between the underlying bouncy and cicada instances.

  • opts.repodir - directory to put git repo data
  • opts.workdir - directory to check out git repos into
  • opts.auth - optional object mapping usernames to password token strings for basic auth

If opts is a string, it will be used as the basedir for opts.repodir and opts.workdir.

The rest of the options will be looked over by bouncy to do things like set up an https server or whatever.

server.listen(port, ...)

Call .listen() on the underlying http or https server.

server.add(name, rec)

Add a a service under a branch name. rec should have:

  • rec.port - port where the http server lives
  • rec.hash - commit hash string
  • rec.process - process object to call .kill() on

server.remove(name)

Remove the process at the branch name, killing as necessary.

server.restart(name)

Restart the process at the branch name.

server.move(src, dst)

Move the process at branch name src to dst, killing the branch process at src if it was running.

install

With npm do:

npm install -g ploy

to get the ploy command or just

npm install ploy

to get the library.

license

MIT

ploy's People

Watchers

 avatar  avatar  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.