Skip to content

Commit

Permalink
Forward port v1.1
Browse files Browse the repository at this point in the history
Merge release-1.1 branch into master.
  • Loading branch information
bettio committed Jun 9, 2023
2 parents 3c1ac84 + 1b5aadb commit 2209372
Show file tree
Hide file tree
Showing 15 changed files with 313 additions and 257 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ on:
pull_request:

env:
elixir_version: "1.11.4"
otp_version: "23.3"
elixir_version: "1.14.5"
otp_version: "25.3.2"

jobs:
test-dialyzer:
name: Check Dialyzer
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
MIX_ENV: ci
steps:
Expand All @@ -39,7 +39,7 @@ jobs:
key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-dialyzer_cache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-dialyzer_cache-
- uses: erlef/setup-elixir@v1.7.0
- uses: erlef/setup-beam@v1.15
with:
otp-version: ${{ env.otp_version }}
elixir-version: ${{ env.elixir_version }}
Expand All @@ -51,15 +51,15 @@ jobs:

test-coverage:
name: Build and Test
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
# Wait for Dialyzer to give it a go before building
needs:
- test-dialyzer
strategy:
fail-fast: false
matrix:
rabbitmq:
- "rabbitmq:3.8.16-management"
- "rabbitmq:3.12.0-management"
services:
rabbitmq:
image: ${{ matrix.rabbitmq }}
Expand All @@ -83,7 +83,7 @@ jobs:
key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-_build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-_build-
- uses: erlef/setup-elixir@v1.7.0
- uses: erlef/setup-beam@v1.15
with:
otp-version: ${{ env.otp_version }}
elixir-version: ${{ env.elixir_version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-container-build-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
test-build-container:
name: Test Container Build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Building Docker Image
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
elixir 1.11.4-otp-23
erlang 23.2.7
elixir 1.14.5-otp-25
erlang 25.3.2
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased
## [1.1.0-rc.0] - 2023-06-09
### Changed
- Use the `internal` event type for device heartbeat.
- Update Elixir to 1.14.5 and Erlang/OTP to 25.3.2.

## [1.1.0-alpha.0] - 2022-11-24
### Fixed
- Correctly serialize disconnection/reconnection events if VerneMQ hooks are called in
the wrong order. Fix https://github.com/astarte-platform/astarte/issues/668.
Expand Down
24 changes: 11 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# Build with Elixir 1.11.3/OTP 23
FROM elixir:1.11.4 as builder
FROM hexpm/elixir:1.14.5-erlang-25.3.2-debian-bullseye-20230522-slim as builder

# install build dependencies
# --allow-releaseinfo-change allows to pull from 'oldstable'
RUN apt-get update --allow-releaseinfo-change -y \
&& apt-get install -y build-essential git curl \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*

WORKDIR /build

# Needed for VerneMQ 1.11.0
RUN apt-get -qq update && apt-get -qq install libsnappy-dev
# Needed for VerneMQ 1.13.0
RUN apt-get -qq update && apt-get -qq install libsnappy-dev libssl-dev

# Let's start by building VerneMQ
# VerneMQ 1.11.0 uses git protocol, but it's no more supported by Github.
# See https://github.blog/2021-09-01-improving-git-protocol-security-github/
RUN git config --global url.https://.insteadOf git://

RUN git clone https://github.com/vernemq/vernemq.git -b 1.11.0

COPY docker/patches/increase_ssl_handshake_timeout.patch /build/vernemq/
RUN git clone https://github.com/vernemq/vernemq.git -b 1.13.0

RUN cd vernemq && \
git apply increase_ssl_handshake_timeout.patch && \
make rel && \
cd ..

Expand Down Expand Up @@ -57,7 +55,7 @@ COPY docker/bin/vernemq.sh /build/vernemq/_build/default/rel/vernemq/bin/
RUN chmod +x /build/vernemq/_build/default/rel/vernemq/bin/vernemq.sh

# Note: it is important to keep Debian versions in sync, or incompatibilities between libcrypto will happen
FROM debian:buster-slim
FROM debian:bullseye-slim

# Set the locale
ENV LANG C.UTF-8
Expand Down
2 changes: 1 addition & 1 deletion config/ci.exs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use Mix.Config
import Config
4 changes: 2 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
import Config

config :lager,
handlers: [level: :critical]

import_config "#{Mix.env()}.exs"
import_config "#{config_env()}.exs"
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
#

use Mix.Config
import Config

config :astarte_vmq_plugin, :registry_mfa, {Astarte.VMQ.Plugin.Utils, :empty_plugin_functions, []}

Expand Down
2 changes: 1 addition & 1 deletion config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
#

use Mix.Config
import Config

config :logger,
compile_time_purge_matching: [
Expand Down
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
#

use Mix.Config
import Config

# lager is used by rabbit_common.
# Silent it by setting the higher loglevel.
Expand Down
3 changes: 2 additions & 1 deletion lib/astarte_vmq_plugin.ex
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,10 @@ defmodule Astarte.VMQ.Plugin do
end

defp publish_heartbeat(realm, device_id) do
additional_headers = [x_astarte_internal_path: "/heartbeat"]
timestamp = now_us_x10_timestamp()

publish(realm, device_id, "", "heartbeat", timestamp)
publish(realm, device_id, "", "internal", timestamp, additional_headers)
end

defp publish(realm, device_id, payload, event_string, timestamp, additional_headers \\ []) do
Expand Down
8 changes: 4 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ defmodule Astarte.VMQ.Plugin.Mixfile do
def project do
[
app: :astarte_vmq_plugin,
version: "1.0.4",
elixir: "~> 1.11",
version: "1.1.0-rc.0",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
test_coverage: [tool: ExCoveralls],
Expand Down Expand Up @@ -76,7 +76,7 @@ defmodule Astarte.VMQ.Plugin.Mixfile do

defp astarte_required_modules(_) do
[
{:astarte_rpc, "~> 1.0.4"}
{:astarte_rpc, github: "astarte-platform/astarte_rpc", branch: "release-1.1"}
]
end

Expand All @@ -85,7 +85,7 @@ defmodule Astarte.VMQ.Plugin.Mixfile do
[
{:amqp, "~> 2.1"},
{:vernemq_dev, github: "vernemq/vernemq_dev"},
{:excoveralls, "~> 0.12", only: :test},
{:excoveralls, "~> 0.15", only: :test},
{:pretty_log, "~> 0.1"},
{:dialyzex, github: "Comcast/dialyzex", only: [:dev, :ci]}
]
Expand Down
19 changes: 9 additions & 10 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
%{
"amqp": {:hex, :amqp, "2.1.2", "eab047abb54f7e30022b81b9534b797e51c6e7756f1b112ec6dcee3c3ac20eac", [:mix], [{:amqp_client, "~> 3.8.0", [hex: :amqp_client, repo: "hexpm", optional: false]}], "hexpm", "535901c611a979221d045839e9e7a661bf33d04590b796c8fa30f487511fde04"},
"amqp_client": {:hex, :amqp_client, "3.8.25", "6035b3cc946cd45c7bc09c590bfb31de2b106e79564709b8c40e1c25f66b47ee", [:make, :rebar3], [{:rabbit_common, "3.8.25", [hex: :rabbit_common, repo: "hexpm", optional: false]}], "hexpm", "3b5889fe922c212acf9bfa355495d6a8a0a507591b54c0d4183d755a9b5a61ce"},
"astarte_rpc": {:hex, :astarte_rpc, "1.0.4", "c44de4edbe33e33d823dfca06c0b99944d99301605cccac7946519c960a1334d", [:mix], [{:amqp, "~> 2.1", [hex: :amqp, repo: "hexpm", optional: false]}, {:castore, "~> 0.1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:exprotobuf, "~> 1.2", [hex: :exprotobuf, repo: "hexpm", optional: false]}, {:gpb, "~> 4.12.0", [hex: :gpb, repo: "hexpm", optional: false]}, {:skogsra, "~> 2.2", [hex: :skogsra, repo: "hexpm", optional: false]}], "hexpm", "e9a5b8e8e286d3af50fdb8bd979476351f7ae62c42db0d3c05b7a9ae05ac912b"},
"castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"},
"certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [], [], "hexpm", "524c97b4991b3849dd5c17a631223896272c6b0af446778ba4675a1dff53bb7e"},
"credentials_obfuscation": {:hex, :credentials_obfuscation, "2.4.0", "9fb57683b84899ca3546b384e59ab5d3054a9f334eba50d74c82cd0ae82dd6ca", [:rebar3], [], "hexpm", "d28a89830e30698b075de9a4dbe683a20685c6bed1e3b7df744a0c06e6ff200a"},
"amqp_client": {:hex, :amqp_client, "3.8.35", "e81dbec62057155b5aff857ac9ee85a63af2baf6e0fd4e9d02a3aff46a3de836", [:make, :rebar3], [{:rabbit_common, "3.8.35", [hex: :rabbit_common, repo: "hexpm", optional: false]}], "hexpm", "ca8066e8d12530e31a9879789bc44bb2a4877dcd2d4b65e56b3d301b5e727688"},
"astarte_rpc": {:git, "https://github.com/astarte-platform/astarte_rpc.git", "6327f40149aade7b80a1e56b2f91a5c9c28723ee", [branch: "release-1.1"]},
"castore": {:hex, :castore, "0.1.19", "a2c3e46d62b7f3aa2e6f88541c21d7400381e53704394462b9fd4f06f6d42bb6", [:mix], [], "hexpm", "e96e0161a5dc82ef441da24d5fa74aefc40d920f3a6645d15e1f9f3e66bb2109"},
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
"credentials_obfuscation": {:hex, :credentials_obfuscation, "3.1.0", "2c405ea0c5db7b3344aa5a99f86c33e7b6ecea97d2cb613371e1cf0d192ef2c6", [:rebar3], [], "hexpm", "04884e62b1c6cdfba999d4d6b3e99bc0a59d5e439517bc5c01767255afb7b778"},
"dialyzex": {:git, "https://github.com/Comcast/dialyzex.git", "cdc7cf71fe6df0ce4cf59e3f497579697a05c989", []},
"excoveralls": {:hex, :excoveralls, "0.14.0", "4b562d2acd87def01a3d1621e40037fdbf99f495ed3a8570dfcf1ab24e15f76d", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "94f17478b0cca020bcd85ce7eafea82d2856f7ed022be777734a2f864d36091a"},
"exprotobuf": {:hex, :exprotobuf, "1.2.17", "3003937da617f588a8fb63ebdd7b127a18d78d6502623c272076fd54c07c4de1", [:mix], [{:gpb, "~> 4.0", [hex: :gpb, repo: "hexpm", optional: false]}], "hexpm", "e07ec1e5ae6f8c1c8521450d5f6b658c8c700b1f34c70356e91ece0766f4361a"},
"excoveralls": {:hex, :excoveralls, "0.15.0", "ac941bf85f9f201a9626cc42b2232b251ad8738da993cf406a4290cacf562ea4", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "9631912006b27eca30a2f3c93562bc7ae15980afb014ceb8147dc5cdd8f376f1"},
"goldrush": {:hex, :goldrush, "0.1.9", "f06e5d5f1277da5c413e84d5a2924174182fb108dabb39d5ec548b27424cd106", [:rebar3], [], "hexpm", "99cb4128cffcb3227581e5d4d803d5413fa643f4eb96523f77d9e6937d994ceb"},
"gpb": {:hex, :gpb, "4.12.0", "4a5224c046b1cd91fb23b81a8a450cb4435016c1f2c96af71f0a90476a11dcaf", [:make, :rebar], [], "hexpm", "de6c947a2308c52941bab0b168e0aadca146c26678a330698865d222a3621125"},
"hackney": {:hex, :hackney, "1.17.4", "99da4674592504d3fb0cfef0db84c3ba02b4508bae2dff8c0108baa0d6e0977c", [:rebar3], [{:certifi, "~>2.6.1", [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", "de16ff4996556c8548d512f4dbe22dd58a587bf3332e7fd362430a7ef3986b16"},
"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"},
"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.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
"jsx": {:hex, :jsx, "3.1.0", "d12516baa0bb23a59bb35dccaf02a1bd08243fcbb9efe24f2d9d056ccff71268", [:rebar3], [], "hexpm", "0c5cc8fdc11b53cc25cf65ac6705ad39e54ecc56d1c22e4adb8f5a53fb9427f3"},
Expand All @@ -20,7 +18,8 @@
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
"pretty_log": {:hex, :pretty_log, "0.9.0", "f84aab76e20c551a624ddd4656f1e5f9ca2941625db07549e9cb6a84a346bd40", [:mix], [{:logfmt, "~> 3.3", [hex: :logfmt, repo: "hexpm", optional: false]}], "hexpm", "abf9605c50fdd9377a3ce02ea51696538f4f647b9bb63a8dac209427fc7badf4"},
"rabbit_common": {:hex, :rabbit_common, "3.8.25", "961ce6d0f47faecf902bf8ff58b96d8be91fc21ef65baec8b36e416e46d2382c", [:make, :rebar3], [{:credentials_obfuscation, "2.4.0", [hex: :credentials_obfuscation, repo: "hexpm", optional: false]}, {:jsx, "3.1.0", [hex: :jsx, repo: "hexpm", optional: false]}, {:lager, "3.9.2", [hex: :lager, repo: "hexpm", optional: false]}, {:recon, "2.5.1", [hex: :recon, repo: "hexpm", optional: false]}], "hexpm", "c133e9e4b821fa14d139b21394ecbf5012b0e9c7e5791446e3f928144b35b42b"},
"protobuf": {:git, "https://github.com/elixir-protobuf/protobuf.git", "590e90887636a9ebcd560d9283a532e539b571c3", []},
"rabbit_common": {:hex, :rabbit_common, "3.8.35", "392b43d3242bc9b02b6889be1726ce9ee6bb8e9a226e20253cd8512a147fa765", [:make, :rebar3], [{:credentials_obfuscation, "3.1.0", [hex: :credentials_obfuscation, repo: "hexpm", optional: false]}, {:jsx, "3.1.0", [hex: :jsx, repo: "hexpm", optional: false]}, {:lager, "3.9.2", [hex: :lager, repo: "hexpm", optional: false]}, {:recon, "2.5.1", [hex: :recon, repo: "hexpm", optional: false]}], "hexpm", "aa79691f95bc86f6383fea2be6a781c1c5efa76d3e6cc0670af2232d8515baac"},
"recon": {:hex, :recon, "2.5.1", "430ffa60685ac1efdfb1fe4c97b8767c92d0d92e6e7c3e8621559ba77598678a", [:mix, :rebar3], [], "hexpm", "5721c6b6d50122d8f68cccac712caa1231f97894bab779eff5ff0f886cb44648"},
"skogsra": {:hex, :skogsra, "2.3.3", "90ea76d98ad749241b31e724ca17ed8aca0202001972aeca3cb834f44027f3ea", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}, {:yamerl, "~> 0.8", [hex: :yamerl, repo: "hexpm", optional: true]}], "hexpm", "e36880922431d41ac56d6cb4529b0526039a108fb44f8ecc90b517d494b86c28"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
Expand Down
Loading

0 comments on commit 2209372

Please sign in to comment.