Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy hybrid instructions #17

Merged
merged 1 commit into from
Oct 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 1 addition & 130 deletions pages/docs/other/hybrid-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Callout } from 'nextra-theme-docs'

There are two methods to send data to Golbat while continuing to use the device controller component from RealDeviceMap (RDM). This will allow you take advantage of Golbat's parsing.

## Using RDM Raw Reflection (Recommended)
## Using RDM Raw Reflection

As of RealDeviceMap (RDM) version 1.51.0 (July 11, 2023) you can use the built-in `raw forward` option. Some notes:

Expand All @@ -34,132 +34,3 @@ Example configuration:
}
}
```

## Using Nginx (Legacy)

To use the Unown# stack for production purposes, you must supply some middleware to help split webhook requests between Golbat and RealDeviceMap. We will utilize [Nginx]'s mirror functionality to accomplish this task.

The result is data intended for controlling devices will go to `http://RDM:<port>/controler` while raw data goes to `http://RDM:<port>/raw` and `http://GOLBAT:<port>/raw`.

### Nginx Config File

Credit to [lenisko](https://github.com/jfberry/goforward/issues/1#issue-1528222766) for the original configuration.

```ini
# target of controler server
upstream controller {
server RDM_IP_ADDRESS:9001;
}

# target of raw mirror one
upstream mirrorOne {
server GOLBAT_IP_ADDRESS:9001;
}

# target of raw mirror two. If you need more /raw mirrors
# uncomment and add the same way as commented below
# upstream mirrorTwo {
# server OTHER_IP_ADDRESS:9001;
# }

server {
# listen port of nginx vhost
listen 80;
# server_name foobar.example.com;
# access_log off;
# error_log /dev/null crit;

location /raw {
mirror /mirrorOne;
#mirror /mirrorTwo;
proxy_pass http://controller/raw;
proxy_connect_timeout 500ms;
proxy_read_timeout 500ms;
proxy_set_header Host $host;
client_body_buffer_size 10M;
}

location /controler {
proxy_pass http://controller/controler;
proxy_connect_timeout 500ms;
proxy_read_timeout 500ms;
proxy_set_header Host $host;
}

location = /mirrorOne {
internal;
proxy_pass http://mirrorOne/raw;
proxy_connect_timeout 500ms;
proxy_read_timeout 500ms;
proxy_set_header Host $host;
proxy_set_header X-Goforward "Forwarded!";
}

#location = /mirrorTwo {
# internal;
# proxy_pass http://mirrorTwo/raw;
# proxy_connect_timeout 500ms;
# proxy_read_timeout 500ms;
# proxy_set_header Host $host;
# proxy_set_header X-Goforward "Forwarded!";
#}
}
```

### Manual Setup

1. Install [Nginx]
2. Copy the above configuration file into `/etc/nginx/confg.d/relay.conf`
3. Adjust the following variables for your environment

- RDM_IP_ADDRESS:9001
- GOLBAT_IP_ADDRESS:9001
- Might need to adjust the listen port or server_name

4. Restart the nginx service `sudo systemctl restart nginx`
5. Adjust a few devices to send requests to this nginx endpoint
6. Monitor the access log located at `/var/log/nginx/access.log`
7. If everything works as intended, you will see `200` status messages in the access log.

_Note:_ You might want to turn off the `access_log` after verifying success to save on disk IO.

### Docker Setup

Docker configuration is almost the same as manual. If your Golbat & RDM instances are in docker, we recommend you include all three services in one `docker-compose.yml` file or make them all a part of one network. Sharing the same docker network allows services to communicate over their service name.

1. Copy the below contents and save it in a `docker-compose.yml` file

```yml
version: '3'
services:
relay:
image: nginx
container_name: relay
ports:
- "8001:80" # Right side is the external port
volumes:
- ./relay.conf:/etc/nginx/conf.d/default.conf
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "20m"

networks:
default:
name: scanner
```

2. Copy the `nginx` configuration from the first section
3. Create a new file named `relay.conf` next to your `docker-compose.yml` file
4. Adjust the following variables for your environment. Remember, if all services are part of the same docker network, you can use their service name, and nginx will be able to resolve. IE - `rdm:9001`, `golbat:9001`, etc.

- RDM_IP_ADDRESS:9001
- GOLBAT_IP_ADDRESS:9001

5. Start the relay service with `docker compose up -d`
6. Monitor the logs `docker compose logs -f`
7. Adjust a few devices to send requests to this nginx endpoint
8. If everything works as intended, you will see `200` status messages in the access log.

[Nginx]: https://nginx.org/