In your command-line run the following commands:
brew doctor
brew update
<?php | |
//JSON.php -> http://pear.php.net/package/Services_JSON/ | |
require_once 'JSON.php'; | |
if ( !function_exists('json_decode') ){ | |
function json_decode($content, $assoc=false){ | |
if ( $assoc ){ | |
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); |
const axios = require("axios"); | |
const key = "AIzaSyB9e-dHIvdxxrbmorjYHWipwBKq7LJBhNk" | |
function getComments(pageToken, allItems = {}) { | |
const params = { | |
key, | |
videoId: "a4haLJdDRmc", | |
part: "snippet", | |
maxResults: 100, | |
pageToken, |
# the IP(s) on which your node server is running. I chose port 3000. | |
upstream app_geoforce { | |
server 127.0.0.1:3000; | |
} | |
upstream app_pcodes{ | |
server 127.0.0.1:3001; | |
} |
In your command-line run the following commands:
brew doctor
brew update
// browser detect | |
var BrowserDetect = { | |
init: function() { | |
this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; | |
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; | |
this.OS = this.searchString(this.dataOS) || "an unknown OS"; | |
}, | |
searchString: function(data) { | |
for (var i = 0; i < data.length; i++) { | |
var dataString = data[i].string; |
(wherever it says url.com, use your server's domain or IP)
Login to new server as root, then add a deploy user
sudo useradd --create-home -s /bin/bash deploy
sudo adduser deploy sudo
sudo passwd deploy
And Update the new password
##Setup your server (this would ideally be done with automated provisioning)
npm install -g forever
##Install flightplan
npm install -g flightplan
npm install flightplan --save-dev
Deploying a node app with Forever is great...until your server restarts unexpectedly. Then your app stops running and you have to re-deploy.
To get around this, we're going to run our node app as an Upstart service. Upstart services are great, because, once started, the system auto-restarts them if they fail, or if the server restarts.
###Step 1: Create a service for your node app
ssh root@youripaddress
service node-app start