Begin Firecracker microVM support
This commit is contained in:
parent
fa6af127c1
commit
ed8ad1bee9
11 changed files with 290 additions and 7 deletions
14
config/apps.py
Normal file
14
config/apps.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class TussilagoConfig(AppConfig):
|
||||
"""Application config used to register startup hooks for config package."""
|
||||
|
||||
# TODO(TheLovinator): Consider creating an app with a more descriptive name for its purpose, e.g. "core" or "common". # noqa: TD003
|
||||
|
||||
name = "config"
|
||||
verbose_name = "Tussilago Config"
|
||||
|
||||
def ready(self) -> None:
|
||||
"""Register Django system checks after app loading."""
|
||||
import config.checks # pyright: ignore[reportUnusedImport] # noqa: F401, PLC0415
|
||||
59
config/checks.py
Normal file
59
config/checks.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import shutil
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.checks import Tags
|
||||
from django.core.checks import Warning as DjangoWarning
|
||||
from django.core.checks import register
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.core.checks import CheckMessage
|
||||
|
||||
REQUIRED_DEV_COMMANDS: tuple[str, ...] = (
|
||||
"uname",
|
||||
"curl",
|
||||
"basename",
|
||||
"grep",
|
||||
"sort",
|
||||
"tail",
|
||||
"wget",
|
||||
"unsquashfs",
|
||||
"ssh-keygen",
|
||||
"sudo",
|
||||
"chown",
|
||||
"truncate",
|
||||
"mkfs.ext4",
|
||||
"e2fsck",
|
||||
)
|
||||
|
||||
|
||||
@register(Tags.compatibility)
|
||||
def check_required_dev_commands(*_: object, **__: object) -> list[CheckMessage]:
|
||||
"""Warn in dev-like runtime when host tooling for init script is missing.
|
||||
|
||||
Returns:
|
||||
A list of CheckMessage objects representing any issues found.
|
||||
"""
|
||||
if not (settings.DEBUG or getattr(settings, "TESTING", False)):
|
||||
return []
|
||||
|
||||
missing_commands: list[str] = [
|
||||
command for command in REQUIRED_DEV_COMMANDS if shutil.which(command) is None
|
||||
]
|
||||
|
||||
if not missing_commands:
|
||||
return []
|
||||
|
||||
return [
|
||||
DjangoWarning(
|
||||
"Missing host commands used by get_rootfs.bash.",
|
||||
hint=(
|
||||
"Dev-only tooling missing: "
|
||||
f"{', '.join(missing_commands)}. "
|
||||
"These are required for local VM/rootfs setup during development, not production runtime."
|
||||
),
|
||||
id="tussilago.W001",
|
||||
),
|
||||
]
|
||||
|
|
@ -69,6 +69,7 @@ if DEBUG:
|
|||
INTERNAL_IPS: list[str] = ["127.0.0.1", "localhost"]
|
||||
|
||||
INSTALLED_APPS: list[str] = [
|
||||
"config.apps.TussilagoConfig",
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue