Git Product home page Git Product logo

juniper's Introduction

Juniper

An Nginx Multi-Environment Server.

When and why would I want to use Juniper?

Hosting ain't cheap, and running several sites from ones server takes a ton of work. Juniper makes things less painful.

Let's say you want to serve out flat files for your site, run a node api on a subdomain, and redirect traffic from a subfolder to that subdomain. Well, this is perfect for you.

With Juniper, you can run all of these simultaneously:

To add a new site to your server, just add a new key in the configuration file, restart, and voila!

When and why would I NOT want to use Juniper?

It's generally bad practice to run multiple environments (uat, production, etc.) on a single server, it means if that server goes down all of your sites are down. But sometimes you're on a budget, and don't want to use something like Heroku, which may require you to pay for multiple add-on services.

Background & Reading

Upcoming Features

Please refer to the project wiki for more details.

Installation

  1. Install Node
  2. Install Nginx
  3. Install Juniper
  # From anywhere on your system, install the Juniper CLI globally
  $ npm install -g juniper

  # Create a new folder that will house your Juniper configuration
  $ juniper create my-sites

  # Update the `my-sites/config.cson` file that was just created.

  # Start your server
  $ cd my-sites
  $ juniper install
  $ juniper start

Usage

  $ juniper -h

  Usage: juniper [action [options]]

  Actions:

    create <project>    Create a new folder and init it as a juniper project
    init                Initalize project
    install <siteName>  Install the dependencies of this project or site
    start <siteName>    Start project or site
    stop <siteName>     Stop project or site
    restart <siteName>  Restart project or site
    remove <siteName>   Remove all settings, stop all services for this project or site
    update <siteName>   Stop, update, and restart project or site

  Options:

    -h, --help          output usage information
    -V, --version       output the version number

Config

nginx:
  # Nginx config coming soon. See 'Upcoming Features'.
  mimetypes: []

sites:

  # DEFAULTS

  # siteName:                           # Required
    # domain: null                      # Required, string
    # repo: null                        # Required, string
    # branch: 'master'
    # port: 80
    # type: 'files'                     # string: 'files|process'

    # install: null                     # string, ex: 'npm install', 'make setup'
    # start: null                       # string, ex: 'npm start', 'grunt production', 'jake server:uat'
    # stop: null                        # string, ex: 'npm stop', 'gulp stop'

    # files:
    #   index: 'index.html index.htm'
    #   redirects: []                   # array: {dir, site}, limited to 'process' sites
    #   root: null                      # relative to the repo folder

    # process:
    #   port: null                      # Required, int
    #   address: '127.0.0.1'


  # EXAMPLES

  # Serving static files
  simpleFiles:
    domain: 'www.juniper-site-files.com'
    repo: 'https://github.com/danmconrad/juniper-site-files.git'


  # Running a node server
  simpleProcess:
    domain: 'www.juniper-site-process.com'
    repo: 'https://github.com/danmconrad/juniper-site-process.git'

    start: 'forever start ./index.js'
    stop: 'forever stop ./index.js'
    type: 'process'
    process:
      port: 1337


  # Serving a static site with redirected sub-folders
  filesWithApiAndBlog:
    domain: 'www.files-with-api-and-blog.com'
    repo: 'https://url-to-repo/files-with-api-and-blog.git'
    redirects: [
      {dir: '/api', site: 'api'}
      {dir: '/blog', site: 'blog'}
    ]

  api:
    domain: 'www.api.com'
    repo: 'https://url-to-repo/api.git'
    type: 'process'
    process:
      port: 6000

  blog:
    domain: 'www.blog.com'
    repo: 'https://url-to-repo/blog.git'
    type: 'process'
    process:
      port: 7000


  # Serving two version of the same site
  prodEmberCliSite:
    domain: 'www.ember-cli-site.com'
    repo: 'https://url-to-repo/ember-cli-site.git'
    branch: 'master'
    files:
      root: 'dist'
    install: 'npm install && bower install'
    start: 'ember build --environment=production'

  uatEmberCliSite:
    domain: 'uat.ember-cli-site.com'
    repo: 'https://url-to-repo/ember-cli-site.git'
    branch: 'develop'
    files:
      root: 'dist'
    install: 'npm install && bower install'
    start: 'ember build --environment=uat'

juniper's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jimbol

juniper's Issues

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.