Skip to content

Commit

Permalink
Merge pull request #68 from philtrep/2-nodes
Browse files Browse the repository at this point in the history
Added 2 node container example
  • Loading branch information
philtrep authored Nov 4, 2016
2 parents eab16ab + f99b3a3 commit a9de029
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ We provide examples of configurations you might use for a specific stack. Each e
* [Mongo](https://github.com/Osedea/nodock/tree/master/_examples/mongo) - MongoDB + Node + NGINX
* [RabbitMQ](https://github.com/Osedea/nodock/tree/master/_examples/rabbitmq) - RabbitMQ + Node + NGINX
* [Memcached](https://github.com/Osedea/nodock/tree/master/_examples/memcached) - Memcached + Node + NGINX
* [2 Node Apps](https://github.com/Osedea/nodock/tree/master/_examples/2-nodes) - Node + Node + NGINX
<a name="Workspace"></a>
## Workspace
Expand Down
23 changes: 23 additions & 0 deletions _examples/2-nodes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## 2 Nodes

### Setup

Copy all the files in this folder to the project root:

```bash
cd <project_folder>/

cp -r nodock/_examples/multiple-node/* .
mv docker-compose.override.yml nodock/
mv node2.conf nodock/nginx/sites/
```

### Usage

```bash
cd nodock/

docker-compose up -d node node2 nginx
```

By going to `127.0.0.1` in your browser you should be seeing a nice greeting! By going to `127.0.0.1:10000` in your browser you should be seeing _another_ nice greeting!
8 changes: 8 additions & 0 deletions _examples/2-nodes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var express = require('express');
var app = express();

app.get('/', function(req, res) {
res.send('You are amazing');
});

app.listen(8000);
7 changes: 7 additions & 0 deletions _examples/2-nodes/node2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
server {
listen 10000 default_server;

location / {
proxy_pass http://node2:10000; # Note that `node2` is the name of the service
}
}
14 changes: 14 additions & 0 deletions _examples/2-nodes/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "example-2-node-docker",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"dependencies": {
"express": "^4.14.0"
}
}
8 changes: 8 additions & 0 deletions _examples/2-nodes/second-app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var express = require('express');
var app = express();

app.get('/', function(req, res) {
res.send('You are pretty cool');
});

app.listen(10000);
14 changes: 14 additions & 0 deletions _examples/2-nodes/second-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "example-multiple-node-docker",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"dependencies": {
"express": "^4.14.0"
}
}
7 changes: 7 additions & 0 deletions nginx/sites/node2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
server {
listen 10000 default_server;

location / {
proxy_pass http://node2:10000; # Note that `node2` is the name of the service
}
}

0 comments on commit a9de029

Please sign in to comment.