Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mix phx.gen.release --docker #5502

Closed
tmkontra opened this issue Jul 3, 2023 · 5 comments
Closed

mix phx.gen.release --docker #5502

tmkontra opened this issue Jul 3, 2023 · 5 comments

Comments

@tmkontra
Copy link

tmkontra commented Jul 3, 2023

Environment

  • Elixir version (elixir -v): 1.15.2
    • OTP 26.0.2
  • Phoenix version (mix deps): 1.7.6
  • Operating system: Ubuntu 22.04.1 LTS

Actual behavior

Command fails, erroring in the erlang :httpc module

tmck:repo/ (master✗) $ mix phx.gen.release --docker --no-ecto
* creating rel/overlays/bin/server
* creating rel/overlays/bin/server.bat

19:49:26.452 [debug] Fetching latest image information from https://hub.docker.com/v2/namespaces/hexpm/repositories/elixir/tags?name=1.15.2-erlang-26.0.2-debian-bullseye-
** (UndefinedFunctionError) function :http_util.timestamp/0 is undefined (module :http_util is not available)
    (inets 9.0.1) :http_util.timestamp()
    (inets 9.0.1) httpc.erl:750: :httpc.handle_request/9
    (phoenix 1.7.6) lib/mix/tasks/phx.gen.release.ex:267: Mix.Tasks.Phx.Gen.Release.fetch_body!/1
    (phoenix 1.7.6) lib/mix/tasks/phx.gen.release.ex:205: Mix.Tasks.Phx.Gen.Release.gen_docker/1
    (phoenix 1.7.6) lib/mix/tasks/phx.gen.release.ex:76: Mix.Tasks.Phx.Gen.Release.run/1
    (mix 1.15.2) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.2) lib/mix/cli.ex:92: Mix.CLI.run_task/2

Expected behavior

Should run successfully. This behavior is seen when downgrading to elixir 1.14.5

tmck:repo/ (master✗) $ asdf global elixir 1.14.5-otp-26
tmck:repo/ (master✗) $ mix phx.gen.release --docker --no-ecto

==> my_app_web
* creating rel/overlays/bin/server
* creating rel/overlays/bin/server.bat

19:51:00.585 [debug] Fetching latest image information from https://hub.docker.com/v2/namespaces/hexpm/repositories/elixir/tags?name=1.14.5-erlang-26.0.2-debian-bullseye-
* creating Dockerfile
* creating .dockerignore

Your application is ready to be deployed in a release!

See https://hexdocs.pm/mix/Mix.Tasks.Release.html for more information about Elixir releases
[...rest of output...]
@lpgauth
Copy link

lpgauth commented Jul 5, 2023

Similar but different error:

19:52:47.647 [debug] Fetching latest image information from https://hub.docker.com/v2/namespaces/hexpm/repositories/elixir/tags?name=1.15.2-erlang-26.0.2-debian-bullseye-
** (RuntimeError) couldn't fetch https://hub.docker.com/v2/namespaces/hexpm/repositories/elixir/tags?name=1.15.2-erlang-26.0.2-debian-bullseye-: {:error, {:shutdown, {{:error, :undef}, [{:http_chunk, :decode, ["955\r\n{\"count\":2,\"next\":null,\"previous\":null,\"results\":[{\"creator\":9043754,\"id\":467100874,\"images\":[{\"architecture\":\"amd64\",\"features\":\"\",\"variant\":null,\"digest\":\"sha256:cc730c01e7e6f60fc5d3d661b0058c6cdba96804a39e7adb075decd003a14c48\",\"os\":\"linux\",\"os_features\":\"\",\"os_version\":null,\"size\":83255483,\"status\":\"active\",\"last_pulled\":\"2023-07-05T19:22:57.734386Z\",\"last_pushed\":\"2023-07-01T20:51:06.029569Z\"},{\"architecture\":\"arm64\",\"features\":\"\",\"variant\":\"v8\",\"digest\":\"sha256:f40f9af967bac8cb13ed594d0485dd4b9ed69deaf37e9f576cf6693cbeb27913\",\"os\":\"linux\",\"os_features\":\"\",\"os_version\":null,\"size\":81766333,\"status\":\"active\",\"last_pulled\":\"2023-07-05T19:22:57.752258Z\",\"last_pushed\":\"2023-07-01T20:51:06.979419Z\"}],\"last_updated\":\"2023-07-01T20:51:08.020226Z\",\"last_updater\":9043754,\"last_updater_username\":\"hexbob\",\"name\":\"1.15.2-erlang-26.0.2-debian-bullseye-20230612-slim\",\"repository\":8323337,\"full_size\":83255483,\"v2\":true,\"tag_status\":\"active\",\"tag_last_pulled\":\"2023-07-05T22:30:35.090928Z\",\"tag_last_pushed\":\"2023-07-01T20:51:08.020226Z\",\"media_type\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"content_type\":\"image\",\"digest\":\"sha256:4c13848d36580cba53563415a5958898a50f312f4e7c64b20a6c010a3f2d81fa\"},{\"creator\":9043754,\"id\":467100876,\"images\":[{\"architecture\":\"amd64\",\"features\":\"\",\"variant\":null,\"digest\":\"sha256:fcd2a2554d45028185f321e71f4674a327842dcaf64c6d2773c668c5b4fad028\",\"os\":\"linux\",\"os_features\":\"\",\"os_version\":null,\"size\":107953221,\"status\":\"active\",\"last_pulled\":\"2023-07-05T15:27:05.357946Z\",\"last_pushed\":\"2023-07-01T20:51:04.71197Z\"},{\"architecture\":\"arm64\",\"features\":\"\",\"variant\":\"v8\",\"digest\":\"sha256:493b3c5ec809d8a7a64e8a7399d033a47063782bb4abe3bed28a751436bc1f7a\",\"os\":\"linux\",\"os_features\":\"\",\"os_version\":null,\"size\":106467255,\"status\":\"active\",\"last_pulled\":\"2023-07-01T20:51:05.862828Z\",\"last_pushed\":\"2023-07-01T20:51:05.672689Z\"}],\"last_updated\":\"2023-07-01T20:51:06.666656Z\",\"last_updater\":9043754,\"last_updater_username\":\"hexbob\",\"name\":\"1.15.2-erlang-26.0.2-debian-bullseye-20230612\",\"repository\":8323337,\"full_size\":107953221,\"v2\":true,\"tag_status\":\"active\",\"tag_last_pulled\":\"2023-07-05T15:27:05.357946Z\",\"tag_last_pushed\":\"2023-07-01T20:51:06.666656Z\",\"media_type\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"content_type\":\"image\",\"digest\":\"sha256:4b1904a74467401eb8334f888e8464149a9a0c4f45c36c8b4ff8f72049a09275\"}]}\n\r\n0\r\n\r\n", :nolimit, :nolimit], []}, {:httpc_handler, :handle_http_body, 2, [file: ~c"httpc_handler.erl", line: 956]}, {:httpc_handler, :handle_info, 2, [file: ~c"httpc_handler.erl", line: 283]}, {:gen_server, :try_handle_info, 3, [file: ~c"gen_server.erl", line: 1077]}, {:gen_server, :handle_msg, 6, [file: ~c"gen_server.erl", line: 1165]}, {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 241]}]}}}
    (phoenix 1.7.3) lib/mix/tasks/phx.gen.release.ex:269: Mix.Tasks.Phx.Gen.Release.fetch_body!/1
    (phoenix 1.7.3) lib/mix/tasks/phx.gen.release.ex:205: Mix.Tasks.Phx.Gen.Release.gen_docker/1
    (phoenix 1.7.3) lib/mix/tasks/phx.gen.release.ex:76: Mix.Tasks.Phx.Gen.Release.run/1
    (mix 1.15.2) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.2) lib/mix/cli.ex:92: Mix.CLI.run_task/2

@Gazler
Copy link
Member

Gazler commented Jul 11, 2023

Hi,

Can you please provide the output for both elixir versions? Run the following command in the terminal:

elixir -e "Application.start(:inets) && Application.spec(:inets) |> IO.inspect()"

@lpgauth
Copy link

lpgauth commented Jul 11, 2023

Same as @tmkontra. I just tried on a new project with Phoenix 1.7.7 and it seems to work...

@tmkontra
Copy link
Author

tmck:repo/ (master✗) $ asdf global elixir 1.15.2-otp-26                               [22:55:42]
tmck:repo/ (master✗) $ elixir -e "Application.start(:inets) && Application.spec(:inets) |> IO.inspect()"
[
  description: ~c"INETS  CXC 138 49",
  id: [],
  vsn: ~c"9.0.1",
  modules: [:inets, :inets_sup, :inets_app, :inets_service, :inets_trace,
   :inets_lib, :httpc, :httpc_handler, :httpc_handler_sup, :httpc_manager,
   :httpc_profile_sup, :httpc_request, :httpc_response, :httpc_sup,
   :httpc_cookie, :http_chunk, :http_request, :http_response, :http_transport,
   :http_util, :http_uri, :httpd, :httpd_acceptor, :httpd_acceptor_sup,
   :httpd_cgi, :httpd_connection_sup, :httpd_conf, :httpd_custom,
   :httpd_custom_api, :httpd_esi, :httpd_example, :httpd_file,
   :httpd_instance_sup, :httpd_log, :httpd_logger, :httpd_manager,
   :httpd_misc_sup, :httpd_request, :httpd_request_handler, :httpd_response,
   :httpd_script_env, :httpd_socket, :httpd_sup, :httpd_util, :mod_actions,
   :mod_alias, ...],
  maxP: :infinity,
  maxT: :infinity,
  registered: [:inets_sup, :httpc_manager],
  included_applications: [],
  optional_applications: [],
  applications: [:kernel, :stdlib],
  mod: {:inets_app, []},
  start_phases: :undefined
]
tmck:repo/ (master✗) $ asdf global elixir 1.14.5-otp-26                               [22:55:51]
tmck:repo/ (master✗) $ elixir -e "Application.start(:inets) && Application.spec(:inets) |> IO.inspect()"
[
  description: 'INETS  CXC 138 49',
  id: [],
  vsn: '9.0.1',
  modules: [:inets, :inets_sup, :inets_app, :inets_service, :inets_trace,
   :inets_lib, :httpc, :httpc_handler, :httpc_handler_sup, :httpc_manager,
   :httpc_profile_sup, :httpc_request, :httpc_response, :httpc_sup,
   :httpc_cookie, :http_chunk, :http_request, :http_response, :http_transport,
   :http_util, :http_uri, :httpd, :httpd_acceptor, :httpd_acceptor_sup,
   :httpd_cgi, :httpd_connection_sup, :httpd_conf, :httpd_custom,
   :httpd_custom_api, :httpd_esi, :httpd_example, :httpd_file,
   :httpd_instance_sup, :httpd_log, :httpd_logger, :httpd_manager,
   :httpd_misc_sup, :httpd_request, :httpd_request_handler, :httpd_response,
   :httpd_script_env, :httpd_socket, :httpd_sup, :httpd_util, :mod_actions,
   :mod_alias, ...],
  maxP: :infinity,
  maxT: :infinity,
  registered: [:inets_sup, :httpc_manager],
  included_applications: [],
  optional_applications: [],
  applications: [:kernel, :stdlib],
  mod: {:inets_app, []},
  start_phases: :undefined
]

@xixa
Copy link

xixa commented Aug 1, 2023

Exact same issue on Elixir 1.15.x.
Works as expected on 1.14.x

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

No branches or pull requests

4 participants