diff --git a/docs/getting-started/gcp.md b/docs/getting-started/gcp.md new file mode 100644 index 00000000..8ab1b2e2 --- /dev/null +++ b/docs/getting-started/gcp.md @@ -0,0 +1,109 @@ +--- +layout: docs-getting-started +title: Running on Google Cloud Platform (GCP) +slug: gcp +toc: toc-user-guide.html +redirect_from: + - /docs/platforms/gcp +--- + +This guide takes you through the steps to get Node-RED running on an GCP +Virtual Machine instance. + +#### Create the base image + +1. Log in to the [Google Cloud Platform Console](https://console.cloud.google.com/) + +1. Select your project. + +1. Click `VPC network` >> `VPC networks` >> `Firewall rules` >> `CREATE FIREWALL RULE` + + new `Create a firewall rule` with the options set as: + - Name: node-red-editor + - Network: default + - Priority: 1010 + - Direction of traffic: Ingress + - Action on match: Allow + - Targets: ALL Instances in the network + - Source filter: IP ranges + - Source IP ranges: 0.0.0.0/0 + - Protocols and ports: Specified protocols and ports + - tcp: 1880 + + Click `Create` on the Settings page. + +1. Click `Compute Engine` >> `VM instances` >> `Create` + + Give your machine info + - Name: node-red-instance + - Region: us-central1 + - Zone: us-central1-a + - Machine configuration + - Machine family + - General-purpose + - Series + - N1 + - Machine type + - f1-micro + - Boot disk + - Ubuntu 18.04 LTS + + Click `Create` on the Settings page, then the instance will start to be created. + +After a couple of minutes your instance will be running. In the console +you can find your instance's IP address as `External IP`. + +#### Setup Node-RED + +The next task is to log into the instance then install node.js and Node-RED. + +Log into your instance using the authentication details you specified in the +previous stage. + +Once logged in you need to install node.js and Node-RED using manual install. + +[NodeSource Node.js Binary Distributions](https://github.com/nodesource/distributions#manual-installation) + +Remove the old PPA if it exists + + sudo add-apt-repository -y -r ppa:chris-lea/node.js + sudo rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list + sudo rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list.save + +Add the NodeSource package signing key + + curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - + +Add the desired NodeSource repository + + VERSION=node_10.x + DISTRO="$(lsb_release -s -c)" + echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list + echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list + +Update package lists and install Node.js + + sudo apt-get update + sudo apt-get install nodejs + +Install Node-RED + + sudo apt-get install build-essential + sudo npm install -g node-red + + +At this point you can test your instance by running `node-red`. *Note*: you may +get some errors regarding the Serial node - that's to be expected and can be +ignored. + +Once started, you can access the editor at `http://<your-instance-ip>:1880/`. + +To get Node-RED to start automatically whenever your instance is restarted, you +can use pm2: + + sudo npm install -g pm2 + pm2 start `which node-red` -- -v + pm2 save + pm2 startup + +*Note:* this final command will prompt you to run a further command - make sure you do as it says. diff --git a/docs/getting-started/index.md b/docs/getting-started/index.md index 488b787e..9785075d 100644 --- a/docs/getting-started/index.md +++ b/docs/getting-started/index.md @@ -117,3 +117,15 @@ such as a Raspberry Pi or in the cloud and follow the guides below. </div> </a> </div> + +<div class="post-preview"> + <a href="gcp"> + <div class="post-header"> + <img src="/images/platform-cloud.png"> + <h2>Google Cloud Platform</h2> + </div> + <div class="post-content"> + Running on an Virtual Machine on Google infrastructure + </div> + </a> +</div>