add docker-compose example in separate folder
This commit is contained in:
parent
c5dfad41fa
commit
d61c8f5766
3 changed files with 92 additions and 129 deletions
135
docs/Docker.md
135
docs/Docker.md
|
|
@ -45,133 +45,10 @@ docker run -it -e "BUMPER_ANNOUNCE_IP=X.X.X.X" -p 443:443 -p 8007:8007 -p 8883:8
|
|||
|
||||
# Docker-compose
|
||||
|
||||
Below a docker-compose example with an nginx proxy, which redirects mqtt traffic on port `443` to port `8883`
|
||||
A docker-compose example can be found in the ["example" folder](https://github.com/bmartin5692/bumper/tree/master/example/docker-compose).
|
||||
|
||||
The docker-compose starts two services:
|
||||
- bumper itself
|
||||
- nginx proxy, which redirects MQTT traffic on port `443` to port `8883`
|
||||
|
||||
The redirection is required as the app v2+ and robots with a newer firmware are connecting to the mqtt server on port 433.
|
||||
|
||||
```yaml
|
||||
---
|
||||
version: "3.6"
|
||||
|
||||
networks:
|
||||
bumper:
|
||||
internal: true
|
||||
|
||||
services:
|
||||
nginx:
|
||||
depends_on:
|
||||
- bumper
|
||||
image: nginx:alpine
|
||||
networks:
|
||||
default:
|
||||
bumper:
|
||||
expose:
|
||||
- 443
|
||||
- 5223
|
||||
- 8007
|
||||
- 8883
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./nginx/:/etc/nginx:ro # See config file below
|
||||
|
||||
bumper:
|
||||
image: bmartin5692/bumper
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
bumper:
|
||||
|
||||
environment:
|
||||
PUID: 1000
|
||||
PGID: 1000
|
||||
TZ: Europe/Rome
|
||||
BUMPER_ANNOUNCE_IP: XXX # Insert your IP
|
||||
BUMPER_LISTEN: 0.0.0.0
|
||||
# BUMPER_DEBUG: "true"
|
||||
LOG_TO_STDOUT: "true"
|
||||
volumes:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./config:/bumper/data
|
||||
- ./certs:/bumper/certs
|
||||
```
|
||||
|
||||
## Nginx configuration
|
||||
|
||||
File stored under `./nginx/nginx.conf`
|
||||
|
||||
```
|
||||
error_log stderr;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events { }
|
||||
|
||||
stream {
|
||||
resolver 127.0.0.11 ipv6=off; #docker dns server
|
||||
map_hash_bucket_size 64;
|
||||
|
||||
map $ssl_preread_server_name $internalport {
|
||||
# redirect all requests, which contain "mq" in the SNI -> MQTT
|
||||
~^.*(mq).*\.eco(vacs|user)\.(net|com)$ 8883;
|
||||
|
||||
# the rest of eco(user|vacs) requests
|
||||
~^.*eco(vacs|user)\.(net|com)$ 443;
|
||||
|
||||
# mapping default to MQTT as the bots are connecting directly to the ip without SNI
|
||||
default 8883;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
ssl_preread on;
|
||||
proxy_pass bumper:$internalport;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 5223;
|
||||
proxy_pass bumper:5223;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8007;
|
||||
proxy_pass bumper:8007;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8883;
|
||||
proxy_pass bumper:8883;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## File structure
|
||||
|
||||
When ure are using the docker-compose example, you will have a similar file structure as below
|
||||
|
||||
```
|
||||
.
|
||||
├── certs
|
||||
│ ├── bumper.crt
|
||||
│ ├── bumper.csr
|
||||
│ ├── bumper.key
|
||||
│ ├── ca.crt
|
||||
│ ├── ca.csr
|
||||
│ ├── ca.key
|
||||
│ ├── ca.srl
|
||||
│ ├── certconfig_bumper.txt
|
||||
│ ├── certconfig_ca.txt
|
||||
│ ├── commands.md
|
||||
│ ├── create_bumper.sh
|
||||
│ ├── create_ca.sh
|
||||
│ ├── csrconfig_bumper.txt
|
||||
│ └── csrconfig_ca.txt
|
||||
├── config
|
||||
│ ├── bumper.db
|
||||
│ └── passwd
|
||||
├── docker-compose.yml
|
||||
└── nginx
|
||||
└── nginx.conf
|
||||
|
||||
3 directories, 18 files
|
||||
|
||||
```
|
||||
45
example/docker-compose/docker-compose.yaml
Normal file
45
example/docker-compose/docker-compose.yaml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
version: "3.6"
|
||||
|
||||
networks:
|
||||
bumper:
|
||||
internal: true
|
||||
|
||||
services:
|
||||
nginx:
|
||||
depends_on:
|
||||
- bumper
|
||||
image: nginx:alpine
|
||||
networks:
|
||||
default:
|
||||
bumper:
|
||||
ports:
|
||||
- 443:443
|
||||
- 5223:5223
|
||||
- 8007:8007
|
||||
- 8883:8883
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./nginx/:/etc/nginx:ro # See config file below
|
||||
|
||||
bumper:
|
||||
image: bmartin5692/bumper
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
bumper:
|
||||
|
||||
environment:
|
||||
PUID: 1000
|
||||
PGID: 1000
|
||||
TZ: Europe/Rome
|
||||
BUMPER_ANNOUNCE_IP: XXX # Insert your IP
|
||||
BUMPER_LISTEN: 0.0.0.0
|
||||
# BUMPER_DEBUG: "true"
|
||||
LOG_TO_STDOUT: "true"
|
||||
volumes:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- ./config:/bumper/data
|
||||
- ./certs:/bumper/certs
|
||||
41
example/docker-compose/nginx/nginx.conf
Normal file
41
example/docker-compose/nginx/nginx.conf
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
error_log stderr;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events { }
|
||||
|
||||
stream {
|
||||
resolver 127.0.0.11 ipv6=off; #docker dns server
|
||||
map_hash_bucket_size 64;
|
||||
|
||||
map $ssl_preread_server_name $internalport {
|
||||
# redirect all requests, which contain "mq" in the SNI -> MQTT
|
||||
~^.*(mq).*\.eco(vacs|user)\.(net|com)$ 8883;
|
||||
|
||||
# the rest of eco(user|vacs) requests
|
||||
~^.*eco(vacs|user)\.(net|com)$ 443;
|
||||
|
||||
# mapping default to MQTT as the bots are connecting directly to the ip without SNI
|
||||
default 8883;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
ssl_preread on;
|
||||
proxy_pass bumper:$internalport;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 5223;
|
||||
proxy_pass bumper:5223;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8007;
|
||||
proxy_pass bumper:8007;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8883;
|
||||
proxy_pass bumper:8883;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue