2
2
3
3
Elixir WebRTC-based apps can be easily deployed on [ Fly.io] ( https://fly.io ) !
4
4
5
- There are just two things you need to do:
5
+ There are just three things you need to do:
6
6
7
7
* configure a STUN server both on the client and server side
8
8
* use a custom Fly.io IP filter on the server side
9
-
10
- In theory, configuring a STUN server just on one side should be enough but we recommend doing it on both sides.
9
+ * slightly modify the auto-generated Dockerfile
11
10
12
11
In JavaScript code:
13
12
@@ -32,19 +31,31 @@ ip_filter = Application.get_env(:your_app, :ice_ip_filter)
32
31
In ` runtime.exs ` :
33
32
34
33
``` elixir
35
- if System .get_env (" FLY_IO " ) do
34
+ if System .get_env (" FLY_APP_NAME " ) do
36
35
config :your_app , ice_ip_filter: & ExWebRTC .ICE .FlyIpFilter .ip_filter / 1
37
36
end
38
37
```
39
38
40
- In fly.toml:
39
+ Now:
40
+ 1 . Run ` fly launch ` . It will generate a Dockerfile that will fail to build.
41
+ 2 . Introduce the following changes
41
42
42
- ``` toml
43
- [env ]
44
- # add one additional env
45
- FLY_IO = ' true'
46
- ```
43
+ ``` diff
44
+ - ARG ELIXIR_VERSION=1.16.0
45
+ - ARG OTP_VERSION=26.2.1
46
+ - ARG DEBIAN_VERSION=bullseye-20231009-slim
47
+ + ARG ELIXIR_VERSION=1.17.2
48
+ + ARG OTP_VERSION=27.0.1
49
+ + ARG DEBIAN_VERSION=bookworm-20240701-slim
50
+
51
+ # when building on arm64, you will also need to add libsrtp2-dev
52
+ - RUN apt-get update -y && apt-get install -y build-essential git \
53
+ - && apt-get clean && rm -f /var/lib/apt/lists/*_*
54
+ + RUN apt-get update -y && apt-get install -y build-essential git pkg-config libssl-dev \
55
+ + && apt-get clean && rm -f /var/lib/apt/lists/*_*
56
+ ```
57
+
58
+ 3. Run `fly deploy` to retry.
47
59
48
60
That's it!
49
- No special UDP port exports or dedicated IP address are needed.
50
- Just run ` fly launch ` and enjoy your deployment :)
61
+ No special UDP port exports or dedicated IP address are needed :)
0 commit comments