Skip to content

Commit 270399f

Browse files
authored
Merge pull request #9 from dweam-team/add-caddy-example
Clarify exposing-to-internet instructions, add caddy example, remove backend port exposure in docker compose
2 parents 69a2cd1 + 879078a commit 270399f

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

README.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,37 @@ Once it's running, visit [localhost:4321](http://localhost:4321).
7272

7373
#### Exposing to the internet/local network
7474

75-
By default, the backend and frontend will only bind to `localhost`.
76-
Use a reverse proxy (like [caddy](https://caddyserver.com/) or [nginx](https://nginx.org/)) to forward the following ports:
77-
- 8080 TCP
78-
- 4321 TCP
79-
80-
Expose the following ports for WebRTC:
81-
- 3478 TCP/UDP
82-
- 5349 TCP/UDP
83-
- 50000-50010 UDP
75+
If you're exposing the app to the internet, you should set a `TURN_SECRET_KEY` environment variable when running the app:
76+
77+
```
78+
export TURN_SECRET_KEY=$(openssl rand -base64 32)
79+
docker compose up --build
80+
```
81+
82+
Forward the following ports:
83+
- 4321 TCP (app)
84+
- 3478 TCP/UDP (WebRTC)
85+
- 5349 TCP/UDP (WebRTC)
86+
- 50000-50010 UDP (WebRTC)
87+
88+
By default, the app only binds to `localhost`.
89+
You may change this in the [`docker-compose.yaml`](docker-compose.yaml#L10-L11) file,
90+
but we suggest the use of a reverse proxy to expose port 4321 TCP.
91+
92+
For example, with [caddy](https://caddyserver.com/):
93+
94+
```
95+
# Caddyfile
96+
97+
example.com {
98+
# Optionally add basic authentication
99+
basic_auth {
100+
[username] [password-hash]
101+
}
102+
103+
reverse_proxy localhost:4321
104+
}
105+
```
84106

85107
## Adding a game
86108

docker-compose.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ services:
2424
# TODO is this shmem thing right
2525
shm_size: 2gb
2626
image: dweam_backend:local
27-
# TODO can we remove this exposure?
28-
# are any API calls being made directly still, is the frontend making them during serverside/redirecting them?
29-
ports:
30-
- "127.0.0.1:8080:8080"
3127
environment:
3228
- INTERNAL_TURN_URL=turnserver:3478
3329
- TURN_SECRET_KEY=${TURN_SECRET_KEY}

0 commit comments

Comments
 (0)