Skip to content

upgrade to phoenix 1.8 - #17

Merged
fhunleth merged 2 commits into
nerves-web-kiosk:mainfrom
hez:feature/phoenix-1.8
Nov 5, 2025
Merged

fhunleth merged 2 commits into
nerves-web-kiosk:mainfrom
hez:feature/phoenix-1.8

Conversation

@hez

@hez hez commented Nov 1, 2025

Copy link
Copy Markdown
Contributor
  • 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

Comment thread config/phoenix/config.exs Outdated
Comment thread config/phoenix/prod.exs
config :kiosk_example, KioskExampleWeb.Endpoint,
cache_static_manifest: "priv/static/cache_manifest.json"
cache_static_manifest: "priv/static/cache_manifest.json",
server: true,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@hez I think this line is already set in config.exs, like following

https://github.com/nerves-web-kiosk/kiosk_example/blob/ac587a1c6e67e89d4acc0fad7e9c0042386d6830/config/config.exs#L31

Is that not working?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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/")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed this to / as the phoenix dashboard is not enabled by default in prod deploys

@pojiro pojiro Nov 3, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll explain my original intention behind choosing Live Dashboard as the default page.

  1. I thought of kiosk_example as a project to demonstrate kiosk functionality, and wanted to show that it would work properly even on a non-static page, i.e., LiveView.

  2. 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd really like to include kiosk_example in Nerves Burner to make it more discoverable and easy to try.

How about this?

  1. 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.
  2. We merge this PR.
  3. 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd really like to include kiosk_example in Nerves Burner to make it more discoverable and easy to try.

How about this?

  1. 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.
  2. We merge this PR.
  3. 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.
  1. 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
  1. Sounds good, always happy too look

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll explain my original intention behind choosing Live Dashboard as the default page.

  1. I thought of kiosk_example as a project to demonstrate kiosk functionality, and wanted to show that it would work properly even on a non-static page, i.e., LiveView.
  2. 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.

@pojiro pojiro Nov 3, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@fhunleth I think this pretty much does it? hez#1 Anything else I am missing in there?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@hez
hez force-pushed the feature/phoenix-1.8 branch from 8fb24d4 to 3407a6c Compare November 2, 2025 17:12
@hez
hez marked this pull request as ready for review November 2, 2025 17:12
@pojiro

pojiro commented Nov 4, 2025

Copy link
Copy Markdown
Member

@fhunleth @hez I'll write my result and opinion below.

I tested this pr branch with MIX_ENV=prod and MIX_TARGET=rpi4.

I couldn't mix deps.get, I got the following error.

** (ArgumentError) The module Phoenix.CodeReloader was given as a child to a supervisor but it does not exist
    (elixir 1.18.4) lib/supervisor.ex:797: Supervisor.init_child/1
    (elixir 1.18.4) lib/supervisor.ex:905: Supervisor.child_spec/2
    (elixir 1.18.4) lib/enum.ex:1714: Enum."-map/2-lists^map/1-1-"/2
    (mix 1.18.4) lib/mix/pubsub.ex:77: Mix.PubSub.listener_supervisor/0
    (mix 1.18.4) lib/mix/pubsub.ex:59: Mix.PubSub.start_listeners/0
    (mix 1.18.4) lib/mix/tasks/deps.loadpaths.ex:76: Mix.Tasks.Deps.Loadpaths.run/1
    (nerves_bootstrap 1.14.0) lib/mix/tasks/nerves/bootstrap.ex:51: Mix.Tasks.Nerves.Bootstrap.run/1
    (mix 1.18.4) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5

@hez Have you got this error with your Nerves with touch screen? I don't check what's going on here yet.

About config/phoenix/* files in to config/* and flattening the mix.exs deps

@fhunleth In my opinion, I prefer separating the phoenix configs and mix.exs deps. Because I didn't touch the phoenix default configs and deps as possible as I could. because I'd like to make easy to track the phoenix version update.

- 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
@fhunleth
fhunleth force-pushed the feature/phoenix-1.8 branch from 3407a6c to 056172e Compare November 5, 2025 13:52
@fhunleth

fhunleth commented Nov 5, 2025

Copy link
Copy Markdown
Member

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.

@fhunleth
fhunleth merged commit c74a3c3 into nerves-web-kiosk:main Nov 5, 2025
@fhunleth

fhunleth commented Nov 5, 2025

Copy link
Copy Markdown
Member

@hez Thanks for putting this together!

@hez

hez commented Nov 5, 2025

Copy link
Copy Markdown
Contributor Author

@fhunleth @hez I'll write my result and opinion below.

I tested this pr branch with MIX_ENV=prod and MIX_TARGET=rpi4.

I couldn't mix deps.get, I got the following error.

** (ArgumentError) The module Phoenix.CodeReloader was given as a child to a supervisor but it does not exist
    (elixir 1.18.4) lib/supervisor.ex:797: Supervisor.init_child/1
    (elixir 1.18.4) lib/supervisor.ex:905: Supervisor.child_spec/2
    (elixir 1.18.4) lib/enum.ex:1714: Enum."-map/2-lists^map/1-1-"/2
    (mix 1.18.4) lib/mix/pubsub.ex:77: Mix.PubSub.listener_supervisor/0
    (mix 1.18.4) lib/mix/pubsub.ex:59: Mix.PubSub.start_listeners/0
    (mix 1.18.4) lib/mix/tasks/deps.loadpaths.ex:76: Mix.Tasks.Deps.Loadpaths.run/1
    (nerves_bootstrap 1.14.0) lib/mix/tasks/nerves/bootstrap.ex:51: Mix.Tasks.Nerves.Bootstrap.run/1
    (mix 1.18.4) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5

@hez Have you got this error with your Nerves with touch screen? I don't check what's going on here yet.

About config/phoenix/* files in to config/* and flattening the mix.exs deps

@fhunleth In my opinion, I prefer separating the phoenix configs and mix.exs deps. Because I didn't touch the phoenix default configs and deps as possible as I could. because I'd like to make easy to track the phoenix version update.

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 :\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants