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

vlc2

v1.12.1

Published

vlcluster 2

Downloads

17

Readme

npm version

vlcluster

Simple docker and nginx-based cluster designed for multi-env web applications.

vlcluster is currently beeing restructured

Getting Started

vlcluster consists of four different node types

  • registry Manages the cluster; stores and delivers applications
  • workers Run instances of applications
  • gateways Create nginx-proxys to instances running in workers
  • client Developers; can manage the cluster and push new applications

You can put multiple different node types on the same computer

Setting up the cluster

You can use windows, macOS or linux to manage your cluster and uplaod new application, but the registry, workers and gateways require linux with systemd (ubuntu, centos, fedora, ...)!

Creating the registry

Run the following commands to create our first registry. We'll call it mainnet. You can only have one registry per cluster - but you can have multiple clusters and switch between them! Make sure that your registry has a static ip address or a DNS entry, we'll need it later on to reference the node!

This will create the registry in ~/.vlcluster. The command will return a key. This key will be used later on to create the workers and clients

We need to make sure that vlcluster runs, even after a reboot. So, let's install it as a systemd service!

sudo vlcluster daemon install -u root

Setting up our first worker

Now you can either switch to a new machine or install the worker and the registry on the same machine. Run the following commands to create a worker and assign it a endpoint address.

We have to restart the daemon if your worker is on the same node as the registry.

sudo service vlcluster restart

If you're using a different node, install the vlcluster daemon with systemd

sudo vlcluster daemon install -u root

Creating a gateway

We want our requests to be able to get to our instances, so let's setup the gateway. You can do this on the same node as your worker or registry!

Restart the vlcluster daemon or install the daemon with systemd, like we did with the worker!

Connecting to the cluster

Let's get our first app published on our new mainnet cluster!

First, let's create a client. Open a new terminal on your computer and type

npm install -g vlcluster
vlcluster init

Now enter your email, the hostname of our registry (registry.example.com in the example) and paste the key (8cfh8jVXPd4... in our example).

You need to have docker installed on your system → Installation page

You don't need to run vlcluster as a daemon on your client.

Setting up applications

Clone vlcluster example and open a terminal in the project directory

Every vlcluster application requires a simple Dockerfile and a package.json with name and version

We'll deploy the vlcluster-example application to our registry, with the env productive.

We want to reach the application, right? Let's route your domain name (example-application.example.com:80 in this example) to the vlcluster-example application - but only to instances running as productive.

example-application.example.com will automatically be routed to the latest version of vlcluster-example running as productive. A simple deploy is all you need now! vlcluster will install the new version, await application start up, update the proxies and then stop the old instances - zero downtime deploys!

Imagine you'd wanna run a test environnement, and have it available on test.example-application.example.com. All you'll have to do is just type in those commands:

When making your own application, make sure to listen on the port defined in the env variable PORT. The port will automatically be assigned and routed.

Variables

Nobody wants hardcoded database connection strings! Thats why vlcluster allows you to create variables which will be set as ENV-variables in your applications

Just run:

The variables will be set after a deploy or a vlcluster instance restart

Command Reference

Setup

vlcluster init [client] [-e | --email <email>] [-h | --hostname <registry hostname>] [-k | --key <registry key>]
vlcluster init registry [-n | --name <registry name>]
vlcluster init worker [-h | --hostname <registry hostname>] [-k | --key <registry key>] [-n | --name <worker name>] [-e | --endpoint <worker endpoint>]
vlcluster init gateway [-h | --hostname <cluster hostname>] [-key | --key <cluster key>] [-n | --name <gateway name>] [-e | --endpoint <endpoint hostname>]

vlcluster daemon install [-u | --user <user>]

Building and Publishing

vlcluster build [[ -p | --project-path ] <project path> = "."]
vlcluster push [-c | --cluster <registry hostname>] [[ -a | --application ] <application>] [[ -v | --version ] <version>]
vlcluster upgrade [-c | --cluster <registry hostname>] [[ -a | --application ] <application>] [[ -v | --version ] <version>] [[ -e | --env ] <environnement>] [-i | --instances <instance count>]

vlcluster deploy [-c | --cluster <registry hostname>] [[ -e | --env ] <environnement>] [[ -p | --project-path ] <project path> = "."] [-i | --instances <instance count>]

Variables

vlcluster var set [-c | --cluster <registry hostname>] [[ -n | --name ] <name>] [[ -v | --value ] <value>] [-a | --application [ <application> ]] [-e | --env [ <environnement> ]]
vlcluster var read [-c | --cluster <registry hostname>] [[ -s | --source ] <path>] [[ -v | --value ] <value>] [-a | --application [ <application> ]] [-e | --env [ <environnement> ]]
vlcluster var list [-c | --cluster <registry hostname>] [-a | --application [ <application> ]] [-e | --env [ <environnement> ]]

Instance Management

vlcluster instance list [-c | --cluster <registry hostname>] [-a | --application [ <application> ]] [-e | --env [ <environnement> ]]
vlcluster instance restart [-c | --cluster <registry hostname>] [-a | --application [ <application> ]] [-e | --env [ <environnement> ]]

Routing

vlcluster route domain [-c | --cluster <registry hostname>] [-h | --host <host>] [-p | --port <port>] [-a | --application <application>] [-h | --host <host>] [-e | --env <env>]
vlcluster route websocket [-c | --cluster <registry hostname>] [-h | --host <host>] [-p | --port <port>] [-l | --location <location>]

SSL

SSL certificates are created by certbot which needs to be installed on the gateways! Creating the certificates requires the gateway to shutdown the nginx webserver temporarely!

vlcluster ssl enable [-c | --cluster <registry hostname>] [-h | --host <host>] [-p | --port <port>]

Utitlity

vlcluster system # shows cluster system info
vlcluster daemon # runs vlcluster daemon