-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const express = require('express'); | ||
|
||
const app = express(); | ||
|
||
app.get('/', (req, res) => { | ||
res.send(`<h1>Dummy app</h1><p>Response from PID: ${process.pid}. Hit F5 many times!</p>`); | ||
}); | ||
app.listen(3000, () => console.log('Listening on port 3000!')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "sample-app", | ||
"version": "0.0.1", | ||
"main": "index.js", | ||
"author": { | ||
"name": "Julian Reyes", | ||
"email": "jreyes@bixlabs.com", | ||
"url": "https://twitter.com/rokemaster" | ||
}, | ||
"dependencies": { | ||
"express": "^4.15.4" | ||
}, | ||
"private": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This loads nvm | ||
export NVM_DIR="$HOME/.nvm" | ||
\. "$NVM_DIR/nvm.sh" | ||
|
||
cp -r $HOME/provision/app $HOME/ | ||
cp -r $HOME/provision/pm2.json $HOME/app-pm2.json | ||
npm i -g pm2 | ||
|
||
cd $HOME/app | ||
npm i | ||
|
||
pm2 start $HOME/app-pm2.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
sudo apt-get install -y nginx | ||
sudo rm /etc/nginx/sites-enabled/default | ||
sudo ln -s $HOME/provision/nginx_app.conf /etc/nginx/sites-enabled/default | ||
sudo systemctl restart nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
function latest_version() { | ||
curl -s https://api.github.com/repos/creationix/nvm/releases/latest \ | ||
| grep 'tag_name' \ | ||
| cut -d '"' -f 4 | ||
} | ||
|
||
function install_version() { | ||
curl "https://raw.githubusercontent.com/creationix/nvm/${1}/install.sh" \ | ||
| bash | ||
} | ||
|
||
install_version `latest_version` | ||
|
||
export NVM_DIR="$HOME/.nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | ||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | ||
|
||
nvm install 8.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y build-essential libssl-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
upstream app { | ||
server 127.0.0.1:3000; | ||
} | ||
|
||
server { | ||
listen 80 default_server; | ||
listen [::]:80 default_server; | ||
|
||
server_name _; | ||
|
||
location / { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
|
||
proxy_pass http://app; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "dummy-app", | ||
"cwd": "/home/ubuntu/app", | ||
"script": "index.js", | ||
"env": { | ||
"NODE_ENV": "production" | ||
}, | ||
"instances": 2, | ||
"exec_mode": "cluster" | ||
} |