Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
sassanh committed Nov 24, 2024
1 parent 253cab9 commit b7c298f
Show file tree
Hide file tree
Showing 14 changed files with 1,136 additions and 540 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integration_delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- feature/*
tags:
- 'v*'
pull_request:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ multiline-quotes = "double"
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101", "PLR0913", "PLR0915"]
"**/reducer.py" = ["C901", "PLR0912", "PLR0915"]
"ubo_app/services/*/ubo_handle.py" = ["TCH004"]
"ubo_app/services/*/ubo_handle.py" = ["TC004"]
"ubo_app/rpc/generated/*" = [
"ARG002",
"ASYNC109",
Expand All @@ -177,7 +177,7 @@ multiline-quotes = "double"
"F401",
"RUF009",
"SLF001",
"TCH001",
"TC001",
"TID252",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
"docker": {
"_id": "baf3897a3e70f16a55485822de1b372a",
"_type": "DockerState",
"envoy_grpc": {
"_type": "ImageState",
"container_ip": null,
"docker_id": null,
"id": "envoy_grpc",
"ports": [],
"status": "not_available"
},
"home_assistant": {
"_type": "ImageState",
"container_ip": null,
Expand Down Expand Up @@ -155,6 +163,23 @@
"sub_menu": {
"_type": "HeadlessMenu",
"items": [
{
"_type": "ActionItem",
"action": "<function:open_image_menu>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󱂇",
"is_short": false,
"key": "docker:envoy_grpc",
"label": "Envoy for gRPC",
"opacity": null,
"progress": null
},
{
"_type": "ActionItem",
"action": "<function:open_image_menu>",
Expand Down Expand Up @@ -844,23 +869,6 @@
"sub_menu": {
"_type": "HeadlessMenu",
"items": [
{
"_type": "ActionItem",
"action": "<function:setup_menu_action>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "",
"is_short": false,
"key": "docker:service",
"label": "Service",
"opacity": null,
"progress": null
},
{
"_type": "SubMenuItem",
"background_color": "#68B7FF",
Expand Down Expand Up @@ -902,6 +910,40 @@
"sub_heading": "Log in to a registry:",
"title": "󱥉Docker Registries"
}
},
{
"_type": "ActionItem",
"action": "<function:_open_apps_menu>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󰣆",
"is_short": false,
"key": "docker:apps",
"label": "Apps",
"opacity": null,
"progress": null
},
{
"_type": "ActionItem",
"action": "<function:setup_menu_action>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "",
"is_short": false,
"key": "docker:service",
"label": "Service",
"opacity": null,
"progress": null
}
],
"placeholder": "No settings in this category",
Expand Down Expand Up @@ -1046,11 +1088,12 @@
"path": [],
"recorded_sequence": [],
"settings_items_priorities": {
"Apps": 2,
"Desktop": 0,
"IP Addresses": 0,
"Picovoice Settings": 0,
"RPi Connect": null,
"Registries": null,
"Registries": 3,
"SSH": 1,
"Service": 1,
"Users": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
"docker": {
"_id": "baf3897a3e70f16a55485822de1b372a",
"_type": "DockerState",
"envoy_grpc": {
"_type": "ImageState",
"container_ip": null,
"docker_id": null,
"id": "envoy_grpc",
"ports": [],
"status": "not_available"
},
"home_assistant": {
"_type": "ImageState",
"container_ip": null,
Expand Down Expand Up @@ -155,6 +163,23 @@
"sub_menu": {
"_type": "HeadlessMenu",
"items": [
{
"_type": "ActionItem",
"action": "<function:open_image_menu>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󱂇",
"is_short": false,
"key": "docker:envoy_grpc",
"label": "Envoy for gRPC",
"opacity": null,
"progress": null
},
{
"_type": "ActionItem",
"action": "<function:open_image_menu>",
Expand Down Expand Up @@ -909,23 +934,6 @@
"sub_menu": {
"_type": "HeadlessMenu",
"items": [
{
"_type": "ActionItem",
"action": "<function:setup_menu_action>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "",
"is_short": false,
"key": "docker:service",
"label": "Service",
"opacity": null,
"progress": null
},
{
"_type": "SubMenuItem",
"background_color": "#68B7FF",
Expand Down Expand Up @@ -967,6 +975,40 @@
"sub_heading": "Log in to a registry:",
"title": "󱥉Docker Registries"
}
},
{
"_type": "ActionItem",
"action": "<function:_open_apps_menu>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󰣆",
"is_short": false,
"key": "docker:apps",
"label": "Apps",
"opacity": null,
"progress": null
},
{
"_type": "ActionItem",
"action": "<function:setup_menu_action>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "",
"is_short": false,
"key": "docker:service",
"label": "Service",
"opacity": null,
"progress": null
}
],
"placeholder": "No settings in this category",
Expand Down Expand Up @@ -1111,11 +1153,12 @@
"path": [],
"recorded_sequence": [],
"settings_items_priorities": {
"Apps": 2,
"Desktop": 0,
"IP Addresses": 0,
"Picovoice Settings": 0,
"RPi Connect": null,
"Registries": null,
"Registries": 3,
"SSH": 1,
"Service": 1,
"Users": 1,
Expand Down
1 change: 0 additions & 1 deletion ubo_app/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

DEBUG_MODE_DOCKER = str_to_bool(os.environ.get('UBO_DEBUG_DOCKER', 'False')) == 1
DOCKER_CREDENTIALS_TEMPLATE = 'DOCKER_CREDENTIALS_{}'
DOCKER_PREFIX = os.environ.get('UBO_DOCKER_PREFIX', '')

CONFIG_PATH = platformdirs.user_config_path(appname='ubo', ensure_exists=True)
SECRETS_PATH = CONFIG_PATH / '.secrets.env'
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,4 @@ def setup_logging() -> None:
ubo_gui.logger.add_stdout_handler(level)


__all__ = ('logger', 'add_stdout_handler', 'add_file_handler', 'setup_logging')
__all__ = ('add_file_handler', 'add_stdout_handler', 'logger', 'setup_logging')
69 changes: 69 additions & 0 deletions ubo_app/services/080-docker/assets/envoy.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
static_resources:
listeners:
- name: grpc_listener
address:
socket_address:
address: 0.0.0.0
port_value: {{GRPC_ENVOY_LISTEN_PORT}}
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: AUTO
stat_prefix: grpc
route_config:
name: local_route
virtual_hosts:
- name: grpc_service
domains: ['*']
routes:
- match:
prefix: '/'
route:
cluster: grpc_service_cluster
timeout: 0s
typed_per_filter_config:
envoy.filters.http.cors:
'@type': type.googleapis.com/envoy.extensions.filters.http.cors.v3.CorsPolicy
allow_origin_string_match:
- safe_regex:
google_re2: {}
regex: '.*'
allow_methods: 'GET,PUT,DELETE,POST,OPTIONS'
allow_headers: 'Content-Type,Authorization,X-User-Agent,X-Grpc-Web' # Added X-Grpc-Web
expose_headers: 'Content-Type,Authorization'
allow_credentials: { value: true }
http_filters:
- name: envoy.filters.http.cors # Ensure CORS filter comes first
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors
- name: envoy.filters.http.grpc_web
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb
- name: envoy.filters.http.router
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
clusters:
- name: grpc_service_cluster
connect_timeout: 5s
type: logical_dns
lb_policy: round_robin
dns_lookup_family: V4_ONLY
load_assignment:
cluster_name: grpc_service_cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: {{GRPC_LISTEN_ADDRESS}}
port_value: {{GRPC_LISTEN_PORT}}
http2_protocol_options: {}
health_checks:
- timeout: 1s
interval: 5s
unhealthy_threshold: 2
healthy_threshold: 1
grpc_health_check: {}
no_traffic_interval: 5s
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import docker
import docker.errors
from compositions import IMAGE_IDS, IMAGES
from container import check_container, find_container
from docker_qrcode_page import DockerQRCodePage
from image_ import check_container, find_container
from images_ import IMAGE_IDS, IMAGES
from ubo_gui.menu.types import (
ActionItem,
HeadedMenu,
Expand Down Expand Up @@ -323,7 +323,7 @@ def action() -> PageWidget:
)


def image_menu_generator(image_id: str) -> Callable[[], Callable[[], HeadedMenu]]:
def composition_menu_generator(image_id: str) -> Callable[[], Callable[[], HeadedMenu]]:
"""Get the menu items for the Docker service."""
_image_menu = store.autorun(
lambda state: getattr(state.docker, image_id),
Expand All @@ -338,4 +338,6 @@ def open_image_menu() -> Callable[[], HeadedMenu]:
return open_image_menu


IMAGE_MENUS = {image_id: image_menu_generator(image_id) for image_id in IMAGE_IDS}
COMPOSITION_MENUS = {
image_id: composition_menu_generator(image_id) for image_id in IMAGE_IDS
}
Loading

0 comments on commit b7c298f

Please sign in to comment.