upgrade to phoenix 1.8 - #17
Conversation
hez
commented
Nov 1, 2025
- changed page for kiosk to "/" as dashboard was not enabled when creating a nerves image
- this is pretty close to the output from a mix phx.new run
- upgraded esbuild and tailwind to ver shipped with phx 1.8
| config :kiosk_example, KioskExampleWeb.Endpoint, | ||
| cache_static_manifest: "priv/static/cache_manifest.json" | ||
| cache_static_manifest: "priv/static/cache_manifest.json", | ||
| server: true, |
There was a problem hiding this comment.
This was added so you can run the non-host in prod, normally phoenix depends on the env var PHX_SERVER to enable the server.
There was a problem hiding this comment.
@hez I think this line is already set in config.exs, like following
Is that not working?
There was a problem hiding this comment.
I was just being more explicit about the prod config, it could probably be simplified. As we were talking in the other thread, it would be nice to have all the config files here and in the nerves phoenix example be close to the same
|
|
||
| cog_args = | ||
| Keyword.get(args, :cog_args, "--platform=wl http://localhost:4000/dev/dashboard/home") | ||
| Keyword.get(args, :cog_args, "--platform=wl http://localhost:4000/") |
There was a problem hiding this comment.
I changed this to / as the phoenix dashboard is not enabled by default in prod deploys
There was a problem hiding this comment.
I'll explain my original intention behind choosing Live Dashboard as the default page.
-
I thought of
kiosk_exampleas a project to demonstrate kiosk functionality, and wanted to show that it would work properly even on a non-static page, i.e., LiveView. -
As mentioned earlier, since I thought this is a demo project, I didn't expect to create firmware with
MIX_ENV=prod. Also, by leaving Phoenix's default settings unchanged, I aimed to make it easier to track Phoenix versions.
However, it is true that I made no effort to communicate this intention within the project.
There was a problem hiding this comment.
I'd really like to include kiosk_example in Nerves Burner to make it more discoverable and easy to try.
How about this?
- Could either of you take a quick look at https://github.com/nerves-project/nerves_examples/tree/main/hello_live_view? In theory, I'd like to keep the Phoenix parts of these two projects in sync. It looks like the resulting code from this PR could be transferred there with no loss of functionality, but it would be nice if one of you could confirm that.
- We merge this PR.
- I'll add issues for things I think are needed for a Nerves Burner image and you two can comment if you're interested in helping out with those or just ignore them.
There was a problem hiding this comment.
I'd really like to include
kiosk_examplein Nerves Burner to make it more discoverable and easy to try.How about this?
- Could either of you take a quick look at https://github.com/nerves-project/nerves_examples/tree/main/hello_live_view? In theory, I'd like to keep the Phoenix parts of these two projects in sync. It looks like the resulting code from this PR could be transferred there with no loss of functionality, but it would be nice if one of you could confirm that.
- We merge this PR.
- I'll add issues for things I think are needed for a Nerves Burner image and you two can comment if you're interested in helping out with those or just ignore them.
- definitely can do, it looks like that "hello_live_view" is also at phx 1.7. Are you intending to take portions of this and merge in to that repo?
- Follow up, do you like the config/phoenix/* (like in this repo) or the merging of the config files like in hello_live_view? My gut says we should pick one and go with it.
- Same question for deps in
mix.exs(this project brought them out in to a separate function:phoenix_deps) - I have a PR for phx 1.8 on hello_live_view I'll open in a couple
- Sounds good, always happy too look
There was a problem hiding this comment.
I'll explain my original intention behind choosing Live Dashboard as the default page.
- I thought of
kiosk_exampleas a project to demonstrate kiosk functionality, and wanted to show that it would work properly even on a non-static page, i.e., LiveView.- As mentioned earlier, since I thought this is a demo project, I didn't expect to create firmware with
MIX_ENV=prod. Also, by leaving Phoenix's default settings unchanged, I aimed to make it easier to track Phoenix versions.However, it is true that I made no effort to communicate this intention within the project.
ah! Yeah makes sense, I was trying to show how one might get a prod ready distribution going. Really what we need to do is unify the hello_live_view example and this example. That would simplify things.
There was a problem hiding this comment.
If we'd like to synchronize Phoenix of nerves_examples/hello_live_view and kiosk_example efficiently, I think using Poncho style is one option. The advantage of this is that we can consolidate Phoenix management into one, but the disadvantage is that we have two separate repositories(ui and not ui) and we need to think about how to handle target-specific pages (gpio_live.ex).
I can't really explain it, but I have experience with both the style of consolidating everything into one repository and the style of using Poncho. Each has its advantages and disadvantages, and I think it's up to Nerves project’s discretion to decide which example to show at Nerves.
There was a problem hiding this comment.
My opinion is to combine the Nerves and Phoenix projects together like is currently being done. I've heard from both new and experienced Phoenix developers over the past several years that the poncho style is both harder to understand and enough extra boilerplate code that it's not a good option for most projects. Everyone agrees that there are projects that benefit from the poncho style especially when code bases get larger.
I'm also for flattening the configuration and simplifying it where possible. I'd also delete all references to OS environment variables, but I noticed that those were all in config/phoenix/runtime.exs which isn't referenced anywhere and can be deleted. This might not be obvious, but only config/runtime.exs is picked up by mix.
There was a problem hiding this comment.
I don't know if they need to be actually in one repo, I was just thinking the files / structure should probably be the same. I am with @fhunleth on this, I have not used poncho before and not encountered it in the wild.
Another option, a small template script to take the phoenix example and add kiosk bits?? I have been meaning to experiment with Igniter...
There was a problem hiding this comment.
I'm ready to merge and then iterate in follow-up PRs. @pojiro You good with this? I feel like the issues that you brought up with Elixir 1.19 and regex's can be dealt with quickly. I can do that tonight which I think should overlap when you start getting to be online.
8fb24d4 to
3407a6c
Compare
|
@fhunleth @hez I'll write my result and opinion below. I tested this pr branch with
|
- changed page for kiosk to "/" as dashboard was not enabled when creating a nerves image - this is pretty close to the output from a mix phx.new run - upgraded esbuild and tailwind to ver shipped with phx 1.8
3407a6c to
056172e
Compare
|
I just rebased and force pushed with a conflict removed. I also added a commit to only include the Phoenix code listeners on host builds. This should fix the compiler error that you received. @pojiro I'm going to merge without the configs flattened. I'm for continuing the discussion, though, as we update the config files. |
|
@hez Thanks for putting this together! |
oh drat, sorry this is my fault. I will remove that, I think I also forgot to update the README with the phx 1.8 commands :\ |