Browse Source

Update elixir/phoenix to 1.12.2 and refactor codebase (#6747)

* update elixir/deps and refactor code to the current default file scheme

* make code more legible
Shiryel 4 years ago
parent
commit
6a76b427c6

+ 2 - 3
frameworks/Elixir/phoenix/config/config.exs

@@ -11,13 +11,12 @@ config :hello,
   ecto_repos: [Hello.Repo]
   ecto_repos: [Hello.Repo]
 
 
 # Configures the endpoint
 # Configures the endpoint
-config :hello, Hello.Endpoint,
+config :hello, HelloWeb.Endpoint,
   url: [host: "localhost"],
   url: [host: "localhost"],
   http: [port: 8080],
   http: [port: 8080],
   root: Path.expand(__DIR__),
   root: Path.expand(__DIR__),
   debug_errors: false,
   debug_errors: false,
-  secret_key_base: "Z18ZjzZslFpKd8HB41IljqMavPiOKVF9y1DIQ+S2Ytg7Op0EIauwJgd7mtRStssx",
-  pubsub: [name: Hello.PubSub, adapter: Phoenix.PubSub.PG2]
+  secret_key_base: "Z18ZjzZslFpKd8HB41IljqMavPiOKVF9y1DIQ+S2Ytg7Op0EIauwJgd7mtRStssx"
 
 
 # Configures Elixir's Logger
 # Configures Elixir's Logger
 config :logger, :console,
 config :logger, :console,

+ 5 - 5
frameworks/Elixir/phoenix/config/dev.exs

@@ -6,19 +6,19 @@ use Mix.Config
 # The watchers configuration can be used to run external
 # The watchers configuration can be used to run external
 # watchers to your application. For example, we use it
 # watchers to your application. For example, we use it
 # with brunch.io to recompile .js and .css sources.
 # with brunch.io to recompile .js and .css sources.
-config :hello, Hello.Endpoint,
+config :hello, HelloWeb.Endpoint,
   http: [port: 8080],
   http: [port: 8080],
   debug_errors: true,
   debug_errors: true,
   code_reloader: true,
   code_reloader: true,
   cache_static_lookup: false
   cache_static_lookup: false
 
 
 # Watch static and templates for browser reloading.
 # Watch static and templates for browser reloading.
-config :hello, Hello.Endpoint,
+config :hello, HelloWeb.Endpoint,
   live_reload: [
   live_reload: [
     patterns: [
     patterns: [
-      ~r{priv/static/.*(js|css|png|jpeg|jpg|gif)$},
-      ~r{web/views/.*(ex)$},
-      ~r{web/templates/.*(eex)$}
+      ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
+      ~r"lib/hello_web/(live|views)/.*(ex)$",
+      ~r"lib/hello_web/templates/.*(eex)$"
     ]
     ]
   ]
   ]
 
 

+ 1 - 1
frameworks/Elixir/phoenix/config/prod.exs

@@ -1,6 +1,6 @@
 use Mix.Config
 use Mix.Config
 
 
-config :hello, Hello.Endpoint,
+config :hello, HelloWeb.Endpoint,
   url: [host: "0.0.0.0"],
   url: [host: "0.0.0.0"],
   http: [port: 8080, protocol_options: [max_keepalive: :infinity], backlog: 8096],
   http: [port: 8080, protocol_options: [max_keepalive: :infinity], backlog: 8096],
   cache_static_lookup: false,
   cache_static_lookup: false,

+ 0 - 0
frameworks/Elixir/phoenix/echo


+ 6 - 27
frameworks/Elixir/phoenix/lib/hello.ex

@@ -1,30 +1,9 @@
 defmodule Hello do
 defmodule Hello do
-  use Application
+  @moduledoc """
+  Hello keeps the contexts that define your domain
+  and business logic.
 
 
-  # See http://elixir-lang.org/docs/stable/elixir/Application.html
-  # for more information on OTP Applications
-  def start(_type, _args) do
-    import Supervisor.Spec, warn: false
-
-    children = [
-      # Start the endpoint when the application starts
-      supervisor(Hello.Endpoint, []),
-      # Here you could define other workers and supervisors as children
-      # Start the Ecto repository
-      worker(Hello.Repo, [])
-      # worker(Hello.Worker, [arg1, arg2, arg3]),
-    ]
-
-    # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
-    # for other strategies and supported options
-    opts = [strategy: :one_for_one, name: Hello.Supervisor]
-    Supervisor.start_link(children, opts)
-  end
-
-  # Tell Phoenix to update the endpoint configuration
-  # whenever the application is updated.
-  def config_change(changed, _new, removed) do
-    Hello.Endpoint.config_change(changed, removed)
-    :ok
-  end
+  Contexts are also responsible for managing your data, regardless
+  if it comes from the database, an external API or others.
+  """
 end
 end

+ 26 - 0
frameworks/Elixir/phoenix/lib/hello/application.ex

@@ -0,0 +1,26 @@
+defmodule Hello.Application do
+  use Application
+
+  # See http://elixir-lang.org/docs/stable/elixir/Application.html
+  # for more information on OTP Applications
+  def start(_type, _args) do
+    children = [
+      # Start the Ecto repository
+      Hello.Repo,
+      # Start the endpoint when the application starts
+      HelloWeb.Endpoint
+    ]
+
+    # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
+    # for other strategies and supported options
+    opts = [strategy: :one_for_one, name: Hello.Supervisor]
+    Supervisor.start_link(children, opts)
+  end
+
+  # Tell Phoenix to update the endpoint configuration
+  # whenever the application is updated.
+  def config_change(changed, _new, removed) do
+    HelloWeb.Endpoint.config_change(changed, removed)
+    :ok
+  end
+end

+ 2 - 2
frameworks/Elixir/phoenix/web/models/fortune.ex → frameworks/Elixir/phoenix/lib/hello/models/fortune.ex

@@ -1,5 +1,5 @@
-defmodule Hello.Fortune do
-  use Hello.Web, :model
+defmodule Hello.Models.Fortune do
+  use Ecto.Schema
 
 
   @derive {Jason.Encoder, only: [:id, :message]}
   @derive {Jason.Encoder, only: [:id, :message]}
   schema "fortune" do
   schema "fortune" do

+ 2 - 2
frameworks/Elixir/phoenix/web/models/world.ex → frameworks/Elixir/phoenix/lib/hello/models/world.ex

@@ -1,5 +1,5 @@
-defmodule Hello.World do
-  use Hello.Web, :model
+defmodule Hello.Models.World do
+  use Ecto.Schema
 
 
   @derive {Jason.Encoder, only: [:id, :randomnumber]}
   @derive {Jason.Encoder, only: [:id, :randomnumber]}
   schema "world" do
   schema "world" do

+ 3 - 1
frameworks/Elixir/phoenix/lib/hello/repo.ex

@@ -1,3 +1,5 @@
 defmodule Hello.Repo do
 defmodule Hello.Repo do
-  use Ecto.Repo, otp_app: :hello, adapter: Ecto.Adapters.Postgres
+  use Ecto.Repo,
+    otp_app: :hello,
+    adapter: Ecto.Adapters.Postgres
 end
 end

+ 18 - 23
frameworks/Elixir/phoenix/web/web.ex → frameworks/Elixir/phoenix/lib/hello_web.ex

@@ -1,30 +1,25 @@
-defmodule Hello.Web do
+defmodule HelloWeb do
   @moduledoc """
   @moduledoc """
   A module that keeps using definitions for controllers,
   A module that keeps using definitions for controllers,
   views and so on.
   views and so on.
 
 
   This can be used in your application as:
   This can be used in your application as:
 
 
-      use Hello.Web, :controller
-      use Hello.Web, :view
+      use HelloWeb, :controller
+      use HelloWeb, :view
 
 
-  Keep the definitions in this module short and clean,
-  mostly focused on imports, uses and aliases.
-  """
-
-  def model do
-    quote do
-      use Ecto.Schema
+  The definitions below will be executed for every view,
+  controller, etc, so keep them short and clean, focused
+  on imports, uses and aliases.
 
 
-      import Ecto
-      import Ecto.Changeset
-      import Ecto.Query
-    end
-  end
+  Do NOT define functions inside the quoted expressions
+  below. Instead, define any helper function in modules
+  and import those modules here.
+  """
 
 
   def controller do
   def controller do
     quote do
     quote do
-      use Phoenix.Controller, log: false
+      use Phoenix.Controller, namespace: HelloWeb, log: false
 
 
       # Alias the data repository and import query/model functions
       # Alias the data repository and import query/model functions
       alias Hello.Repo
       alias Hello.Repo
@@ -32,23 +27,24 @@ defmodule Hello.Web do
       import Ecto.Query
       import Ecto.Query
 
 
       # Import URL helpers from the router
       # Import URL helpers from the router
-      import Hello.Router.Helpers
+      import HelloWeb.Router.Helpers
     end
     end
   end
   end
 
 
   def view do
   def view do
     quote do
     quote do
-      use Phoenix.View, root: "web/templates"
+      use Phoenix.View,
+        root: "lib/hello_web/templates",
+        namespace: HelloWeb
 
 
       # Import convenience functions from controllers
       # Import convenience functions from controllers
-      import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2,
-                                        action_name: 1, controller_module: 1]
-
+      import Phoenix.Controller,
+        only: [get_csrf_token: 0, get_flash: 2, action_name: 1, controller_module: 1]
 
 
       # Import all HTML functions (forms, tags, etc)
       # Import all HTML functions (forms, tags, etc)
       use Phoenix.HTML
       use Phoenix.HTML
 
 
-      import Hello.Router.Helpers
+      import HelloWeb.Router.Helpers
     end
     end
   end
   end
 
 
@@ -58,7 +54,6 @@ defmodule Hello.Web do
     end
     end
   end
   end
 
 
-
   def channel do
   def channel do
     quote do
     quote do
       use Phoenix.Channel
       use Phoenix.Channel

+ 24 - 13
frameworks/Elixir/phoenix/web/controllers/page_controller.ex → frameworks/Elixir/phoenix/lib/hello_web/controllers/page_controller.ex

@@ -1,41 +1,52 @@
-defmodule Hello.PageController do
-  alias Hello.{Fortune, World}
+defmodule HelloWeb.PageController do
+  alias Hello.Models.{Fortune, World}
 
 
-  use Hello.Web, :controller
+  use HelloWeb, :controller
 
 
   @json "application/json"
   @json "application/json"
   @plain "text/plain"
   @plain "text/plain"
   @random_max 10_000
   @random_max 10_000
 
 
+
   def index(conn, _params) do
   def index(conn, _params) do
+    resp = Jason.encode!(%{"TE Benchmarks\n" => "Started"})
+
     conn
     conn
     |> put_resp_content_type(@json, nil)
     |> put_resp_content_type(@json, nil)
-    |> send_resp(200, Jason.encode_to_iodata!(%{"TE Benchmarks\n" => "Started"}))
+    |> send_resp(200, resp)
   end
   end
 
 
   # avoid namespace collision
   # avoid namespace collision
   def _json(conn, _params) do
   def _json(conn, _params) do
+    resp = Jason.encode!(%{"message" => "Hello, world!"})
+
     conn
     conn
     |> put_resp_content_type(@json, nil)
     |> put_resp_content_type(@json, nil)
-    |> send_resp(200, Jason.encode_to_iodata!(%{"message" => "Hello, world!"}))
+    |> send_resp(200, resp)
   end
   end
 
 
   def db(conn, _params) do
   def db(conn, _params) do
+    resp =
+      Repo.get(World, :rand.uniform(@random_max))
+      |> Jason.encode!()
+
     conn
     conn
     |> put_resp_content_type(@json, nil)
     |> put_resp_content_type(@json, nil)
-    |> send_resp(200, Jason.encode_to_iodata!(Repo.get(World, :rand.uniform(@random_max))))
+    |> send_resp(200, resp)
   end
   end
 
 
   def queries(conn, params) do
   def queries(conn, params) do
-    json =
+    resp =
       params["queries"]
       params["queries"]
       |> query_range()
       |> query_range()
-      |> parallel(fn _ -> Repo.get(World, :rand.uniform(@random_max)) end)
-      |> Jason.encode_to_iodata!()
+      |> parallel(fn _ ->
+        Repo.get(World, :rand.uniform(@random_max))
+      end)
+      |> Jason.encode!()
 
 
     conn
     conn
     |> put_resp_content_type(@json, nil)
     |> put_resp_content_type(@json, nil)
-    |> send_resp(200, json)
+    |> send_resp(200, resp)
   end
   end
 
 
   def fortunes(conn, _params) do
   def fortunes(conn, _params) do
@@ -52,7 +63,7 @@ defmodule Hello.PageController do
   end
   end
 
 
   def updates(conn, params) do
   def updates(conn, params) do
-    json =
+    resp =
       params["queries"]
       params["queries"]
       |> query_range()
       |> query_range()
       |> parallel(fn _ ->
       |> parallel(fn _ ->
@@ -66,11 +77,11 @@ defmodule Hello.PageController do
           |> Repo.update!()
           |> Repo.update!()
         end)
         end)
       end)
       end)
-      |> Jason.encode_to_iodata!()
+      |> Jason.encode!()
 
 
     conn
     conn
     |> put_resp_content_type(@json, nil)
     |> put_resp_content_type(@json, nil)
-    |> send_resp(200, json)
+    |> send_resp(200, resp)
   end
   end
 
 
   def plaintext(conn, _params) do
   def plaintext(conn, _params) do

+ 3 - 3
frameworks/Elixir/phoenix/lib/hello/endpoint.ex → frameworks/Elixir/phoenix/lib/hello_web/endpoint.ex

@@ -1,10 +1,10 @@
-defmodule Hello.Endpoint do
+defmodule HelloWeb.Endpoint do
   use Phoenix.Endpoint, otp_app: :hello
   use Phoenix.Endpoint, otp_app: :hello
 
 
   plug Plug.Parsers,
   plug Plug.Parsers,
     parsers: [:json, :urlencoded, :multipart],
     parsers: [:json, :urlencoded, :multipart],
     pass: ["*/*"],
     pass: ["*/*"],
-    json_decoder: Jason
+    json_decoder: Phoenix.json_library()
 
 
-  plug Hello.Router
+  plug HelloWeb.Router
 end
 end

+ 3 - 3
frameworks/Elixir/phoenix/web/router.ex → frameworks/Elixir/phoenix/lib/hello_web/router.ex

@@ -1,7 +1,7 @@
-defmodule Hello.Router do
-  use Hello.Web, :router
+defmodule HelloWeb.Router do
+  use HelloWeb, :router
 
 
-  scope "/", Hello do
+  scope "/", HelloWeb do
     get("/json", PageController, :_json)
     get("/json", PageController, :_json)
     get("/db", PageController, :db)
     get("/db", PageController, :db)
     get("/queries", PageController, :queries)
     get("/queries", PageController, :queries)

+ 0 - 0
frameworks/Elixir/phoenix/web/templates/layout/app.html.eex → frameworks/Elixir/phoenix/lib/hello_web/templates/layout/app.html.eex


+ 0 - 0
frameworks/Elixir/phoenix/web/templates/page/fortunes.html.eex → frameworks/Elixir/phoenix/lib/hello_web/templates/page/fortunes.html.eex


+ 3 - 3
frameworks/Elixir/phoenix/web/views/error_view.ex → frameworks/Elixir/phoenix/lib/hello_web/views/error_view.ex

@@ -1,5 +1,5 @@
-defmodule Hello.ErrorView do
-  use Hello.Web, :view
+defmodule HelloWeb.ErrorView do
+  use HelloWeb, :view
 
 
   def render("404.html", _assigns) do
   def render("404.html", _assigns) do
     "Page not found - 404"
     "Page not found - 404"
@@ -12,6 +12,6 @@ defmodule Hello.ErrorView do
   # In case no render clause matches or no
   # In case no render clause matches or no
   # template is found, let's render it as 500
   # template is found, let's render it as 500
   def template_not_found(_template, assigns) do
   def template_not_found(_template, assigns) do
-    render "500.html", assigns
+    render("500.html", assigns)
   end
   end
 end
 end

+ 3 - 0
frameworks/Elixir/phoenix/lib/hello_web/views/layout_view.ex

@@ -0,0 +1,3 @@
+defmodule HelloWeb.LayoutView do
+  use HelloWeb, :view
+end

+ 3 - 0
frameworks/Elixir/phoenix/lib/hello_web/views/page_view.ex

@@ -0,0 +1,3 @@
+defmodule HelloWeb.PageView do
+  use HelloWeb, :view
+end

+ 6 - 3
frameworks/Elixir/phoenix/mix.exs

@@ -5,7 +5,7 @@ defmodule Hello.Mixfile do
     [
     [
       app: :hello,
       app: :hello,
       version: "0.1.0",
       version: "0.1.0",
-      elixir: "~> 1.10",
+      elixir: "~> 1.12",
       elixirc_paths: elixirc_paths(Mix.env()),
       elixirc_paths: elixirc_paths(Mix.env()),
       compilers: [:phoenix] ++ Mix.compilers(),
       compilers: [:phoenix] ++ Mix.compilers(),
       start_permanent: Mix.env() == :prod,
       start_permanent: Mix.env() == :prod,
@@ -17,10 +17,13 @@ defmodule Hello.Mixfile do
   #
   #
   # Type `mix help compile.app` for more information
   # Type `mix help compile.app` for more information
   def application do
   def application do
-    [mod: {Hello, []}, extra_applications: [:logger]]
+    [
+      mod: {Hello.Application, []},
+      extra_applications: [:logger]
+    ]
   end
   end
 
 
-  defp elixirc_paths(_), do: ["lib", "web"]
+  defp elixirc_paths(_), do: ["lib"]
 
 
   # Specifies your project dependencies
   # Specifies your project dependencies
   #
   #

+ 9 - 7
frameworks/Elixir/phoenix/mix.lock

@@ -5,20 +5,22 @@
   "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
   "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
   "db_connection": {:hex, :db_connection, "2.4.0", "d04b1b73795dae60cead94189f1b8a51cc9e1f911c234cc23074017c43c031e5", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ad416c21ad9f61b3103d254a71b63696ecadb6a917b36f563921e0de00d7d7c8"},
   "db_connection": {:hex, :db_connection, "2.4.0", "d04b1b73795dae60cead94189f1b8a51cc9e1f911c234cc23074017c43c031e5", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ad416c21ad9f61b3103d254a71b63696ecadb6a917b36f563921e0de00d7d7c8"},
   "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
   "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
-  "ecto": {:hex, :ecto, "3.6.1", "7bb317e3fd0179ad725069fd0fe8a28ebe48fec6282e964ea502e4deccb0bd0f", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cbb3294a990447b19f0725488a749f8cf806374e0d9d0dffc45d61e7aeaf6553"},
-  "ecto_sql": {:hex, :ecto_sql, "3.6.1", "8774dc3fc0ff7b6be510858b99883640f990c0736b8ab54588f9a0c91807f909", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.6.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.4.0 or ~> 0.5.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "66f35c3f2d5978b6bffebd1e6351ab8c9d6b68650d62abd1ab8d149de40e0779"},
+  "ecto": {:hex, :ecto, "3.6.2", "efdf52acfc4ce29249bab5417415bd50abd62db7b0603b8bab0d7b996548c2bc", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "efad6dfb04e6f986b8a3047822b0f826d9affe8e4ebdd2aeedbfcb14fd48884e"},
+  "ecto_sql": {:hex, :ecto_sql, "3.6.2", "9526b5f691701a5181427634c30655ac33d11e17e4069eff3ae1176c764e0ba3", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.6.2", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.4.0 or ~> 0.5.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5ec9d7e6f742ea39b63aceaea9ac1d1773d574ea40df5a53ef8afbd9242fdb6b"},
+  "eljiffy": {:hex, :eljiffy, "1.3.0", "7e584be454c5ec3fc3ae472eedb4cb2185e9ed6cd863df383ef601de3f3b27fd", [:mix], [{:jiffy, "~> 1.0", [hex: :jiffy, repo: "hexpm", optional: false]}], "hexpm", "90420512d60fb45bc9c09221b4d89cc539c9bfefc1c62f24cb3e2cb13acf2215"},
   "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
   "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
   "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
   "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
+  "jiffy": {:hex, :jiffy, "1.0.8", "60e36f00be35e5ac6e6cf2d4caf3bdf3103d4460aff385f543a8d7df2d6d9613", [:rebar3], [], "hexpm", "f9ae986ba5a0854eb48cf6a76192d9367086da86c20197da430630be7c087a4e"},
   "mime": {:hex, :mime, "1.6.0", "dabde576a497cef4bbdd60aceee8160e02a6c89250d6c0b29e56c0dfb00db3d2", [:mix], [], "hexpm", "31a1a8613f8321143dde1dafc36006a17d28d02bdfecb9e95a880fa7aabd19a7"},
   "mime": {:hex, :mime, "1.6.0", "dabde576a497cef4bbdd60aceee8160e02a6c89250d6c0b29e56c0dfb00db3d2", [:mix], [], "hexpm", "31a1a8613f8321143dde1dafc36006a17d28d02bdfecb9e95a880fa7aabd19a7"},
   "phoenix": {:hex, :phoenix, "1.5.9", "a6368d36cfd59d917b37c44386e01315bc89f7609a10a45a22f47c007edf2597", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7e4bce20a67c012f1fbb0af90e5da49fa7bf0d34e3a067795703b74aef75427d"},
   "phoenix": {:hex, :phoenix, "1.5.9", "a6368d36cfd59d917b37c44386e01315bc89f7609a10a45a22f47c007edf2597", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7e4bce20a67c012f1fbb0af90e5da49fa7bf0d34e3a067795703b74aef75427d"},
-  "phoenix_ecto": {:hex, :phoenix_ecto, "4.2.1", "13f124cf0a3ce0f1948cf24654c7b9f2347169ff75c1123f44674afee6af3b03", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 2.15", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "478a1bae899cac0a6e02be1deec7e2944b7754c04e7d4107fc5a517f877743c0"},
+  "phoenix_ecto": {:hex, :phoenix_ecto, "4.3.0", "2c69a452c2e0ee8c93345ae1cdc1696ef4877ff9cbb15c305def41960c3c4ebf", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "0ac491924217550c8f42c81c1f390b5d81517d12ceaf9abf3e701156760a848e"},
   "phoenix_html": {:hex, :phoenix_html, "2.14.3", "51f720d0d543e4e157ff06b65de38e13303d5778a7919bcc696599e5934271b8", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "efd697a7fff35a13eeeb6b43db884705cba353a1a41d127d118fda5f90c8e80f"},
   "phoenix_html": {:hex, :phoenix_html, "2.14.3", "51f720d0d543e4e157ff06b65de38e13303d5778a7919bcc696599e5934271b8", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "efd697a7fff35a13eeeb6b43db884705cba353a1a41d127d118fda5f90c8e80f"},
-  "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.1", "9eba6ad16bd80c45f338b2059c7b255ce30784d76f4181304e7b78640e5a7513", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "f3ae26b5abb85a1cb2bc8bb199e29fbcefb34259e469b31fe0c6323f2175a5ef"},
+  "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"},
   "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.0.0", "a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb", [:mix], [], "hexpm", "c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771"},
   "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.0.0", "a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb", [:mix], [], "hexpm", "c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771"},
-  "plug": {:hex, :plug, "1.11.1", "f2992bac66fdae679453c9e86134a4201f6f43a687d8ff1cd1b2862d53c80259", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "23524e4fefbb587c11f0833b3910bfb414bf2e2534d61928e920f54e3a1b881f"},
-  "plug_cowboy": {:hex, :plug_cowboy, "2.5.0", "51c998f788c4e68fc9f947a5eba8c215fbb1d63a520f7604134cab0270ea6513", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5b2c8925a5e2587446f33810a58c01e66b3c345652eeec809b76ba007acde71a"},
+  "plug": {:hex, :plug, "1.12.1", "645678c800601d8d9f27ad1aebba1fdb9ce5b2623ddb961a074da0b96c35187d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d57e799a777bc20494b784966dc5fbda91eb4a09f571f76545b72a634ce0d30b"},
+  "plug_cowboy": {:hex, :plug_cowboy, "2.5.1", "7cc96ff645158a94cf3ec9744464414f02287f832d6847079adfe0b58761cbd0", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "107d0a5865fa92bcb48e631cc0729ae9ccfa0a9f9a1bd8f01acb513abf1c2d64"},
   "plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"},
   "plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"},
-  "postgrex": {:hex, :postgrex, "0.15.9", "46f8fe6f25711aeb861c4d0ae09780facfdf3adbd2fb5594ead61504dd489bda", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "610719103e4cb2223d4ab78f9f0f3e720320eeca6011415ab4137ddef730adee"},
+  "postgrex": {:hex, :postgrex, "0.15.10", "2809dee1b1d76f7cbabe570b2a9285c2e7b41be60cf792f5f2804a54b838a067", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "1560ca427542f6b213f8e281633ae1a3b31cdbcd84ebd7f50628765b8f6132be"},
   "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
   "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
   "telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"},
   "telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"},
 }
 }

+ 16 - 7
frameworks/Elixir/phoenix/phoenix.dockerfile

@@ -1,22 +1,31 @@
-FROM elixir:1.11.4
+###############
+# Build stage #
+###############
+FROM elixir:1.12.2 as build
 
 
-WORKDIR /phoenix
+ARG MIX_ENV="prod"
 
 
 RUN mix local.hex --force && \
 RUN mix local.hex --force && \
     mix local.rebar --force
     mix local.rebar --force
 
 
 COPY config ./config
 COPY config ./config
 COPY lib ./lib
 COPY lib ./lib
+COPY rel ./rel
 COPY priv ./priv
 COPY priv ./priv
-COPY web ./web
 COPY mix.exs .
 COPY mix.exs .
 COPY mix.lock .
 COPY mix.lock .
 
 
-ENV MIX_ENV=prod
+RUN mix deps.get --force --only prod
+RUN mix release --force --path /export
 
 
-RUN mix do deps.get --force --only prod
-RUN mix release --force
+####################
+# Deployment Stage #
+####################
+FROM erlang:24.0.5
+
+COPY --from=build /export /opt
 
 
 EXPOSE 8080
 EXPOSE 8080
 
 
-CMD ["_build/prod/rel/hello/bin/hello", "start"]
+ENTRYPOINT ["/opt/bin/hello"]
+CMD ["start"]

+ 7 - 2
frameworks/Elixir/phoenix/rel/vm.args.eex

@@ -10,5 +10,10 @@
 ## Tweak GC to run more often
 ## Tweak GC to run more often
 ##-env ERL_FULLSWEEP_AFTER 10
 ##-env ERL_FULLSWEEP_AFTER 10
 
 
-+sbwt very_long
-+swt very_low
+#+sub true
+#+sbwt very_long
+#+sbwtdcpu very_long
+#+sbwtdio very_long
+#+swt very_low
+#+swtdcpu very_low
+#+swtdio very_low

+ 0 - 3
frameworks/Elixir/phoenix/web/views/layout_view.ex

@@ -1,3 +0,0 @@
-defmodule Hello.LayoutView do
-  use Hello.Web, :view
-end

+ 0 - 3
frameworks/Elixir/phoenix/web/views/page_view.ex

@@ -1,3 +0,0 @@
-defmodule Hello.PageView do
-  use Hello.Web, :view
-end