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

weblab-cli

v1.1.0

Published

Command line tool to manage weblab.io micro services

Downloads

4

Readme

Weblab CLI

Weblab – Build applications comprised of microservices that run forever, self-heal and scale as needed. Building scalable fault-tolerant systems has never been easier.

The Weblab CLI it's a command-line tool to interact with Weblab for developing and deploying your serverless microservice architecture.

Contents

Quick Start

Follow the steps below to create and deploy your first serverless microservice in seconds.

  1. Install via npm:

    $ npm install -g weblab-cli
  2. Set-up your credentials

    $ weblab register
    
      Setup your Weblab Account
      -------------------------
    > Email: [email protected]
    > Username: (cristi)
    > Password: ***********
    
      Success: User registration complete.

    or if you already have a Weblab account just sign in with your credentials

    $ weblab login
  3. Deploy a service

    In your Weblab microservice folder just run

    $ cd µservice
    $ wl deploy
    
      Service:
        hello-world-1.0.0
    
      Enpoints:
        GET - https://weblab.io/api/v1/run/cristi/hello-world-1.0.0/
    
      Uploading: ...
        success
    
  4. List your services

    $ wl ls
    
    CONTAINER      | MICROSERVICE           | STATE      | STATUS    
    3a377aea233d   | hello-world-1.0.0      | running    | Up 2 hours
    3a48678fce52   | hal-1.0.0              | running    | Up 2 hours
    8bd1f4577575   | container-events-0.0.2 | running    | Up 3 weeks
    1c260895c73e   | weblab-fb-bot-1.0.0    | running    | Up 11 weeks
    
  5. Inspect logs

    $ wl logs <container-id>
  6. Remove a container

    $ wl rm <container-id>
  7. Scale your microservice

    $ wl deploy -s 2
    
      Service:
        hello-world-1.0.0
      Scale:
        2 workers
    
      Enpoints:
        GET - https://weblab.io/api/v1/run/cristi/hello-world-1.0.0/
    
      Uploading: ...
        success
    
    $ wl ls
    
      CONTAINER      | MICROSERVICE           | STATE      | STATUS    
      ca5785b7aff2   | hello-world-1.0.0      | running    | Up 4 seconds
      6b0c33c7f206   | hello-world-1.0.0      | running    | Up 4 seconds
      3a48678fce52   | hal-1.0.0              | running    | Up 3 hours
      8bd1f4577575   | container-events-0.0.2 | running    | Up 3 weeks
      1c260895c73e   | weblab-fb-bot-1.0.0    | running    | Up 11 weeks
    
  8. Run your microservice on your local machine

    $ wl local
    
      Service:
        hello-world-1.0.0
    
      Endpoints:
        GET - http://localhost:8991/
    
      Server:
        Started on port 8991
    

    Useful if you want to test your microservice localy before deploying to Weblab.

Examples

Hello World

package.json

{
  "name": "hello-world",
  "version": "1.0.0",
  "main": "index.js"
}

index.js

module.exports = function (req, res) {
  res.send('Hello, world!')
}

Upcoming Features

  1. Realtime log streaming (scheduled for January 2017)

    $ wl logs -f <container-id>
  2. Remote debugging (scheduled for February 2017)

    Use your favorite IDE (WebStorm / VS Code / etc.) to remote debug your microservice.

Development

Tests

$ npm test

Linter

We're using ESLint with Standard config

js-standard-style

$ npm run lint

Unit tests

$ npm run unit

Git Hooks

  • pre-commit hook to run linter before every commit

To install it just run in the project root directory:

$ ./tools/hooks/install.sh

If you want to skip the tests when you make a push just use the --no-verify flag. Example:

$ git commit --no-verify <remote> <branch>