Skip to content

Commit

Permalink
Merge pull request #26 from lightrun-platform/lightrun-broker-to-layer-7
Browse files Browse the repository at this point in the history
upd broker files to L7
  • Loading branch information
Leonid Podolinskiy authored Sep 22, 2024
2 parents 39f2b2a + ff74feb commit eceb5f3
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 14 deletions.
9 changes: 7 additions & 2 deletions lightrun-broker/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ Open the `docker-compose.yaml` file in your preferred code editor, and change th

> Note: *The `LIGHTRUN_SERVER` parameter should be in a `<tenant>.client.lightrun.com` format.*
#### Step 2: Start the Lightrun Broker
#### Step 2: Add certificate
Add `tls.crt` and `tls.key` files with an appropriate content to the `/conf/certs`
> [!WARNING]
> _Don't forget to delete `tls.crt_placeholder` and `tls.key_placeholder` files_
#### Step 3: Start the Lightrun Broker
Start the Lightrun broker image with the following command.

```
docker-compose up -d
```

#### Step 3: Confirm your connection
#### Step 4: Confirm your connection
Enter your Lightrun Server URL value into your browser. The connection should pass through the Lightrun Broker before going to the Lightrun server.

> Important: *Be sure that within your network **lightrun server** is resolved to IP of Lightrun broker.*
Expand Down
Empty file.
Empty file.
68 changes: 60 additions & 8 deletions lightrun-broker/conf/default.template
Original file line number Diff line number Diff line change
@@ -1,14 +1,66 @@
stream {
log_format basic '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time';
http {
upstream lightrun {
server ${LIGHTRUN_SERVER}:443;
zone lightrun 64k;
server ${LIGHTRUN_SERVER}:443 max_fails=0;
keepalive 2;
}

server {
access_log /dev/stdout basic;
listen 443;
proxy_pass lightrun;
listen 8443 ssl;
server_name _ ;
ssl_certificate /etc/nginx/conf.d/certs/tls.crt;
ssl_certificate_key /etc/nginx/conf.d/certs/tls.key;
ssl_prefer_server_ciphers on;

location / {
client_body_buffer_size 512k;
client_max_body_size 25m;


proxy_connect_timeout 90s;
proxy_send_timeout 90s;
proxy_read_timeout 90s;

proxy_buffering on;
proxy_buffer_size 1m;
proxy_buffers 4 1m;

proxy_max_temp_file_size 1024m;

proxy_request_buffering on;
proxy_http_version 1.1;

proxy_cookie_domain off;
proxy_cookie_path off;

proxy_pass https://lightrun;

proxy_set_header Host ${LIGHTRUN_SERVER};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

}

location /socket {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host ${LIGHTRUN_SERVER};
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass https://lightrun;

proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
11 changes: 7 additions & 4 deletions lightrun-broker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
version: "3.3"
services:
nginx:
image: lightruncom/lightrun-broker:latest.layer4
image: lightruncom/lightrun-broker:0.1.0.layer7
ports:
- "443:443"
- "443:8443"
user: root # may be requred for permissions to certificates
environment:
LIGHTRUN_SERVER: <tenant>.client.lightrun.com
volumes:
- type: bind
source: ./conf/certs/
target: /etc/nginx/conf.d/certs/
- type: bind
source: ./conf/default.template
target: /tmp/default.template
restart: always
dns:
- 8.8.8.8 # Set here your public DNS for resolving original Lightrun endpoint
- 8.8.8.8

0 comments on commit eceb5f3

Please sign in to comment.