Skip to content

Commit

Permalink
fix erlang and elixir builds (LesnyRumcajs#198)
Browse files Browse the repository at this point in the history
* fix erlang and elixir builds

* Reinstate Erlang lockfile + bump forked dependency that was rebased (LesnyRumcajs#200)

Signed-off-by: Pierre Fenoll <[email protected]>

* Fix grpc falco errors (LesnyRumcajs#201)

* Fix LesnyRumcajs#198

* Remove unescessary files

Co-authored-by: Pierre Fenoll <[email protected]>
Co-authored-by: Adriano Santos <[email protected]>
  • Loading branch information
3 people authored Mar 9, 2022
1 parent c75ba80 commit fc62fb0
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 42 deletions.
2 changes: 1 addition & 1 deletion elixir_grpc_bench/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN cp /root/.mix/escripts/protoc-gen-elixir /usr/bin/
RUN protoc --proto_path=/app/proto/helloworld --elixir_out=plugins=grpc:./lib/ helloworld.proto

ENV MIX_ENV=prod
RUN mix do deps.get, compile
RUN mix do clean, deps.clean --all, deps.get, compile

RUN echo "+sbwt none" >> /app/rel/vm.args.eex \
&& echo "+sbwtdcpu none" >> /app/rel/vm.args.eex \
Expand Down
2 changes: 1 addition & 1 deletion elixir_grpc_bench/config/config.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Config

config :grpc, start_server: true
config :falco, start_server: true

config :logger,
level: :error,
Expand Down
2 changes: 1 addition & 1 deletion elixir_grpc_bench/config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Config

config :grpc, start_server: true
config :falco, start_server: true

config :logger,
level: :error,
Expand Down
2 changes: 1 addition & 1 deletion elixir_grpc_bench/config/prod.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Config

config :grpc, start_server: true
config :falco, start_server: true

config :logger,
level: :error,
Expand Down
4 changes: 2 additions & 2 deletions elixir_grpc_bench/lib/endpoint.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Helloworld.Endpoint do
use GRPC.Endpoint
use Falco.Endpoint

intercept(GRPC.Logger.Server)
intercept(Falco.Logger.Server)
run(Helloworld.Greeter.Server)
end
91 changes: 91 additions & 0 deletions elixir_grpc_bench/lib/helloworld.pb.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
defmodule Helloworld.Hello.Pet.Color do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3

@type t :: integer | :BLACK | :WHITE | :BLUE | :RED | :YELLOW | :GREEN

field :BLACK, 0
field :WHITE, 1
field :BLUE, 2
field :RED, 3
field :YELLOW, 4
field :GREEN, 5
end

defmodule Helloworld.Hello.Pet do
@moduledoc false
use Protobuf, syntax: :proto3

@type t :: %__MODULE__{
name: String.t(),
color: Helloworld.Hello.Pet.Color.t()
}
defstruct [:name, :color]

field :name, 1, type: :string
field :color, 2, type: Helloworld.Hello.Pet.Color, enum: true
end

defmodule Helloworld.Hello do
@moduledoc false
use Protobuf, syntax: :proto3

@type t :: %__MODULE__{
choice: {atom, any},
name: String.t(),
d: float | :infinity | :negative_infinity | :nan,
f: float | :infinity | :negative_infinity | :nan,
b: boolean,
n: integer,
l: integer,
pets: [Helloworld.Hello.Pet.t()]
}
defstruct [:choice, :name, :d, :f, :b, :n, :l, :pets]

oneof :choice, 0
field :name, 1, type: :string
field :d, 2, type: :double
field :f, 3, type: :float
field :b, 4, type: :bool
field :n, 5, type: :int32
field :l, 6, type: :int64
field :c1, 7, type: :string, oneof: 0
field :c2, 8, type: :bool, oneof: 0
field :pets, 9, repeated: true, type: Helloworld.Hello.Pet
end

defmodule Helloworld.HelloRequest do
@moduledoc false
use Protobuf, syntax: :proto3

@type t :: %__MODULE__{
request: Helloworld.Hello.t() | nil
}
defstruct [:request]

field :request, 1, type: Helloworld.Hello
end

defmodule Helloworld.HelloReply do
@moduledoc false
use Protobuf, syntax: :proto3

@type t :: %__MODULE__{
response: Helloworld.Hello.t() | nil
}
defstruct [:response]

field :response, 1, type: Helloworld.Hello
end

defmodule Helloworld.Greeter.Service do
@moduledoc false
use GRPC.Service, name: "helloworld.Greeter"

rpc :SayHello, Helloworld.HelloRequest, Helloworld.HelloReply
end

defmodule Helloworld.Greeter.Stub do
@moduledoc false
use GRPC.Stub, service: Helloworld.Greeter.Service
end
2 changes: 1 addition & 1 deletion elixir_grpc_bench/lib/helloworld_app.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule HelloworldApp do

def start(_type, _args) do
children = [
{GRPC.Server.Supervisor,
{Falco.Server.Supervisor,
{Helloworld.Endpoint, 50051, [num_acceptors: 1000, max_connections: 1_000_000]}}
]

Expand Down
4 changes: 2 additions & 2 deletions elixir_grpc_bench/lib/server.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Helloworld.Greeter.Server do
use GRPC.Server, service: Helloworld.Greeter.Service, compressors: [GRPC.Compressor.Gzip]
use Falco.Server, service: Helloworld.Greeter.Service, compressors: [Falco.Compressor.Gzip]

@spec say_hello(Helloworld.HelloRequest.t(), GRPC.Server.Stream.t()) ::
@spec say_hello(Helloworld.HelloRequest.t(), Falco.Server.Stream.t()) ::
Helloworld.HelloReply.t()
def say_hello(request, _stream) do
Helloworld.HelloReply.new(response: request.request)
Expand Down
5 changes: 2 additions & 3 deletions elixir_grpc_bench/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ defmodule Helloworld.Mixfile do
end

def application do
[mod: {HelloworldApp, []}, applications: [:logger, :grpc]]
[mod: {HelloworldApp, []}, applications: [:logger, :falco]]
end

defp deps do
[
# {:grpc, github: "elixir-grpc/grpc"},
{:grpc, github: "eigr/grpc"},
{:falco, github: "eigr/falco", tag: "v0.6.0-beta"},
{:protobuf, "~> 0.9.0", override: true},
{:cowlib, "~> 2.11", override: true},
{:dialyxir, "~> 0.5", only: [:dev, :test], runtime: false}
Expand Down
44 changes: 15 additions & 29 deletions elixir_grpc_bench/mix.lock
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
%{
cowboy:
{:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452",
[:make, :rebar3],
[
{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]},
{:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}
], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"},
cowlib:
{:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063",
[:make, :rebar3], [], "hexpm",
"2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
dialyxir:
{:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952",
[:mix], [], "hexpm", "6c32a70ed5d452c6650916555b1f96c79af5fc4bf286997f8b15f213de786f73"},
grpc:
{:git, "https://github.com/elixir-grpc/grpc.git", "eff8a8828d27ddd7f63a3c1dd5aae86246df215e",
[]},
gun:
{:hex, :grpc_gun, "2.0.0", "f99678a2ab975e74372a756c86ec30a8384d3ac8a8b86c7ed6243ef4e61d2729",
[:rebar3], [{:cowlib, "~> 2.8.0", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm",
"03dbbca1a9c604a0267a40ea1d69986225091acb822de0b2dbea21d5815e410b"},
protobuf:
{:hex, :protobuf, "0.9.0", "9c1633ecc098f3d7ec0a00503e070541b0e1868114fff41523934888442319e7",
[:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm",
"15fb7cddc5f85b8055fedaf81a9093020e4cd283647a21deb8f7de8d243abb9d"},
ranch:
{:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d",
[:make, :rebar3], [], "hexpm",
"49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}
"accept": {:hex, :accept, "0.3.5", "b33b127abca7cc948bbe6caa4c263369abf1347cfa9d8e699c6d214660f10cd1", [:rebar3], [], "hexpm", "11b18c220bcc2eab63b5470c038ef10eb6783bcb1fcdb11aa4137defa5ac1bb8"},
"cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"},
"cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm", "6c32a70ed5d452c6650916555b1f96c79af5fc4bf286997f8b15f213de786f73"},
"extrace": {:hex, :extrace, "0.3.1", "54b202e8a3961075e0098440d288f663d93ce926744bede27d8bc8d4a3c5e288", [:mix], [{:recon, "~> 2.5", [hex: :recon, repo: "hexpm", optional: false]}], "hexpm", "9a7501ea792fb410b71de02967ed320ec20001d2a9f9e4105727c3df16e58687"},
"falco": {:git, "https://github.com/eigr/falco.git", "5d4a2e3e721af4be64ad64fe473de4e584c2c0da", [tag: "v0.6.0-beta"]},
"gun": {:hex, :grpc_gun, "2.0.0", "f99678a2ab975e74372a756c86ec30a8384d3ac8a8b86c7ed6243ef4e61d2729", [:rebar3], [{:cowlib, "~> 2.8.0", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "03dbbca1a9c604a0267a40ea1d69986225091acb822de0b2dbea21d5815e410b"},
"prometheus": {:hex, :prometheus, "4.8.1", "fa76b152555273739c14b06f09f485cf6d5d301fe4e9d31b7ff803d26025d7a0", [:mix, :rebar3], [{:quantile_estimator, "~> 0.2.1", [hex: :quantile_estimator, repo: "hexpm", optional: false]}], "hexpm", "6edfbe928d271c7f657a6f2c46258738086584bd6cae4a000b8b9a6009ba23a5"},
"prometheus_ex": {:hex, :prometheus_ex, "3.0.5", "fa58cfd983487fc5ead331e9a3e0aa622c67232b3ec71710ced122c4c453a02f", [:mix], [{:prometheus, "~> 4.0", [hex: :prometheus, repo: "hexpm", optional: false]}], "hexpm", "9fd13404a48437e044b288b41f76e64acd9735fb8b0e3809f494811dfa66d0fb"},
"prometheus_httpd": {:hex, :prometheus_httpd, "2.1.11", "f616ed9b85b536b195d94104063025a91f904a4cfc20255363f49a197d96c896", [:rebar3], [{:accept, "~> 0.3", [hex: :accept, repo: "hexpm", optional: false]}, {:prometheus, "~> 4.2", [hex: :prometheus, repo: "hexpm", optional: false]}], "hexpm", "0bbe831452cfdf9588538eb2f570b26f30c348adae5e95a7d87f35a5910bcf92"},
"protobuf": {:hex, :protobuf, "0.9.0", "9c1633ecc098f3d7ec0a00503e070541b0e1868114fff41523934888442319e7", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "15fb7cddc5f85b8055fedaf81a9093020e4cd283647a21deb8f7de8d243abb9d"},
"quantile_estimator": {:hex, :quantile_estimator, "0.2.1", "ef50a361f11b5f26b5f16d0696e46a9e4661756492c981f7b2229ef42ff1cd15", [:rebar3], [], "hexpm", "282a8a323ca2a845c9e6f787d166348f776c1d4a41ede63046d72d422e3da946"},
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"recon": {:hex, :recon, "2.5.2", "cba53fa8db83ad968c9a652e09c3ed7ddcc4da434f27c3eaa9ca47ffb2b1ff03", [:mix, :rebar3], [], "hexpm", "2c7523c8dee91dff41f6b3d63cba2bd49eb6d2fe5bf1eec0df7f87eb5e230e1c"},
"statix": {:hex, :statix, "1.4.0", "c822abd1e60e62828e8460e932515d0717aa3c089b44cc3f795d43b94570b3a8", [:mix], [], "hexpm", "507373cc80925a9b6856cb14ba17f6125552434314f6613c907d295a09d1a375"},
}
2 changes: 1 addition & 1 deletion erlang_grpcbox_bench/rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[{<<"acceptor_pool">>,{pkg,<<"acceptor_pool">>,<<"1.0.0">>},1},
{<<"chatterbox">>,
{git,"https://github.com/psalin/chatterbox.git",
{ref,"50f570fb82a239292615663ac246df74cecb5a12"}},
{ref,"ba9c97ffec688b82871640de1ec20f35bba827ed"}},
0},
{<<"ctx">>,{pkg,<<"ctx">>,<<"0.6.0">>},1},
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.8.0">>},1},
Expand Down

0 comments on commit fc62fb0

Please sign in to comment.