Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f0b797c
Merge branch 'merge-upstream' into 'master'
simao Apr 24, 2025
854f78c
Add support for remote commands.
simao Apr 2, 2025
39446be
Fix quote in admin roles sql query
simao May 27, 2025
4f22531
Merge branch 'bugfix/OTA-2973/root-expires' into 'master'
simao May 28, 2025
c3c7d80
Merge branch 'feat/OTA-2641/remote-commands' into 'master'
simao Jul 3, 2025
b9badfa
Add new updates resource endpoint
simao Apr 30, 2025
5dc766d
Merge branch 'feat/OTA-2930/update-resource' into 'master'
simao Jul 16, 2025
0d0387f
Add new listener for `DeviceManifestReported`, saving manifests in
simao Jun 6, 2025
b7bcf16
Filter ecus by namespace
simao Jul 17, 2025
aad6bc2
Allow cancelling scheduled updates
simao Jul 21, 2025
1457b7d
FK from updates to provisioned_devices
simao Jul 21, 2025
1c37731
Merge branch 'feat/OTA-2930/update-resource' into 'master'
simao Jul 29, 2025
531cac9
Merge branch 'feat/OTA-2976/device-manifests' into 'master'
simao Jul 29, 2025
03bb2ff
[OTA-3088] publish deviceCancelled event even if no assignments exist
bclouser Aug 6, 2025
3135553
Get correlationIds for messages from updates table
simao Aug 12, 2025
51c177a
Fix error message when device has an active update
simao Aug 12, 2025
714249f
Merge branch 'bug/OTA-3088/update-status-not-changing' into 'master'
simao Aug 13, 2025
414c5ef
Merge branch 'bug/OTA-3094/active-update-ecu-serial' into 'master'
simao Aug 13, 2025
060425f
Use typed parameters for pagination limit/offset
simao Jul 9, 2025
d6c0a05
Merge branch 'typed-pagination' into 'master'
simao Aug 13, 2025
a1b1306
Add `success` to update events
simao Aug 25, 2025
9c4daa8
Fix delete query
simao Aug 27, 2025
b5c8f15
Merge branch 'hotfix03' into 'master'
simao Aug 27, 2025
96546d5
Use pekko instead of akka
simao Aug 27, 2025
05e69ef
Merge branch 'pekko' into 'master'
simao Sep 3, 2025
8ef8e0c
Add search by tags
simao Sep 18, 2025
b1730e5
Ignore unknown devices when searching for device ids
simao Oct 6, 2025
e794b22
Merge branch 'bugfix/OTA-2526/ignore-unknown-ids' into 'master'
simao Oct 7, 2025
0cebffb
Merge branch 'feat/OTA-2930/update-detail' into 'master'
simao Oct 7, 2025
1576be8
Merge branch 'feat/OTA-3178/search-tags' into 'master'
simao Oct 7, 2025
dba6bad
Provide more info in update listing endpoint
simao Aug 26, 2025
7ea316c
Merge branch 'feat/OTA-2930/update-results' into 'master'
simao Oct 10, 2025
ffa2979
Include device report in update detail response
simao Oct 13, 2025
c0f20ab
Merge branch 'feat/3210/update-detail' into 'master'
simao Oct 22, 2025
d0bf47f
Add `Seen` status to Update
simao Oct 20, 2025
f288da6
Merge branch 'feat/OTA-3211/update-seen' into 'master'
simao Oct 22, 2025
6fbedc6
Match ecu results on correlationId and deviceId
simao Oct 23, 2025
f02b547
Do not take signatures into account
simao Oct 24, 2025
ac10cb7
Merge branch 'bugfix/OTA-3242/manifest-checksum' into 'master'
simao Oct 27, 2025
40e31b9
Merge branch 'bugfix/OTA-3240/wrong-ecu-report' into 'master'
simao Oct 27, 2025
32a0365
Do not consider `report_counter` when calculating manifest checksum
simao Dec 10, 2025
3ca1366
Merge branch 'bugfix/manifest-storage' into 'master'
simao Dec 10, 2025
decce24
Add tests for canonicalization
tkfu Dec 23, 2025
dcf0b57
OTA-3305 Make director fetch root metadata as a JsonSignedPayload
tkfu Dec 23, 2025
8bdfca1
[.gitlab-ci.yml] update docker dind image
Dec 23, 2025
503bf58
Merge branch 'feat/OTA-3305-canonicalize-metadata-serverside' into 'm…
tkfu Jan 5, 2026
b4247db
Merge branch 'master' into trx-master
tkfu Jan 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ default:
- --character-set-server=utf8
- --collation-server=utf8_unicode_ci
- --max_connections=1000
- name: docker:dind
- name: docker:28.5.0-dind

include:
- project: toradex/torizon-cloud/ci-container-build
Expand Down
32 changes: 16 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@ scalacOptions := Seq(
"-Wconf:cat=other-match-analysis:error"
)

resolvers += "sonatype-snapshots".at("https://s01.oss.sonatype.org/content/repositories/snapshots")
resolvers += "sonatype-releases".at("https://s01.oss.sonatype.org/content/repositories/releases")
resolvers += Resolver.mavenCentral
resolvers += "maven-snapshots"at "https://central.sonatype.com/repository/maven-snapshots"

Global / bloopAggregateSourceDependencies := true

libraryDependencies ++= {
val akkaV = "2.8.5"
val akkaHttpV = "10.5.2"
val tufV = "3.2.11"
val pekkoV = "1.1.5"
val pekkoHttpV = "1.2.0"
val tufV = "5.0.0"
val scalaTestV = "3.2.19"
val bouncyCastleV = "1.83"
val libatsV = "2.6.6"
val bouncyCastleV = "1.80"
val libatsV = "5.0.0"

Seq(
"com.typesafe.akka" %% "akka-actor" % akkaV,
"com.typesafe.akka" %% "akka-stream" % akkaV,
"com.typesafe.akka" %% "akka-http" % akkaHttpV,
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpV,
"com.typesafe.akka" %% "akka-stream-testkit" % akkaV,
"com.typesafe.akka" %% "akka-slf4j" % akkaV,
"org.apache.pekko" %% "pekko-actor" % pekkoV,
"org.apache.pekko" %% "pekko-stream" % pekkoV,
"org.apache.pekko" %% "pekko-http" % pekkoHttpV,
"org.apache.pekko" %% "pekko-http-testkit" % pekkoHttpV,
"org.apache.pekko" %% "pekko-stream-testkit" % pekkoV,
"org.apache.pekko" %% "pekko-slf4j" % pekkoV,
"org.scalatest" %% "scalatest" % scalaTestV % Test,
"org.scalacheck" %% "scalacheck" % "1.19.0" % Test,
"io.github.uptane" %% "libats" % libatsV,
"io.github.uptane" %% "libats-messaging" % libatsV,
"io.github.uptane" %% "libats-messaging-datatype" % libatsV,
"io.github.uptane" %% "libats-metrics-akka" % libatsV,
"io.github.uptane" %% "libats-metrics-pekko" % libatsV,
"io.github.uptane" %% "libats-metrics-prometheus" % libatsV,
"io.github.uptane" %% "libats-http-tracing" % libatsV,
"io.github.uptane" %% "libats-slick" % libatsV,
Expand All @@ -56,8 +56,8 @@ libraryDependencies ++= {
"com.beachape" %% "enumeratum-circe" % "1.9.0",

// Device registry specific dependencies
"com.lightbend.akka" %% "akka-stream-alpakka-csv" % "2.0.0",
"io.circe" %% "circe-testing" % "0.14.15",
"org.apache.pekko" %% "pekko-connectors-csv" % "1.0.0",
"io.circe" %% "circe-testing" % "0.14.13",
"tech.sparse" %% "toml-scala" % "0.2.2",
"org.tpolecat" %% "atto-core" % "0.9.5",
"org.scalatestplus" %% "scalacheck-1-16" % "3.2.14.0" % Test
Expand Down
16 changes: 8 additions & 8 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
pekko {
loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]
loglevel = "DEBUG"
loglevel = ${?AKKA_LOGLEVEL}
loglevel = ${?PEKKO_LOGLEVEL}
log-config-on-start = off
log-config-on-start = ${?AKKA_LOG_CONFIG_ON_START}
log-config-on-start = ${?PEKKO_LOG_CONFIG_ON_START}

http {
server {
max-connections = 2048
max-connections = ${?AKKA_HTTP_MAX_CONNECTIONS}
max-connections = ${?PEKKO_HTTP_MAX_CONNECTIONS}
backlog = 10000
backlog = ${?AKKA_HTTP_BACKLOG}
backlog = ${?PEKKO_HTTP_BACKLOG}
}

# older versions of RAC send an "invalid" header
Expand All @@ -20,15 +20,15 @@ akka {
# The maximum number of parallel connections that a connection pool to a
# single host endpoint is allowed to establish. Must be greater than zero.
max-connections = 2048
max-connections = ${?AKKA_HTTP_CLIENT_MAX_CONNECTIONS}
max-connections = ${?PEKKO_HTTP_CLIENT_MAX_CONNECTIONS}
# The maximum number of open requests accepted into the pool across all
# materializations of any of its client flows.
# Protects against (accidentally) overloading a single pool with too many client flow materializations.
# Note that with N concurrent materializations the max number of open request in the pool
# will never exceed N * max-connections * pipelining-limit.
# Must be a power of 2 and > 0!
max-open-requests = 4096
max-open-requests = ${?AKKA_HTTP_CLIENT_MAX_OPEN_REQUESTS}
max-open-requests = ${?PEKKO_HTTP_CLIENT_MAX_OPEN_REQUESTS}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
CREATE TABLE `updates` (
`namespace` varchar(255) NOT NULL,
`id` char(36) NOT NULL,
`device_id` char(36) NOT NULL,
`hardware_update_id` char(36) NOT NULL,
`correlation_id` varchar(255) NOT NULL,
`scheduled_for` datetime(3) NULL,
`status` Enum('Assigned', 'Scheduled', 'Completed', 'PartiallyCompleted', 'Cancelled') NOT NULL,
`status_info` json DEFAULT NULL,
`completed_at` datetime(3) DEFAULT NULL,
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`, `device_id`),

CONSTRAINT fk_updates_hardware_update
FOREIGN KEY (hardware_update_id) REFERENCES hardware_updates (id),
FOREIGN KEY (device_id) REFERENCES provisioned_devices(id),

KEY `updates_status_scheduled_for` (`status`,`scheduled_for`),
KEY `idx_updates_device_id` (`device_id`),
KEY `idx_updates_namespace` (`namespace`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

CREATE INDEX `idx_assignments_namespace_correlation_id` ON `assignments` (`namespace`, `correlation_id`);

INSERT INTO `updates` (
`namespace`,
`id`,
`device_id`,
`hardware_update_id`,
`correlation_id`,
`scheduled_for`,
`status`,
`status_info`,
`completed_at`,
`created_at`,
`updated_at`
)
SELECT
`namespace`,
`id`,
`device_id`,
`hardware_update_id`,
CONCAT('urn:here-ota:mtu:', `hardware_update_id`),
`scheduled_at`,
`status`,
`status_info`,
CASE
WHEN `status` IN ('Completed', 'Cancelled') THEN `updated_at`
ELSE NULL
END as `completed_at`,
`created_at`,
`updated_at`
FROM `scheduled_updates`
ON DUPLICATE KEY UPDATE
`status` = VALUES(`status`),
`status_info` = VALUES(`status_info`),
`completed_at` = CASE
WHEN VALUES(`status`) IN ('Completed', 'Cancelled') THEN VALUES(`updated_at`)
ELSE NULL
END,
`updated_at` = VALUES(`updated_at`)
;

alter table EcuInstallationResult ADD `description` TEXT NULL
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

ALTER TABLE device_manifests CHANGE COLUMN sha256 checksum char(8)
;

CREATE INDEX device_manifests_received_at ON device_manifests(device_id, received_at)
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE device_manifests DROP INDEX IF EXISTS device_manifests_device_id_received_at_idx;

ALTER TABLE device_manifests ADD INDEX device_manifests_device_id_received_at_idx (device_id, received_at);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE `updates` MODIFY COLUMN
`status` Enum('Scheduled', 'Assigned', 'Seen', 'Completed', 'PartiallyCompleted', 'Cancelled') NOT NULL
;
31 changes: 11 additions & 20 deletions src/main/scala/com/advancedtelematic/director/Boot.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.advancedtelematic.director

import com.advancedtelematic.director.http.deviceregistry.TomlSupport.`application/toml`
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.Http.ServerBinding
import akka.http.scaladsl.server.{Directives, Route}
import akka.http.scaladsl.settings.{ParserSettings, ServerSettings}
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.Http.ServerBinding
import org.apache.pekko.http.scaladsl.server.{Directives, Route}
import org.apache.pekko.http.scaladsl.settings.{ParserSettings, ServerSettings}
import com.advancedtelematic.director.db.deviceregistry.DeviceRepository
import com.advancedtelematic.director.deviceregistry.AllowUUIDPath
import com.advancedtelematic.director.http.DirectorRoutes
Expand All @@ -17,23 +17,14 @@ import com.advancedtelematic.libats.http.VersionDirectives.versionHeaders
import com.advancedtelematic.libats.http.monitoring.ServiceHealthCheck
import com.advancedtelematic.libats.http.tracing.Tracing
import com.advancedtelematic.libats.http.tracing.Tracing.ServerRequestTracing
import com.advancedtelematic.libats.http.{
BootApp,
BootAppDatabaseConfig,
BootAppDefaultConfig,
NamespaceDirectives
}
import com.advancedtelematic.libats.messaging.MessageBus
import com.advancedtelematic.libats.http.{BootApp, BootAppDatabaseConfig, BootAppDefaultConfig, NamespaceDirectives}
import com.advancedtelematic.libats.messaging.{MessageBus, MessageBusPublisher}
import com.advancedtelematic.libats.messaging_datatype.DataType.DeviceId
import com.advancedtelematic.libats.slick.db.{CheckMigrations, DatabaseSupport}
import com.advancedtelematic.libats.slick.monitoring.{DatabaseMetrics, DbHealthResource}
import com.advancedtelematic.libtuf_server.keyserver.KeyserverHttpClient
import com.advancedtelematic.metrics.prometheus.PrometheusMetricsSupport
import com.advancedtelematic.metrics.{
AkkaHttpConnectionMetrics,
AkkaHttpRequestMetrics,
MetricsSupport
}
import com.advancedtelematic.metrics.{PekkoHttpConnectionMetrics, PekkoHttpRequestMetrics, MetricsSupport}
import com.codahale.metrics.MetricRegistry
import com.typesafe.config.Config
import org.bouncycastle.jce.provider.BouncyCastleProvider
Expand All @@ -53,8 +44,8 @@ class DirectorBoot(override val globalConfig: Config,
with DatabaseSupport
with MetricsSupport
with DatabaseMetrics
with AkkaHttpRequestMetrics
with AkkaHttpConnectionMetrics
with PekkoHttpRequestMetrics
with PekkoHttpConnectionMetrics
with PrometheusMetricsSupport
with CheckMigrations {

Expand All @@ -69,7 +60,7 @@ class DirectorBoot(override val globalConfig: Config,

private def keyserverClient(implicit tracing: ServerRequestTracing) = KeyserverHttpClient(tufUri)

private implicit val msgPublisher: com.advancedtelematic.libats.messaging.MessageBusPublisher =
private implicit val msgPublisher: MessageBusPublisher =
MessageBus.publisher(system, globalConfig)

private lazy val authNamespace = NamespaceDirectives.fromConfig()
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/advancedtelematic/director/Settings.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.advancedtelematic.director

import akka.event.Logging
import akka.http.scaladsl.model.Uri
import org.apache.pekko.event.Logging
import org.apache.pekko.http.scaladsl.model.Uri
import com.typesafe.config.ConfigFactory

trait Settings {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.advancedtelematic.director.daemon

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.Http.ServerBinding
import akka.http.scaladsl.server.Directives
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.Http.ServerBinding
import org.apache.pekko.http.scaladsl.server.Directives
import com.advancedtelematic.director.{Settings, VersionInfo}
import com.advancedtelematic.libats.http.{BootApp, BootAppDatabaseConfig, BootAppDefaultConfig}
import com.advancedtelematic.libats.messaging.{
Expand Down Expand Up @@ -68,6 +68,8 @@ class DirectorDaemonBoot(override val globalConfig: Config,
startMonitoredListener[DeviceUpdateEvent](new DeviceUpdateEventListener(messageBus))
startMonitoredListener[DeviceMqttLifecycle](new MqttLifecycleListener)

new DeviceManifestReportedListener(globalConfig).start()

val routes = versionHeaders(version) {
prometheusMetricsRoutes ~
DbHealthResource(
Expand Down
Loading