Skip to content

Commit 42eb928

Browse files
author
aborderon
committed
Add support for Docker Compose
1 parent a3cb0eb commit 42eb928

4 files changed

+130
-0
lines changed

README.md

+89
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ You have three options:
3838
- Run node-build-monitor [by downloading the standalone version](#run-the-standalone-version-easiest-way) <sub><sup>(easiest way to run it)</sup></sub>
3939
- Run node-build-monitor [manually with node](#run-it-manually-during-development) <sub><sup>(preferred during development)</sup></sub>
4040
- Run node-build-monitor [with Docker](#run-it-with-docker-in-production) <sub><sup>(preferred in production)</sup></sub>
41+
- Run node-build-monitor [with Docker Compose](#run-it-with-docker-compose-in-production) <sub><sup>(preferred in production)</sup></sub>
4142

4243
### Configuration
4344

@@ -454,6 +455,94 @@ Ensure that you omit the `tfsProxyUrl` setting in your `config.json`, so that it
454455

455456
Now open your browser and navigate to [http://localhost:12345](http://localhost:12345) to see your running or finished builds. Switch to fullscreen for the best experience.
456457

458+
### Run it with Docker Compose (in production)
459+
460+
You can try out or install the build monitor with [Docker Compose](https://docs.docker.com/compose/) easily.
461+
462+
__TL;DR:__ Go to the [docker directory](docker/), edit the file `config.json` and run the following commands, which you need.
463+
464+
Below, each commands is explained in detail.
465+
466+
#### 1. Create configuration and set up the build monitor
467+
Place a file `config.json` next to the `docker-compose.*.yml` and configure the services:
468+
```json
469+
{
470+
"monitor": {
471+
"interval": 30000,
472+
"numberOfBuilds": 12,
473+
"latestBuildOnly": false,
474+
"sortOrder": "date",
475+
"debug": true
476+
},
477+
"services": [
478+
{
479+
"name": "Travis",
480+
"configuration": {
481+
"slug": "marcells/bloggy"
482+
}
483+
},
484+
{
485+
"name": "Travis",
486+
"configuration": {
487+
"slug": "marcells/node-build-monitor"
488+
}
489+
}
490+
]
491+
}
492+
```
493+
494+
See the description of this file in the configuration section above.
495+
496+
#### 2. Build your custom build monitor image
497+
498+
Build your custom node-build-monitor docker image. This will also include your configuration from the previous step.
499+
500+
#### 3. Run the container
501+
502+
##### a. Without tfs-proxy
503+
504+
Installing and running node-build-monitor in a docker container for use on the same machine is simple with the following commands:
505+
506+
Run docker-compose from your custom `docker-compose.yml`
507+
```
508+
docker-compose build
509+
docker-compose -f docker-compose.yml up -d
510+
```
511+
You can now find your node-build-monitor instance running on localhost:3000.
512+
513+
##### b. With tfs-proxy
514+
515+
If you want to get access to the tfs-proxy, then you need a slighly different command, which allows the build monitor container to access the tfs-proxy container.
516+
517+
Run docker-compose from your custom `docker-compose.with-tfs-proxy.yml`
518+
```
519+
docker-compose -f docker-compose.with-tfs-proxy.yml up -d --build
520+
```
521+
Ensure that you omit the `tfsProxyUrl` setting in your `config.json`, so that it can be determined automatically. [Here](https://docs.docker.com/userguide/dockerlinks/#container-linking) you'll get more information about container linking.
522+
523+
You can now find your node-build-monitor instance running on localhost:3000.
524+
525+
##### c. With self-signed-certs
526+
527+
If you connect to services, which are using self signed certificates, run docker-compose from your custom `docker-compose.with-self-signed-certs.yml`
528+
```
529+
docker-compose build
530+
docker-compose.with-self-signed-certs.yml
531+
```
532+
You can now find your node-build-monitor instance running on localhost:3000.
533+
534+
##### d. Access logs
535+
536+
To see logs:
537+
```
538+
docker logs -f docker_node-build-monitor_1
539+
```
540+
View which dockers are running by executing docker ps.
541+
542+
#### 5. Access it with your browser
543+
544+
Now open your browser and navigate to [http://localhost:12345](http://localhost:12345) to see your running or finished builds. Switch to fullscreen for the best experience.
545+
457546
### Theming support
458547

459548
Here you can check out the existing themes. Feel free to [add your own](#creating-a-new-theme) and make a pull request. It can be done very easy.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3'
2+
3+
services:
4+
node-build-monitor:
5+
restart: unless-stopped
6+
image: marcells/node-build-monitor
7+
build: .
8+
environment:
9+
NODE_ENV: production
10+
NODE_TLS_REJECT_UNAUTHORIZED: 0
11+
ports:
12+
- 3000:3000
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3'
2+
3+
services:
4+
node-build-monitor:
5+
restart: unless-stopped
6+
image: marcells/node-build-monitor
7+
build: .
8+
links:
9+
- tfs-proxy
10+
environment:
11+
NODE_ENV: production
12+
ports:
13+
- 3000:3000
14+
15+
tfs-proxy:
16+
restart: unless-stopped
17+
image: marcells/tfs-proxy
18+
build: .

docker/docker-compose.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3'
2+
3+
services:
4+
node-build-monitor:
5+
restart: unless-stopped
6+
image: marcells/node-build-monitor
7+
build: .
8+
environment:
9+
NODE_ENV: production
10+
ports:
11+
- 3000:3000

0 commit comments

Comments
 (0)