Skip to content

Instantly share code, notes, and snippets.

@laduke
Last active March 18, 2016 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laduke/3c98861c96de39c33f82 to your computer and use it in GitHub Desktop.
Save laduke/3c98861c96de39c33f82 to your computer and use it in GitHub Desktop.

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

@mattneel
Copy link

The dev environment tries to start the code reloader, which craps out on nerves.

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