mix phoenix.new --no-ecto hello_phoenix
If I remember correctly, letting ecto in makes it look for postgres on the pi. Could probably easily set it up for sqlite?
cd hello_phoenix
cp ../nerves_examples/hello_network/Bakefile .
Add to server: true
to config section in config/prod.exs and change http to a specific port (It didn't seem to work setting PORT env variable, but I only tried once.
)
# config/prod.exs
config :hello_phoenix, HelloPhoenix.Endpoint,
http: [port: 80],
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/manifest.json",
server: true
Add hello_network to mix.exs dependencies:
# mix.exs
defp deps do
[{:phoenix, "~> 1.1.4"},
{:phoenix_html, "~> 2.4"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.9"},
{:cowboy, "~> 1.0"},
{:hello_network, path: "../nerves-examples/hello_network"}
]
end
MIX_ENV=prod bake firmware --target rpi2
Haven't figured out why it doesn't start with MIX_ENV=dev
The dev environment tries to start the code reloader, which craps out on nerves.