Skip to content

Commit

Permalink
Merge branch 'main' into feature/application-management
Browse files Browse the repository at this point in the history
Signed-off-by: Davide Briani <[email protected]>
  • Loading branch information
davidebriani committed Jan 14, 2025
2 parents b5c1c61 + 15e870d commit 851c92f
Show file tree
Hide file tree
Showing 60 changed files with 1,495 additions and 279 deletions.
25 changes: 23 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,38 @@ IPBASE_API_KEY=
GOOGLE_GEOLOCATION_API_KEY=
GOOGLE_GEOCODING_API_KEY=

# Wether to use SSL/TLS connection to the database, defaults to `false`.
DATABASE_ENABLE_SSL=false

# Whether to use the host machine certificates or not to verify the connection
# with the database.
# DATABASE_USE_OS_CERTS=true

# The CA certificate file to use to verify the TLS connection to the database.
# DATABASE_SSL_CACERTFILE=./example_cacert.pem

# Whether verify the SSL connection with the database or not.
# DATABASE_SSL_VERIFY=true

# The top level domain of your edgehog instance.
# In case you want to make Edgehog visible in your LAN, consider setting the variable
# to <HOST_IP>.nip.io
DOCKER_COMPOSE_EDGEHOG_BASE_DOMAIN=edgehog.localhost
# The top level domain of your astarte instance. It must be set according to your
# configuration for Astarte.
DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN=astarte.localhost

S3_ACCESS_KEY_ID=minioadmin
S3_SECRET_ACCESS_KEY=minioadmin
S3_REGION=local
S3_SCHEME=http://
S3_HOST=minio
S3_PORT=9000
S3_BUCKET=edgehog
S3_ASSET_HOST=http://minio-storage.edgehog.localhost/edgehog
S3_ASSET_HOST=http://minio-storage.${DOCKER_COMPOSE_EDGEHOG_BASE_DOMAIN}/edgehog
S3_GCP_CREDENTIALS=

SEEDS_REALM=test
SEEDS_REALM_PRIVATE_KEY_FILE=./backend/priv/repo/seeds/keys/realm_private.pem
SEEDS_TENANT_PRIVATE_KEY_FILE=./backend/priv/repo/seeds/keys/tenant_private.pem
SEEDS_ASTARTE_BASE_API_URL=http://api.astarte.localhost
SEEDS_ASTARTE_BASE_API_URL=http://api.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}
157 changes: 157 additions & 0 deletions .github/workflows/backend-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,163 @@ jobs:
if: matrix.postgres != env.postgres_version_uploading_to_coveralls
run: mix test

integration-minio:
name: Integration tests using MinIO
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
minio:
image: bitnami/minio:latest
env:
MINIO_ROOT_USER: "minioadmin"
MINIO_ROOT_PASSWORD: "minioadmin"
ports:
- 9000:9000
options: >-
--name minio
--health-interval 10s
--health-timeout 5s
--health-retries 5
--health-cmd "curl http://localhost:9000/minio/health/live"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
show-progress: false

- name: Bucket setup
run: |
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x ./mc
./mc alias set minio http://localhost:9000 minioadmin minioadmin;
./mc mb minio/edgehog;
./mc anonymous set download minio/edgehog;
- name: Install OTP and Elixir
uses: erlef/setup-beam@v1
id: beam
with:
version-file: .tool-versions
version-type: strict

- name: Cache dependencies
id: cache-deps
uses: actions/cache@v3
with:
path: |
backend/deps
backend/_build
key: "${{ runner.os }}-\
otp-${{ steps.beam.outputs.otp-version }}-\
elixir-${{ steps.beam.outputs.elixir-version }}-\
${{ hashFiles('backend/mix.lock') }}"

- name: Install and compile dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
mix deps.get --only test
mix deps.compile
- name: Test
env:
STORAGE_TYPE: s3
S3_ACCESS_KEY_ID: minioadmin
S3_SECRET_ACCESS_KEY: minioadmin
S3_REGION: local
S3_SCHEME: http://
S3_HOST: localhost
S3_PORT: 9000
S3_BUCKET: edgehog
S3_ASSET_HOST: http://localhost:9000/edgehog
run: mix test --only integration_storage

integration-azurite:
name: Integration tests using Azurite
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
azurite:
image: mcr.microsoft.com/azure-storage/azurite
ports:
- "10000:10000"
- "10001:10001"
- "10002:10002"
options: >-
--health-cmd "nc -z 127.0.0.1 10000"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
show-progress: false

- name: Storage setup
env:
AZURE_STORAGE_CONNECTION_STRING: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;"
run: |
# install az-cli
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# setup container
az storage container create --name edgehog --connection-string $AZURE_STORAGE_CONNECTION_STRING
az storage container set-permission --name edgehog --public-access blob --connection-string $AZURE_STORAGE_CONNECTION_STRING
- name: Install OTP and Elixir
uses: erlef/setup-beam@v1
id: beam
with:
version-file: .tool-versions
version-type: strict

- name: Cache dependencies
id: cache-deps
uses: actions/cache@v3
with:
path: |
backend/deps
backend/_build
key: "${{ runner.os }}-\
otp-${{ steps.beam.outputs.otp-version }}-\
elixir-${{ steps.beam.outputs.elixir-version }}-\
${{ hashFiles('backend/mix.lock') }}"

- name: Install and compile dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
mix deps.get --only test
mix deps.compile
- name: Test
env:
STORAGE_TYPE: azure
AZURE_BLOB_ENDPOINT: "http://localhost:10000/devstoreaccount1"
AZURE_CONTAINER: "edgehog"
AZURE_STORAGE_ACCOUNT_KEY: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
AZURE_STORAGE_ACCOUNT_NAME: "devstoreaccount1"
run: mix test --only integration_storage

build-docker-image:
name: Build Docker image
runs-on: ubuntu-latest
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/docs-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ jobs:
# Copy docs over to the docs repository
- name: Copy Docs, preserving Device SDK docs
run: |
export DOCS_DIRNAME="$(echo ${{ github.ref }} | sed 's,refs/heads/,,' | sed 's/main/snapshot/g' | sed 's/release-//g')"
export DOCS_DIRNAME="$(echo ${{ github.ref }} | sed 's,refs/heads/,,' | sed 's/main/snapshot/g' | sed 's/release-//g')"
rm -rf docs/$DOCS_DIRNAME
mkdir docs/$DOCS_DIRNAME
# Restore Device SDK docs. Don't fail if they're not there.
cd docs && git restore $DOCS_DIRNAME/device-sdks || true && cd ..
# Copy doc pages
cp -r edgehog/doc/doc/* docs/$DOCS_DIRNAME/
# Copy version dropdown config
Expand All @@ -128,6 +126,15 @@ jobs:
cp -r ./edgehog/backend/tenant-graphql-api docs/$DOCS_DIRNAME/
# Copy Admin REST API docs
cp -r ./edgehog/backend/admin-rest-api docs/$DOCS_DIRNAME/
# Upload as an artifact the generated HTML
- name: Upload HTML documentation
uses: actions/upload-artifact@v4
with:
name: docs_html
path: ./docs

# Commit and push changes to the docs repository
- name: Commit files
working-directory: ./docs
run: |
Expand Down
21 changes: 21 additions & 0 deletions .reuse/templates/apache.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This file is part of Edgehog.

{% for copyright_line in copyright_lines %}
{{ copyright_line }}
{% endfor %}

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

{% for expression in spdx_expressions %}
SPDX-License-Identifier: {{ expression }}
{% endfor %}
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.10] - Unreleased
### Added
- Managed OTA operations expose the update target that created them in graphql ([#356](https://github.com/edgehog-device-manager/edgehog/issues/356).
- Support for using Azure Storage as the persistence layer for asset uploads ([#233](https://github.com/edgehog-device-manager/edgehog/issues/233)).
- Ecto SSL configuration is exposed trough `DATABASE_*` environment variables (see [.env](./.env))
- Added Applications tab to Device page ([#662](https://github.com/edgehog-device-manager/edgehog/issues/662))
- Implemented a application management feature, enabling users to view and navigate through applications and their release details ([#704](https://github.com/edgehog-device-manager/edgehog/issues/704))
- **Applications page**: Displays a list of all existing applications, with navigation to individual Application pages.
Expand All @@ -15,6 +18,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `ReleaseCreate` page to enable users to create a new release for an application with fields for release Version and a list of Containers.
- Add upgrade deployment functionality with version selection ([#703](https://github.com/edgehog-device-manager/edgehog/issues/703))

## [0.9.3] - Unreleased
### Fixed
- Base Image deletion in S3 storage

## [0.9.2] - 2024-12-09
### Changed
- Update the docker-compose configuration to allow both physical and virtual devices
to connect to Edgehog, provided that the devices and the host are on the same LAN.

## [0.9.1] - 2024-10-28
### Fixed
- Allow receiving `trigger_name` key in trigger payload, which is sent by Astarte >= 1.2.0.
Expand Down
6 changes: 6 additions & 0 deletions backend/config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@

import Config

config :azurex, Azurex.Blob.Config,
api_url: "http://localhost:10000/devstoreaccount1",
default_container: "edgehog",
storage_account_name: "devstoreaccount1",
storage_account_key: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="

# Configure your database
config :edgehog, Edgehog.Repo,
username: "postgres",
Expand Down
Loading

0 comments on commit 851c92f

Please sign in to comment.