diff --git a/.formatter.exs b/.formatter.exs index 2382994..d2cda26 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,9 +1,4 @@ +# Used by "mix format" [ - inputs: [ - "lib/**/*.{ex,exs}", - "test/**/*.{ex,exs}", - "mix.exs" - ], - - locals_without_parens: [] -] \ No newline at end of file + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3c9eabb..c9e0ce6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,23 +7,23 @@ jobs: name: Format and compile with warnings as errors runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.1 + - uses: actions/checkout@v2 - name: Install OTP and Elixir uses: erlef/setup-beam@v1 with: - otp-version: 24.0 - elixir-version: 1.13.4 + otp-version: 26.x + elixir-version: 1.16.x - name: Install dependencies run: mix deps.get - - name: Run "mix format" - run: mix format --check-formatted - - name: Compile with --warnings-as-errors run: mix compile --warnings-as-errors + - name: Run "mix format" + run: mix format --check-formatted + test: name: Test (Elixir ${{matrix.elixir}} | Erlang/OTP ${{matrix.otp}}) runs-on: ubuntu-latest @@ -31,9 +31,11 @@ jobs: fail-fast: false matrix: include: - - otp: 24.0 - elixir: 1.13.4 + - otp: 26.x + elixir: 1.16.x coverage: true + - otp: 27.x + elixir: 1.17.x env: MIX_ENV: test steps: @@ -58,8 +60,8 @@ jobs: fail-fast: false matrix: include: - - otp: 24.0 - elixir: 1.13.4 + - otp: 27.x + elixir: 1.17.x steps: - uses: actions/checkout@v2 diff --git a/Dockerfile b/Dockerfile index f5d6b32..c375fa9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Based on https://github.com/hexpm/hexpm/blob/08e80ed4fe82b145f6cee1d01da16e162add2a56/Dockerfile -FROM elixir:1.9.0-alpine as build +FROM docker.io/hexpm/elixir:1.17.1-erlang-26.2.5.1-alpine-3.17.8 as build ENV MIX_ENV=prod @@ -10,8 +10,8 @@ RUN mix local.hex --force && mix local.rebar --force # install mix dependencies COPY mix.exs mix.lock ./ -COPY config config -RUN mix deps.get +COPY config/config.exs config/ +RUN mix deps.get --only $MIX_ENV RUN mix deps.compile # build project @@ -19,12 +19,14 @@ COPY priv priv COPY lib lib RUN mix compile +COPY config/runtime.exs config/ + # build release COPY rel rel RUN mix release # prepare release image -FROM alpine:3.9 AS app +FROM docker.io/library/alpine:3.17.8 AS app RUN apk add --update bash openssl RUN mkdir /app diff --git a/README.md b/README.md index 30d88b6..00a6d95 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ How do I speak 'poxa'? Poxa is a standalone elixir server implementation of the Pusher protocol. -You need [Elixir](http://elixir-lang.org) 1.9 at least and Erlang 21.0 +You need [Elixir](http://elixir-lang.org) 1.16 at least and Erlang 26.0 Clone this repository diff --git a/config/releases.exs b/config/runtime.exs similarity index 100% rename from config/releases.exs rename to config/runtime.exs diff --git a/lib/poxa.ex b/lib/poxa.ex index 7414249..9dab2cb 100644 --- a/lib/poxa.ex +++ b/lib/poxa.ex @@ -17,8 +17,8 @@ defmodule Poxa do [ {"/ping", Poxa.PingHandler, []}, {"/console", Poxa.Console.WSHandler, []}, - {"/", :cowboy_static, {:priv_file, :poxa, 'index.html'}}, - {"/static/[...]", :cowboy_static, {:priv_dir, :poxa, 'static'}}, + {"/", :cowboy_static, {:priv_file, :poxa, ~c"index.html"}}, + {"/static/[...]", :cowboy_static, {:priv_dir, :poxa, ~c"static"}}, {"/apps/:app_id/events", Poxa.EventHandler, []}, {"/apps/:app_id/channels[/:channel_name]", Poxa.ChannelsHandler, []}, {"/apps/:app_id/channels/:channel_name/users", Poxa.UsersHandler, []}, diff --git a/lib/poxa/console/console.ex b/lib/poxa/console/console.ex index 8b13789..e69de29 100644 --- a/lib/poxa/console/console.ex +++ b/lib/poxa/console/console.ex @@ -1 +0,0 @@ - diff --git a/mix.exs b/mix.exs index ff3a4a9..0a19824 100644 --- a/mix.exs +++ b/mix.exs @@ -4,9 +4,9 @@ defmodule Poxa.Mixfile do def project do [ app: :poxa, - version: "1.2.0", + version: "1.3.0", name: "Poxa", - elixir: "~> 1.13", + elixir: "~> 1.16", deps: deps(), dialyzer: [plt_file: {:no_warn, "priv/plts/dialyzer.plt"}] ] @@ -21,8 +21,8 @@ defmodule Poxa.Mixfile do {:cowboy, "~> 2.6"}, {:jason, "~> 1.0"}, {:signaturex, "~> 1.3"}, - {:gproc, "~> 0.8"}, - {:httpoison, "~> 1.0"}, + {:gproc, "~> 1.0"}, + {:httpoison, "~> 2.0"}, {:ex2ms, "~> 1.5"}, {:mimic, "~> 1.0", only: :test}, {:pusher, "~> 2.1", only: :test}, diff --git a/mix.lock b/mix.lock index 4711908..ae9857c 100644 --- a/mix.lock +++ b/mix.lock @@ -1,30 +1,29 @@ %{ - "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, - "conform": {:hex, :conform, "2.5.2", "7035787a9c09d28607745444e7a1700426dc47c452634a5694033fa2fbb3414c", [:mix], [{:neotoma, "~> 1.7.3", [hex: :neotoma, repo: "hexpm", optional: false]}], "hexpm"}, - "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, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"}, + "certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"}, + "cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911aa1771639bef82651e"}, + "cowlib": {:hex, :cowlib, "2.13.0", "db8f7505d8332d98ef50a3ef34b34c1afddec7506e4ee4dd4a3a266285d282ca", [:make, :rebar3], [], "hexpm", "e1e1284dc3fc030a64b1ad0d8382ae7e99da46c3246b815318a4b848873800a4"}, + "dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, "distillery": {:hex, :distillery, "1.5.2", "eec18b2d37b55b0bcb670cf2bcf64228ed38ce8b046bb30a9b636a6f5a4c0080", [:mix], [], "hexpm"}, - "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "ex2ms": {:hex, :ex2ms, "1.6.1", "66d472eb14da43087c156e0396bac3cc7176b4f24590a251db53f84e9a0f5f72", [:mix], [], "hexpm", "a7192899d84af03823a8ec2f306fa858cbcce2c2e7fd0f1c49e05168fb9c740e"}, + "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, + "ex2ms": {:hex, :ex2ms, "1.7.0", "45b9f523d0b777667ded60070d82d871a37e294f0b6c5b8eca86771f00f82ee1", [:mix], [], "hexpm", "2589eee51f81f1b1caa6d08c990b1ad409215fe6f64c73f73c67d36ed10be827"}, "exjsx": {:hex, :exjsx, "3.2.1", "1bc5bf1e4fd249104178f0885030bcd75a4526f4d2a1e976f4b428d347614f0f", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"}, - "gproc": {:hex, :gproc, "0.9.0", "853ccb7805e9ada25d227a157ba966f7b34508f386a3e7e21992b1b484230699", [:rebar3], [], "hexpm", "587e8af698ccd3504cf4ba8d90f893ede2b0f58cabb8a916e2bf9321de3cf10b"}, - "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~>2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, - "httpoison": {:hex, :httpoison, "1.8.1", "df030d96de89dad2e9983f92b0c506a642d4b1f4a819c96ff77d12796189c63e", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "35156a6d678d6d516b9229e208942c405cf21232edd632327ecfaf4fd03e79e0"}, - "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, - "jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, + "gproc": {:hex, :gproc, "1.0.0", "aa9ec57f6c9ff065b16d96924168d7c7157cd1fd457680efe4b1274f456fa500", [:rebar3], [], "hexpm", "109f253c2787de8a371a51179d4973230cbec6239ee673fa12216a5ce7e4f902"}, + "hackney": {:hex, :hackney, "1.20.1", "8d97aec62ddddd757d128bfd1df6c5861093419f8f7a4223823537bad5d064e2", [:rebar3], [{:certifi, "~> 2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fe9094e5f1a2a2c0a7d10918fee36bfec0ec2a979994cff8cfe8058cd9af38e3"}, + "httpoison": {:hex, :httpoison, "2.2.1", "87b7ed6d95db0389f7df02779644171d7319d319178f6680438167d7b69b1f3d", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "51364e6d2f429d80e14fe4b5f8e39719cacd03eb3f9a9286e61e216feac2d2df"}, + "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, + "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, "jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, - "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, - "mimic": {:hex, :mimic, "1.7.2", "27007e4e0c746ddb6d56a386c40585088b35621ae2d7167160e8c3283e8cd585", [:mix], [], "hexpm", "e4d40550523841055aa469f5125d124ab89ce8b2d3686cab908b98dff5e6111b"}, + "mimerl": {:hex, :mimerl, "1.3.0", "d0cd9fc04b9061f82490f6581e0128379830e78535e017f7780f37fea7545726", [:rebar3], [], "hexpm", "a1e15a50d1887217de95f0b9b0793e32853f7c258a5cd227650889b38839fe9d"}, + "mimic": {:hex, :mimic, "1.8.2", "f4cf6ad13a305c5ee1a6c304ee36fc7afb3ad748e2af8cd5fbf122f44a283534", [:mix], [], "hexpm", "abc982d5fdcc4cb5292980cb698cd47c0c5d9541b401e540fb695b69f1d46485"}, "neotoma": {:hex, :neotoma, "1.7.3", "d8bd5404b73273989946e4f4f6d529e5c2088f5fa1ca790b4dbe81f4be408e61", [:rebar], [], "hexpm"}, - "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, + "parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"}, "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}, - "pusher": {:hex, :pusher, "2.4.0", "e54e6c11d69cdb75a18ae9eb02a3e89ca831593d37a064fd913883c7df29fcb2", [:mix], [{:httpoison, "~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:signaturex, "~> 1.4", [hex: :signaturex, repo: "hexpm", optional: false]}, {:websockex, "~> 0.4.0", [hex: :websockex, repo: "hexpm", optional: false]}], "hexpm", "56a8cb93656750e6d71f5c2c62dc7c25b0c46e29398b0dbdd6b8c00a73736957"}, + "pusher": {:hex, :pusher, "2.5.0", "2d115e4f80885f6b891c1d0b3cec1877c0639f3d3dc178770e682164dd2dbd50", [:mix], [{:httpoison, "~> 2.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:signaturex, "~> 1.4", [hex: :signaturex, repo: "hexpm", optional: false]}, {:websockex, "~> 0.4.0", [hex: :websockex, repo: "hexpm", optional: false]}], "hexpm", "82cb7bbf7ff787ba52d8f2507826b725f180c22f7c359e6fdc45234927355bc6"}, "pusher_client": {:git, "https://github.com/edgurgel/pusher_client.git", "2edb22a7b45b2fe962b12d6ee5460f7d722aadd7", []}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, - "signaturex": {:hex, :signaturex, "1.4.0", "bd319a013a0a3fd7788fc1d7e05cab1f1681b4e4fc497a379d137b33cb5e3d61", [:mix], [], "hexpm", "5e6972d246f2ee1a8f017bde5695382b44b9ce79baa148e6ae99d95c04e265cf"}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, + "signaturex": {:hex, :signaturex, "1.5.0", "e84f5e10aaffcef4ea16546bb1c3cba6ff442579d43b9be4e06708af11ba27bf", [:mix], [], "hexpm", "6ca236222a2426fd073c4f57b7d9ca32d7bea188e99ca689746b97ddb4a2a437"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, "websocket_client": {:hex, :websocket_client, "1.3.0", "2275d7daaa1cdacebf2068891c9844b15f4fdc3de3ec2602420c2fb486db59b6", [:rebar3], [], "hexpm"}, "websockex": {:hex, :websockex, "0.4.3", "92b7905769c79c6480c02daacaca2ddd49de936d912976a4d3c923723b647bf0", [:mix], [], "hexpm", "95f2e7072b85a3a4cc385602d42115b73ce0b74a9121d0d6dbbf557645ac53e4"}, diff --git a/rel/config.exs b/rel/config.exs deleted file mode 100644 index 86ad8bc..0000000 --- a/rel/config.exs +++ /dev/null @@ -1,32 +0,0 @@ -# Import all plugins from `rel/plugins` -# They can then be used by adding `plugin MyPlugin` to -# either an environment, or release definition, where -# `MyPlugin` is the name of the plugin module. -Path.join(["rel", "plugins", "*.exs"]) -|> Path.wildcard() -|> Enum.map(&Code.eval_file(&1)) - -use Mix.Releases.Config, - default_release: :default, - default_environment: Mix.env() - - -environment :dev do - set dev_mode: true - set include_erts: false - set cookie: :"H`|_.kDAg_~4TVZ!aB/B/S3>E|C6o|~noC_!fV/8F<^>1he.*XI^C(;7fOV1Jh;B" -end - -environment :prod do - set include_erts: true - set include_src: false - set cookie: :"xR=}b(ZcHU8M1Lu&642.m{u{O)H]WD>[&&_5t8FW3t5mxy4nw=de~;lEbw*?EFXC" -end - -release :poxa do - set version: current_version(:poxa) - set applications: [ - :runtime_tools - ] - plugin Conform.ReleasePlugin -end diff --git a/rel/env.bat.eex b/rel/env.bat.eex index 482ffaf..0d82afd 100644 --- a/rel/env.bat.eex +++ b/rel/env.bat.eex @@ -1,6 +1,8 @@ @echo off -rem Set the release to work across nodes. If using the long name format like -rem the one below (my_app@127.0.0.1), you need to also uncomment the -rem RELEASE_DISTRIBUTION variable below. +rem Set the release to load code on demand (interactive) instead of preloading (embedded). +rem set RELEASE_MODE=interactive + +rem Set the release to work across nodes. +rem RELEASE_DISTRIBUTION must be "sname" (local), "name" (distributed) or "none". rem set RELEASE_DISTRIBUTION=name -rem set RELEASE_NODE=<%= @release.name %>@127.0.0.1 +rem set RELEASE_NODE=<%= @release.name %> diff --git a/rel/env.sh.eex b/rel/env.sh.eex index 6a0e6b1..ab7b76a 100644 --- a/rel/env.sh.eex +++ b/rel/env.sh.eex @@ -1,14 +1,20 @@ #!/bin/sh -# Sets and enables heart (recommended only in daemon mode) -# if [ "$RELEASE_COMMAND" = "daemon" ] || [ "$RELEASE_COMMAND" = "daemon_iex" ]; then -# HEART_COMMAND="$RELEASE_ROOT/bin/$RELEASE_NAME $RELEASE_COMMAND" -# export HEART_COMMAND -# export ELIXIR_ERL_OPTIONS="-heart" -# fi +# # Sets and enables heart (recommended only in daemon mode) +# case $RELEASE_COMMAND in +# daemon*) +# HEART_COMMAND="$RELEASE_ROOT/bin/$RELEASE_NAME $RELEASE_COMMAND" +# export HEART_COMMAND +# export ELIXIR_ERL_OPTIONS="-heart" +# ;; +# *) +# ;; +# esac -# Set the release to work across nodes. If using the long name format like -# the one below (my_app@127.0.0.1), you need to also uncomment the -# RELEASE_DISTRIBUTION variable below. +# # Set the release to load code on demand (interactive) instead of preloading (embedded). +# export RELEASE_MODE=interactive + +# # Set the release to work across nodes. +# # RELEASE_DISTRIBUTION must be "sname" (local), "name" (distributed) or "none". # export RELEASE_DISTRIBUTION=name -# export RELEASE_NODE=<%= @release.name %>@127.0.0.1 +# export RELEASE_NODE=<%= @release.name %> diff --git a/rel/remote.vm.args.eex b/rel/remote.vm.args.eex new file mode 100644 index 0000000..d9dfd37 --- /dev/null +++ b/rel/remote.vm.args.eex @@ -0,0 +1,12 @@ +## Customize flags given to the VM: https://www.erlang.org/doc/man/erl.html +## -mode/-name/-sname/-setcookie are configured via env vars, do not set them here + +## Increase number of concurrent ports/sockets +##+Q 65536 + +## Tweak GC to run more often +##-env ERL_FULLSWEEP_AFTER 10 + +## Enable deployment without epmd +## (requires changing both vm.args and remote.vm.args) +##-start_epmd false -erl_epmd_port 6789 -dist_listen false diff --git a/rel/vm.args.eex b/rel/vm.args.eex index 71e8032..a37b126 100644 --- a/rel/vm.args.eex +++ b/rel/vm.args.eex @@ -1,11 +1,12 @@ -## Customize flags given to the VM: http://erlang.org/doc/man/erl.html +## Customize flags given to the VM: https://www.erlang.org/doc/man/erl.html ## -mode/-name/-sname/-setcookie are configured via env vars, do not set them here -## Number of dirty schedulers doing IO work (file, sockets, etc) -##+SDio 5 - ## Increase number of concurrent ports/sockets ##+Q 65536 ## Tweak GC to run more often ##-env ERL_FULLSWEEP_AFTER 10 + +## Enable deployment without epmd +## (requires changing both vm.args and remote.vm.args) +##-start_epmd false -erl_epmd_port 6789false diff --git a/test/pusher_event_test.exs b/test/pusher_event_test.exs index e60ab3f..771c8e3 100644 --- a/test/pusher_event_test.exs +++ b/test/pusher_event_test.exs @@ -17,7 +17,7 @@ defmodule Poxa.PusherEventTest do test "subscription established output" do json = - "{\"channel\":\"channel\",\"data\":{},\"event\":\"pusher_internal:subscription_succeeded\"}" + "{\"data\":{},\"event\":\"pusher_internal:subscription_succeeded\",\"channel\":\"channel\"}" assert subscription_succeeded("channel") == json end @@ -44,21 +44,21 @@ defmodule Poxa.PusherEventTest do test "presence member added output" do json = - "{\"channel\":\"channel\",\"data\":\"{\\\"user_id\\\":\\\"userid\\\",\\\"user_info\\\":\\\"userinfo\\\"}\",\"event\":\"pusher_internal:member_added\"}" + "{\"data\":\"{\\\"user_info\\\":\\\"userinfo\\\",\\\"user_id\\\":\\\"userid\\\"}\",\"event\":\"pusher_internal:member_added\",\"channel\":\"channel\"}" assert presence_member_added("channel", "userid", "userinfo") == json end test "presence member removed output" do json = - "{\"channel\":\"channel\",\"data\":\"{\\\"user_id\\\":\\\"userid\\\"}\",\"event\":\"pusher_internal:member_removed\"}" + "{\"data\":\"{\\\"user_id\\\":\\\"userid\\\"}\",\"event\":\"pusher_internal:member_removed\",\"channel\":\"channel\"}" assert presence_member_removed("channel", "userid") == json end test "presence subscription succeeded" do json = - "{\"channel\":\"presence-channel\",\"data\":\"{\\\"presence\\\":{\\\"count\\\":1,\\\"hash\\\":{\\\"userid\\\":{\\\"user\\\":\\\"info\\\"}},\\\"ids\\\":[\\\"userid\\\"]}}\",\"event\":\"pusher_internal:subscription_succeeded\"}" + "{\"data\":\"{\\\"presence\\\":{\\\"count\\\":1,\\\"hash\\\":{\\\"userid\\\":{\\\"user\\\":\\\"info\\\"}},\\\"ids\\\":[\\\"userid\\\"]}}\",\"event\":\"pusher_internal:subscription_succeeded\",\"channel\":\"presence-channel\"}" subscription = %Poxa.PresenceSubscription{ channel: "presence-channel",