Skip to content

Commit a9de029

Browse files
authored
Merge pull request #68 from philtrep/2-nodes
Added 2 node container example
2 parents eab16ab + f99b3a3 commit a9de029

File tree

8 files changed

+82
-0
lines changed

8 files changed

+82
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ We provide examples of configurations you might use for a specific stack. Each e
7272
* [Mongo](https://github.com/Osedea/nodock/tree/master/_examples/mongo) - MongoDB + Node + NGINX
7373
* [RabbitMQ](https://github.com/Osedea/nodock/tree/master/_examples/rabbitmq) - RabbitMQ + Node + NGINX
7474
* [Memcached](https://github.com/Osedea/nodock/tree/master/_examples/memcached) - Memcached + Node + NGINX
75+
* [2 Node Apps](https://github.com/Osedea/nodock/tree/master/_examples/2-nodes) - Node + Node + NGINX
7576
7677
<a name="Workspace"></a>
7778
## Workspace

_examples/2-nodes/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## 2 Nodes
2+
3+
### Setup
4+
5+
Copy all the files in this folder to the project root:
6+
7+
```bash
8+
cd <project_folder>/
9+
10+
cp -r nodock/_examples/multiple-node/* .
11+
mv docker-compose.override.yml nodock/
12+
mv node2.conf nodock/nginx/sites/
13+
```
14+
15+
### Usage
16+
17+
```bash
18+
cd nodock/
19+
20+
docker-compose up -d node node2 nginx
21+
```
22+
23+
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!

_examples/2-nodes/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var express = require('express');
2+
var app = express();
3+
4+
app.get('/', function(req, res) {
5+
res.send('You are amazing');
6+
});
7+
8+
app.listen(8000);

_examples/2-nodes/node2.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
server {
2+
listen 10000 default_server;
3+
4+
location / {
5+
proxy_pass http://node2:10000; # Note that `node2` is the name of the service
6+
}
7+
}

_examples/2-nodes/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "example-2-node-docker",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "MIT",
11+
"dependencies": {
12+
"express": "^4.14.0"
13+
}
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var express = require('express');
2+
var app = express();
3+
4+
app.get('/', function(req, res) {
5+
res.send('You are pretty cool');
6+
});
7+
8+
app.listen(10000);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "example-multiple-node-docker",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "MIT",
11+
"dependencies": {
12+
"express": "^4.14.0"
13+
}
14+
}

nginx/sites/node2.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
server {
2+
listen 10000 default_server;
3+
4+
location / {
5+
proxy_pass http://node2:10000; # Note that `node2` is the name of the service
6+
}
7+
}

0 commit comments

Comments
 (0)