Upgrading to v0.4.0
View SourceUpdate Beacon tables
Beacon v0.4 requires some new database tables for the latest features. To create these tables, simply run the generator for a new Ecto Migration module:
mix ecto.gen.migration update_beacon_v003
Then, within the generated module, call Beacon's migration helpers:
use Ecto.Migration
def up, do: Beacon.Migration.up()
def down, do: Beacon.Migration.down()
Move Beacon
before the endpoint in application.ex
Open the file application.ex
, find the Beacon tuple in the list of children
,
and move it to before the endpoint(s) declarations:
@impl true
def start(_type, _args) do
children = [
# ...
{Beacon, [sites: [Application.fetch_env!(:beacon, :my_site)]]}, # <- moved to before `MyAppWeb.Endpoint`
MyAppWeb.Endpoint
]
In v0.3.0 the order was inverted which caused a regression bug that didn't allow application to recover from crashes.
Generate your site Endpoint and the global Proxy Endpoint
Beacon now requires an Endpoint per site and a Proxy endpoint to properly route requests to sites, even if your application has only one site and host.
Run the beacon.gen.site task to create those files and update your project configuration:
mix beacon.gen.site --site my_site
Replace my_site
with the actual name of your site, and execute that command for each site you have configured.
Note that if you're using a custom host (domain) then execute this command instead:
mix beacon.gen.site --site my_site --host mysite.com
Replacing the values with the ones you actually use.
It's important to commit any changes before executing that command and reviewing the proposed changes,
especially your site config in runtime.exs
which may not match if you have a custom config.
Copy the esbuild
binary in the release
The binary esbuild
is now required at runtime to bundle JS hooks,
so it should be available in the release package.
This config only applies if you have deployed Beacon in a release, otherwise you can skip this topic.
Follow these instructions to update your project:
- Update
copy_beacon_files/1
function inmix.exs
That function is responsible for checking and copying the binary files
into the right place. See the Deploy to Fly.io
guides to copy the actual code and paste into your project mix.exs
file.
- Update
Dockerfile
In order to make sure both tailwind
and esbuild
are available you should include
these lines before RUN mix release
:
RUN mix tailwind.install --no-assets --if-missing
RUN mix esbuild.install --if-missing
More info in the Deploy to Fly.io guide.