Many thanks for the info and pointers, @bobbypriambodo. Progress has been made…
I’ll write up what I found and the steps I took in full another time, but in brief, I’ve:
- switched to using my workstation as “staging” to remove any potential OS-version-differing issues;
- corrected my production port and database settings;
-
added asset building to the edeliver config (the assets needed to be built and digested as part of the edeliver release task on the “build server” rather than in my dev installation before the release task).
The instructions I’ve been following:
And now the app is running via a release in “staging”, complete with assets served from the release’s lib/app_name-0.0.1+x-xxxxxxx/priv/static
directory.
Just one problem that I’ve spotted so far: my CRUD Create operation is not working in the release, though it is in dev.
21:27:49.820 request_id=pm89nebr8omjjfgmdudm5qe5g07f7ctq [info] POST /admin/products/materials
21:27:49.820 request_id=pm89nebr8omjjfgmdudm5qe5g07f7ctq [info] Sent 500 in 396µs
21:27:49.821 [error] #PID<0.1343.0> running AppName.Endpoint terminated
Server: mydomain.com:80 (http)
Request: POST /admin/products/materials
** (exit) an exception was raised:
** (UndefinedFunctionError) function Money.Ecto.Type.cast/1 is undefined (module Money.Ecto.Type is not available)
Money.Ecto.Type.cast("3")
(ecto) lib/ecto/type.ex:564: Ecto.Type.cast/2
(ecto) lib/ecto/changeset.ex:464: Ecto.Changeset.cast_field/8
(ecto) lib/ecto/changeset.ex:423: Ecto.Changeset.process_param/8
(elixir) lib/enum.ex:1247: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
(elixir) lib/enum.ex:1247: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
(ecto) lib/ecto/changeset.ex:391: Ecto.Changeset.do_cast/7
(app_name) web/models/product/material.ex:16: AppName.Product.Material.changeset/2
Money is in deps()
in mix.exs
:
defp deps, do: [
{:phoenix, "~> 1.2.1"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.0"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.6"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:cowboy, "~> 1.0"},
{:money, "~> 1.2.0"},
{:edeliver, ">= 1.4.0"},
{:distillery, ">= 0.10.0", warn_missing: false}
]
There is a money
directory in the deps
directory in the temporary build location.
grep’ing the release version of the app:
$ grep -r "money" ./*
./erl_crash.dump:money
./erl_crash.dump:format_money
Binary file ./lib/app_name-0.0.1+23-3e90aeb/ebin/Elixir.AppName.Api.BannerPriceController.beam matches
Binary file ./lib/app_name-0.0.1+29-5fa1c81/ebin/Elixir.AppName.Api.BannerPriceController.beam matches
Binary file ./lib/app_name-0.0.1+22-10ad675/ebin/Elixir.AppName.Api.BannerPriceController.beam matches
Binary file ./lib/app_name-0.0.1+26-273b832/ebin/Elixir.AppName.Api.BannerPriceController.beam matches
Binary file ./lib/app_name-0.0.1+27-5cdbf9f/ebin/Elixir.AppName.Api.BannerPriceController.beam matches
Binary file ./lib/app_name-0.0.1+21-efda081/ebin/Elixir.AppName.Api.BannerPriceController.beam matches
Binary file ./lib/app_name-0.0.1+25-4a3c61c/ebin/Elixir.AppName.Api.BannerPriceController.beam matches
Binary file ./lib/app_name-0.0.1+30-9ebded0/ebin/Elixir.AppName.Api.BannerPriceController.beam matches
Binary file ./lib/app_name-0.0.1+24-a0d8d13/ebin/Elixir.AppName.Api.BannerPriceController.beam matches
./releases/0.0.1+25-4a3c61c/sys.config: {money,
./releases/0.0.1+29-5fa1c81/sys.config: {money,
./releases/0.0.1+30-9ebded0/sys.config: {money,
./releases/0.0.1+24-a0d8d13/sys.config: {money,
./releases/0.0.1+21-efda081/sys.config: {money,
./releases/0.0.1+27-5cdbf9f/sys.config: {money,
./releases/0.0.1+22-10ad675/sys.config: {money,
./releases/0.0.1+23-3e90aeb/sys.config: {money,
./releases/0.0.1+26-273b832/sys.config: {money,
./var/sys.config: {money,
I believe this is the module not being found. Could it be to do with the if Code.ensure_compiled?(Ecto.Type) do
? Because staging is using a release, is the Erlang VM running in embedded mode instead of interactive?
I now feel well out of my depth - any ideas on how to go about looking into or fixing this would be appreciated. Perhaps I should create an issue at the Money repo?