(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 deployAnd Update the new password
| import React, { Component } from 'react' | |
| import axios from 'axios' | |
| class Swapi extends Component { | |
| constructor (props) { | |
| super(props) | |
| this.state = { | |
| character: {}, | |
| movielist: [], |
| import React, { Component } from 'react' | |
| import emojilist from '../data/emoji.json' | |
| class Emoji extends Component { | |
| constructor (props) { | |
| super(props) | |
| this.state = { | |
| emojivalue: '', | |
| emojidisplay: [] | |
| } |
| function flattenArray(arr) { | |
| const flattened = [].concat(...arr); | |
| return flattened.some(item => Array.isArray(item)) ? | |
| flattenArray(flattened) : flattened; | |
| } |
| const popular = arr.sort((a, b) => | |
| arr.filter(v => v===a).length | |
| - arr.filter(v => v ===b).length | |
| ).pop() |
(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 deployAnd Update the new password
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@youripaddressservice node-app start##Setup your server (this would ideally be done with automated provisioning)
npm install -g forever##Install flightplan
npm install -g flightplannpm install flightplan --save-dev