GreenHat SBS installation and updating

Installation and updating

Installing Node and NPM

GreenHat SBS is a Node.js project, installed via NPM (Node Package Manager), so those need to be installed first.

You can download an installer for your platform here: https://nodejs.org/en/download/

Run the installer and follow the instructions. This will install both node and NPM.

Installing GreenHat SBS

The best way to go about this is to add a package.json file to the root of your website.

Create a new local directory for the site and add the package.json to that.

The package.ison file should be as follows:

{
    "name": "a-name-for-your-site-no-spaces",
    "version": "0.1.0",
    "description": "Your site description.",
    "homepage": "https://your-site-url.com",
    "license": "MIT",
    "minimum-stability": "dev",
    "authors": [
        {
            "name": "Your Name",
            "email": "contact@your-site-email.com"
        }
    ],
    "dependencies": {
        "greenhat-sbs": "*"
    }
}

Replace the ‘your-site’ fields with things appropriate to your own site. The important bit (that should remain as specified above) is the dependencies section.

How open a Terminal/Console window and navigate to your site directory in that and then type:

npm update

You should have SBS installed following that.

Generate a new site

Now that SBS is there, it can generate a new site for you.

Make sure you’re still in the directory where you want the site generated and type the following into the Terminal/Console:

node node_modules/greenhat-sbs/app.js --sitegen

You can then test your site by running:

./run-dev.sh

The last console message will give you the address of the locally running site. If you copy that address and paste it into your browser you should see your site.

Updating SBS

From time to time new releases of SBS will become available. Take updates by running the run-sbs-update.sh batch file as follows:

./run-sbs-update.sh

If it doesn't appear to take an update when you're expecting one, check the package.json file in your site's root directory and ensure the dependencies at the bottom reads as follows:

"dependencies": {
        "greenhat-sbs": "*"
}

In particular, there must be an asterisk as the value for greenhat-sbs.