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

Update Fly.io instructions #169

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Add `ex_webrtc` to the list of dependencies in `mix.exs`
```elixir
def deps do
[
{:ex_webrtc, "~> 0.5.0"}
{:ex_webrtc, "~> 0.6.0"}
]
end
```
Expand Down
35 changes: 23 additions & 12 deletions guides/deploying/fly.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

Elixir WebRTC-based apps can be easily deployed on [Fly.io](https://fly.io)!

There are just two things you need to do:
There are just three things you need to do:

* configure a STUN server both on the client and server side
* use a custom Fly.io IP filter on the server side

In theory, configuring a STUN server just on one side should be enough but we recommend doing it on both sides.
* slightly modify the auto-generated Dockerfile

In JavaScript code:

Expand All @@ -32,19 +31,31 @@ ip_filter = Application.get_env(:your_app, :ice_ip_filter)
In `runtime.exs`:

```elixir
if System.get_env("FLY_IO") do
if System.get_env("FLY_APP_NAME") do
config :your_app, ice_ip_filter: &ExWebRTC.ICE.FlyIpFilter.ip_filter/1
end
```

In fly.toml:
Now:
1. Run `fly launch`. It will generate a Dockerfile that will fail to build.
2. Introduce the following changes

```toml
[env]
# add one additional env
FLY_IO = 'true'
```
```diff
- ARG ELIXIR_VERSION=1.16.0
- ARG OTP_VERSION=26.2.1
- ARG DEBIAN_VERSION=bullseye-20231009-slim
+ ARG ELIXIR_VERSION=1.17.2
+ ARG OTP_VERSION=27.0.1
+ ARG DEBIAN_VERSION=bookworm-20240701-slim

# when building on arm64, you will also need to add libsrtp2-dev
- RUN apt-get update -y && apt-get install -y build-essential git \
- && apt-get clean && rm -f /var/lib/apt/lists/*_*
+ RUN apt-get update -y && apt-get install -y build-essential git pkg-config libssl-dev \
+ && apt-get clean && rm -f /var/lib/apt/lists/*_*
Comment on lines +52 to +55
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could mention that it may be necessary to add libsrtp2-dev as well -- notably when building on an arm64 machine (or targeting arm64 Linux in general, seeing as ex_libsrtp doesn't provide a prebuilt package in that case)

```

3. Run `fly deploy` to retry.

That's it!
No special UDP port exports or dedicated IP address are needed.
Just run `fly launch` and enjoy your deployment :)
No special UDP port exports or dedicated IP address are needed :)
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule ExWebRTC.MixProject do
use Mix.Project

@version "0.5.0"
@version "0.6.0"
@source_url "https://github.com/elixir-webrtc/ex_webrtc"

def project do
Expand Down
Loading