GithubHelp home page GithubHelp logo

danbev / nodeshift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nodeshift/nodeshift

0.0 3.0 0.0 323 KB

Plugin for running openshift deployments

License: Apache License 2.0

JavaScript 100.00%

nodeshift's Introduction

Nodeshift Build Status Coverage Status

Nodeshift is a Plugin for running openshift deployments for node.js projects

Disclaimer: Nodeshift is extremely experimental at the moment. This means it is under heavy development, api's could change at any time until a 1.0.0 release

Install

To install globally: npm install -g nodeshift

or to use in an npm script

npm install --save-dev nodeshift

// inside package.json
scripts: {
  nodeshift: nodeshift
}

$ npm run nodeshift

Example Usage

Prerequisites

  • Minishift

For this example, we will run against an Openshift Cluster running locally using Minishift.

There are directions here to install Minishift

I installed using Homebrew and use Virtual Box as my hypervisor provider, so my command to initially start minishift was something like this: minishift start --vm-driver=virtualbox

  • OC command line tools

These are also part of the minishift install, and step 2 of this section tells you how to put them on your path.

This guide also assumes you have a modern version(4+) of Node.js and npm installed.

Example

For this example, we will use this very simple express based node app, https://github.com/bucharest-gold/nodejs-rest-http

From this point on, all commands will assume you are in the directory of this source code

Notice that there is a .nodeshift directory in the project, this will hold application specific resource files for creating Routes/Serivces/DeploymentConfigs

Before running the nodeshift command, we first need to login to our Openshift Cluster running on Minishift using the oc login command

oc login -u developer for example.

Also make sure to either create a new project or change into an existing one.

Lets just create a new project for this example: oc new-project node-demo

All that is left is to run the nodeshift command.

The examples package.json has a script defined called "openshift" that will run the nodeshift command, run that like this:

$ npm run openshift

There is a file called runner.js, this makes use of the one(currently) public API called deployApplication, that can be run like so:

$ node runner.js

Or just calling nodeshift directly if you have it installed globally

$ nodeshift

Whatever is run, you will see output similiar to this:

> [email protected] openshift /Users/lholmquist/develop/nodejs-boosters/nodejs-rest-http
> nodeshift

cleaned up
created
Archive Created
Creating Build Config nodejs-rest-http-s2i for Source build
Build Config Created/Updated
Creating ImageStream nodejs-rest-http
Image Stream Created/Updated
Binary Upload Complete
Waiting for build to finish
Waiting for build to finish
Waiting for build to finish
Waiting for build to finish
Build nodejs-rest-http-s2i-1 Complete
Creating New Serivce
Creating New Route
Need to create deployment
Resources Applied

If you login to your local Openshift cluster and navigate to the "node-demo" project, there should be a new deployment with a route to your application.

For example: http://nodejs-rest-http-node-demo.192.168.99.100.nip.io/

please note: Currently, once a route, service, deployment config, build config, and imagestream config are created, those are re-used. The only thing that changes from deployment to deployment is the source code. This will change in the future

.Nodeshift Directory

The .nodeshift directory is responsible for holding your resource files. These are .yml files that describe you service, deployments and routes.

Currently, nodeshift will only create resources based on the files specified, in the future, its possible somethings could be created by default

Advanced Options

There are a few options available on the CLI or when using the API

    Usage: nodeshift [--options]

    Options:
    --projectLocation <project directory location>       change the default location of the project
    --configLocation <configuration directory location>  change the default location of the config
    --nodeshiftDirectory <nodeshift directory name>      change the default name of the directory nodeshift looks at for resource files
    --osc.strictSSL [value]                              setting to pass to the Openshift Rest Client. Set to false if using a self-sign cert

Of course, there is also the standard -V and --help options for version and help

Contributing

Please read the contributing guide

nodeshift's People

Contributors

lholmquist avatar

Watchers

Daniel Bevenius avatar James Cloos 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.