Skip to content

Commit

Permalink
Merge branch 'astarte-platform:master' into new-licence
Browse files Browse the repository at this point in the history
  • Loading branch information
eddbbt authored Dec 16, 2024
2 parents 955d802 + e48593e commit 84de061
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 72 deletions.
7 changes: 6 additions & 1 deletion compose.env → .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# The top level domain of your astarte instance.
# In case you want to make Astarte visible in your LAN, consider setting the variable
# to <HOST_IP>.nip.io
DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN=astarte.localhost

# This is the URL Pairing API will return for connecting to the broker
PAIRING_BROKER_URL=mqtts://broker.astarte.localhost:8883/
PAIRING_BROKER_URL=mqtts://broker.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}:8883/

RPC_AMQP_CONNECTION_HOST=rabbitmq
CASSANDRA_NODES=scylla:9042
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [astarte_import] Added support for data types: `doublearray`, `integerarray`,
`booleanarray`, `longintegerarray`, `stringarray`, `datetimearray`, `binaryblobarray`.

## [1.2.1] - Unreleased
### Changed
- Update the docker-compose configuration to allow both physical and virtual devices
to connect to Astarte, provided that the devices and the host are on the same LAN.

## [1.2.0] - 2024-07-02
### Fixed
- Forward port changes from release-1.1 (connection failure when delivering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,10 +692,12 @@ defmodule Astarte.DataUpdaterPlant.DataUpdater.Impl do
end

def handle_data(%State{discard_messages: true} = state, _, _, _, _) do
# TODO: do we want to include this in the handling time metric?
{:ack, :discard_messages, state}
end

def handle_data(state, interface, path, payload, timestamp) do
start = System.monotonic_time()
{:ok, db_client} = Database.connect(realm: state.realm)

new_state = execute_time_based_actions(state, timestamp, db_client)
Expand Down Expand Up @@ -867,7 +869,7 @@ defmodule Astarte.DataUpdaterPlant.DataUpdater.Impl do
paths_cache = Cache.put(new_state.paths_cache, {interface, path}, %CachedPath{}, ttl)
new_state = %{new_state | paths_cache: paths_cache}

continue_arg = {:processed_message, interface_descriptor, interface, path, payload}
continue_arg = {:processed_message, interface_descriptor, interface, path, payload, start}
{:ack, :ok, new_state, {:continue, continue_arg}}
else
{:error, :cannot_write_on_server_owned_interface} ->
Expand Down Expand Up @@ -1017,7 +1019,10 @@ defmodule Astarte.DataUpdaterPlant.DataUpdater.Impl do
end

@impl true
def handle_continue({:processed_message, interface_descriptor, interface, path, payload}, state) do
def handle_continue(
{:processed_message, interface_descriptor, interface, path, payload, start_time},
state
) do
:telemetry.execute(
[:astarte, :data_updater_plant, :data_updater, :processed_message],
%{},
Expand All @@ -1028,6 +1033,13 @@ defmodule Astarte.DataUpdaterPlant.DataUpdater.Impl do
)

new_state = update_stats(state, interface, interface_descriptor.major_version, path, payload)

:telemetry.execute(
[:astarte, :data_updater_plant, :data_updater, :handle_data],
%{duration: System.monotonic_time() - start_time},
%{realm: state.realm}
)

{:ok, new_state}
end

Expand Down
Binary file added doc/images/clea_bw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions doc/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule Doc.MixProject do
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
deps: deps(),
name: "Astarte",
name: "Clea Astarte",
homepage_url: "https://docs.astarte-platform.org/astarte/#{source_version}/",
source_url: "https://github.com/astarte-platform/astarte",
docs: docs()
Expand All @@ -33,7 +33,7 @@ defmodule Doc.MixProject do
defp docs do
[
main: "001-intro_user",
logo: "images/mascot.png",
logo: "images/clea_bw.png",
# It's in the docs repo root
javascript_config_path: "../common_vars.js",
extras: Path.wildcard("pages/*/*.md"),
Expand Down
42 changes: 21 additions & 21 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
dockerfile: ../../Dockerfile
context: apps/astarte_housekeeping
env_file:
- ./compose.env
- ./.env
restart: on-failure
depends_on:
- "rabbitmq"
Expand All @@ -21,7 +21,7 @@ services:
dockerfile: ../../Dockerfile
context: apps/astarte_housekeeping_api
env_file:
- ./compose.env
- ./.env
environment:
HOUSEKEEPING_API_JWT_PUBLIC_KEY_PATH: "/keys/housekeeping_public.pem"
volumes:
Expand All @@ -34,7 +34,7 @@ services:
- "traefik"
labels:
- "traefik.enable=true"
- "traefik.http.routers.astarte-housekeeping-api.rule=Host(`api.astarte.localhost`)"
- "traefik.http.routers.astarte-housekeeping-api.rule=Host(`api.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}`)"
- "traefik.http.routers.astarte-housekeeping-api.rule=PathPrefix(`/housekeeping`)"
- "traefik.http.routers.astarte-housekeeping-api.entrypoints=web"
- "traefik.http.routers.astarte-housekeeping-api.middlewares=astarte-housekeeping-api"
Expand All @@ -49,7 +49,7 @@ services:
dockerfile: ../../Dockerfile
context: apps/astarte_realm_management
env_file:
- ./compose.env
- ./.env
restart: on-failure
depends_on:
- "rabbitmq"
Expand All @@ -61,14 +61,14 @@ services:
dockerfile: ../../Dockerfile
context: apps/astarte_realm_management_api
env_file:
- ./compose.env
- ./.env
restart: on-failure
depends_on:
- "rabbitmq"
- "traefik"
labels:
- "traefik.enable=true"
- "traefik.http.routers.astarte-realm-management-api.rule=Host(`api.astarte.localhost`)"
- "traefik.http.routers.astarte-realm-management-api.rule=Host(`api.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}`)"
- "traefik.http.routers.astarte-realm-management-api.rule=PathPrefix(`/realmmanagement`)"
- "traefik.http.routers.astarte-realm-management-api.entrypoints=web"
- "traefik.http.routers.astarte-realm-management-api.middlewares=astarte-realm-management-api"
Expand All @@ -83,7 +83,7 @@ services:
dockerfile: ../../Dockerfile
context: apps/astarte_pairing
env_file:
- ./compose.env
- ./.env
environment:
PAIRING_CFSSL_URL: "http://cfssl:8080"
restart: on-failure
Expand All @@ -97,14 +97,14 @@ services:
dockerfile: ../../Dockerfile
context: apps/astarte_pairing_api
env_file:
- ./compose.env
- ./.env
restart: on-failure
depends_on:
- "rabbitmq"
- "traefik"
labels:
- "traefik.enable=true"
- "traefik.http.routers.astarte-pairing-api.rule=Host(`api.astarte.localhost`)"
- "traefik.http.routers.astarte-pairing-api.rule=Host(`api.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}`)"
- "traefik.http.routers.astarte-pairing-api.rule=PathPrefix(`/pairing`)"
- "traefik.http.routers.astarte-pairing-api.entrypoints=web"
- "traefik.http.routers.astarte-pairing-api.middlewares=astarte-pairing-api"
Expand All @@ -119,7 +119,7 @@ services:
dockerfile: ../../Dockerfile
context: apps/astarte_appengine_api
env_file:
- ./compose.env
- ./.env
environment:
APPENGINE_API_ROOMS_AMQP_CLIENT_HOST: rabbitmq
restart: on-failure
Expand All @@ -129,7 +129,7 @@ services:
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.astarte-appengine-api.rule=Host(`api.astarte.localhost`)"
- "traefik.http.routers.astarte-appengine-api.rule=Host(`api.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}`)"
- "traefik.http.routers.astarte-appengine-api.rule=PathPrefix(`/appengine`)"
- "traefik.http.routers.astarte-appengine-api.entrypoints=web"
- "traefik.http.routers.astarte-appengine-api.middlewares=astarte-appengine-api"
Expand All @@ -144,7 +144,7 @@ services:
dockerfile: ../../Dockerfile
context: apps/astarte_data_updater_plant
env_file:
- ./compose.env
- ./.env
environment:
DATA_UPDATER_PLANT_AMQP_CONSUMER_HOST: "rabbitmq"
DATA_UPDATER_PLANT_AMQP_PRODUCER_HOST: "rabbitmq"
Expand All @@ -163,7 +163,7 @@ services:
dockerfile: ../../Dockerfile
context: apps/astarte_trigger_engine
env_file:
- ./compose.env
- ./.env
environment:
TRIGGER_ENGINE_AMQP_CONSUMER_HOST: "rabbitmq"
restart: on-failure
Expand All @@ -181,7 +181,7 @@ services:
- "traefik"
labels:
- "traefik.enable=true"
- "traefik.http.routers.astarte-dashboard.rule=Host(`dashboard.astarte.localhost`)"
- "traefik.http.routers.astarte-dashboard.rule=Host(`dashboard.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}`)"
- "traefik.http.routers.astarte-dashboard.entrypoints=web"
- "traefik.http.routers.astarte-dashboard.service=astarte-dashboard"
- "traefik.http.services.astarte-dashboard.loadbalancer.server.port=80"
Expand All @@ -193,7 +193,7 @@ services:
- "traefik"
labels:
- "traefik.enable=true"
- "traefik.http.routers.astarte-grafana.rule=Host(`grafana.astarte.localhost`)"
- "traefik.http.routers.astarte-grafana.rule=Host(`grafana.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}`)"
- "traefik.http.routers.astarte-grafana.entrypoints=web"
- "traefik.http.routers.astarte-grafana.service=astarte-grafana"
- "traefik.http.services.astarte-grafana.loadbalancer.server.port=3000"
Expand Down Expand Up @@ -227,10 +227,10 @@ services:
aliases:
# Create traefik aliases for its hosts, so that other containers
# in the same network can curl them.
- api.astarte.localhost
- dashboard.astarte.localhost
- grafana.astarte.localhost
- broker.astarte.localhost
- api.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}
- dashboard.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}
- grafana.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}
- broker.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}

# RabbitMQ
rabbitmq:
Expand Down Expand Up @@ -260,7 +260,7 @@ services:
vernemq:
image: astarte/vernemq:snapshot
env_file:
- ./compose.env
- ./.env
environment:
DOCKER_VERNEMQ_LISTENER__SSL__DEFAULT__CAFILE: "/opt/vernemq/etc/ca.pem"
DOCKER_VERNEMQ_LISTENER__SSL__DEFAULT__CERTFILE: "/opt/vernemq/etc/cert.pem"
Expand All @@ -284,7 +284,7 @@ services:
restart: on-failure
labels:
- "traefik.enable=true"
- "traefik.tcp.routers.vernemq.rule=HostSNI(`broker.astarte.localhost`)"
- "traefik.tcp.routers.vernemq.rule=HostSNI(`broker.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}`)"
- "traefik.tcp.routers.vernemq.entrypoints=vernemq"
- "traefik.tcp.routers.vernemq.tls.passthrough=true"
- "traefik.tcp.routers.vernemq.service=vernemq"
Expand Down
Loading

0 comments on commit 84de061

Please sign in to comment.