arkitekt-next 0.8.47__py3-none-any.whl → 0.8.49__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of arkitekt-next might be problematic. Click here for more details.

Files changed (37) hide show
  1. arkitekt_next/__blok__.py +6 -2
  2. arkitekt_next/__init__.py +4 -0
  3. arkitekt_next/apps/service/fakts_next.py +10 -12
  4. arkitekt_next/apps/service/fakts_qt.py +14 -13
  5. arkitekt_next/apps/service/herre.py +3 -1
  6. arkitekt_next/apps/types.py +0 -1
  7. arkitekt_next/base_models.py +3 -8
  8. arkitekt_next/bloks/arkitekt.py +24 -22
  9. arkitekt_next/bloks/base.py +4 -2
  10. arkitekt_next/bloks/gateway.py +18 -7
  11. arkitekt_next/bloks/internal_docker.py +1 -5
  12. arkitekt_next/bloks/kraph.py +42 -0
  13. arkitekt_next/bloks/lok.py +4 -1
  14. arkitekt_next/bloks/ollama.py +92 -0
  15. arkitekt_next/bloks/orkestrator.py +57 -19
  16. arkitekt_next/bloks/self_signed.py +98 -0
  17. arkitekt_next/bloks/services/certer.py +14 -0
  18. arkitekt_next/bloks/services/ollama.py +16 -0
  19. arkitekt_next/builders.py +0 -1
  20. arkitekt_next/cli/commands/delegate/script.py +0 -4
  21. arkitekt_next/cli/commands/gen/compile.py +0 -8
  22. arkitekt_next/cli/commands/gen/init.py +7 -14
  23. arkitekt_next/cli/commands/inspect/requirements.py +1 -4
  24. arkitekt_next/cli/commands/inspect/templates.py +1 -1
  25. arkitekt_next/cli/commands/kabinet/build.py +13 -1
  26. arkitekt_next/cli/io.py +9 -10
  27. arkitekt_next/cli/texts.py +3 -1
  28. arkitekt_next/cli/types.py +9 -3
  29. arkitekt_next/qt/magic_bar.py +1 -5
  30. arkitekt_next/qt/types.py +1 -0
  31. arkitekt_next/service_registry.py +35 -39
  32. arkitekt_next/utils.py +3 -2
  33. {arkitekt_next-0.8.47.dist-info → arkitekt_next-0.8.49.dist-info}/METADATA +6 -6
  34. {arkitekt_next-0.8.47.dist-info → arkitekt_next-0.8.49.dist-info}/RECORD +37 -32
  35. {arkitekt_next-0.8.47.dist-info → arkitekt_next-0.8.49.dist-info}/LICENSE +0 -0
  36. {arkitekt_next-0.8.47.dist-info → arkitekt_next-0.8.49.dist-info}/WHEEL +0 -0
  37. {arkitekt_next-0.8.47.dist-info → arkitekt_next-0.8.49.dist-info}/entry_points.txt +0 -0
arkitekt_next/__blok__.py CHANGED
@@ -4,7 +4,7 @@ from arkitekt_next.bloks.mikro import MikroBlok
4
4
  from arkitekt_next.bloks.fluss import FlussBlok
5
5
  from arkitekt_next.bloks.orkestrator import OrkestratorBlok
6
6
  from arkitekt_next.bloks.redis import RedisBlok
7
- from arkitekt_next.bloks.gateway import GatewayBlok
7
+ from arkitekt_next.bloks.gateway import CaddyBlok
8
8
  from arkitekt_next.bloks.livekit import LocalLiveKitBlok
9
9
  from arkitekt_next.bloks.postgres import PostgresBlok
10
10
  from arkitekt_next.bloks.minio import MinioBlok
@@ -18,6 +18,8 @@ from arkitekt_next.bloks.rekuest import RekuestBlok
18
18
  from arkitekt_next.bloks.tailscale import TailscaleBlok
19
19
  from arkitekt_next.bloks.secret import SecretBlok
20
20
  from arkitekt_next.bloks.namegen import PreformedNamesBlok
21
+ from arkitekt_next.bloks.ollama import OllamaBlok
22
+ from arkitekt_next.bloks.self_signed import SelfSignedBlok
21
23
 
22
24
 
23
25
  def get_bloks():
@@ -27,11 +29,13 @@ def get_bloks():
27
29
  MikroBlok(),
28
30
  FlussBlok(),
29
31
  RedisBlok(),
30
- GatewayBlok(),
32
+ CaddyBlok(),
31
33
  LocalLiveKitBlok(),
32
34
  PostgresBlok(),
33
35
  MinioBlok(),
36
+ OllamaBlok(),
34
37
  LokBlok(),
38
+ SelfSignedBlok(),
35
39
  KabinetBlok(),
36
40
  MountBlok(),
37
41
  ConfigBlok(),
arkitekt_next/__init__.py CHANGED
@@ -32,6 +32,8 @@ except ImportError as e:
32
32
 
33
33
  from .builders import easy, interactive
34
34
  from .apps.types import App
35
+ from fakts_next.helpers import afakt, fakt
36
+
35
37
 
36
38
  __all__ = [
37
39
  "App",
@@ -42,6 +44,8 @@ __all__ = [
42
44
  "jupy",
43
45
  "log",
44
46
  "alog",
47
+ "afakt",
48
+ "fakt",
45
49
  "progress",
46
50
  "aprogress",
47
51
  "scheduler",
@@ -37,7 +37,6 @@ def build_arkitekt_next_fakts_next(
37
37
  requested_client_kind=client_kind,
38
38
  )
39
39
 
40
-
41
40
  return ArkitektNextFaktsNext(
42
41
  grant=RemoteGrant(
43
42
  demander=demander,
@@ -45,10 +44,10 @@ def build_arkitekt_next_fakts_next(
45
44
  claimer=ClaimEndpointClaimer(),
46
45
  ),
47
46
  cache=FileCache(
48
- cache_file=f".arkitekt_next/cache/{identifier}-{version}_fakts_cache.json",
49
- hash=manifest.hash() + url,
50
- skip_cache=no_cache,
51
- ),
47
+ cache_file=f".arkitekt_next/cache/{identifier}-{version}_fakts_cache.json",
48
+ hash=manifest.hash() + url,
49
+ skip_cache=no_cache,
50
+ ),
52
51
  )
53
52
 
54
53
 
@@ -62,7 +61,6 @@ def build_arkitekt_next_redeem_fakts_next(
62
61
  identifier = manifest.identifier
63
62
  version = manifest.version
64
63
 
65
-
66
64
  return ArkitektNextFaktsNext(
67
65
  grant=RemoteGrant(
68
66
  demander=RedeemDemander(token=redeem_token, manifest=manifest),
@@ -70,9 +68,9 @@ def build_arkitekt_next_redeem_fakts_next(
70
68
  claimer=ClaimEndpointClaimer(),
71
69
  ),
72
70
  cache=FileCache(
73
- cache_file=f".arkitekt_next/cache/{identifier}-{version}_fakts_cache.json",
74
- hash=manifest.hash() + url,
75
- ),
71
+ cache_file=f".arkitekt_next/cache/{identifier}-{version}_fakts_cache.json",
72
+ hash=manifest.hash() + url,
73
+ ),
76
74
  )
77
75
 
78
76
 
@@ -91,7 +89,7 @@ def build_arkitekt_next_token_fakts_next(
91
89
  claimer=ClaimEndpointClaimer(),
92
90
  ),
93
91
  cache=FileCache(
94
- cache_file=f".arkitekt_next/cache/{identifier}-{version}_fakts_cache.json",
95
- hash=manifest.hash() + url,
96
- ),
92
+ cache_file=f".arkitekt_next/cache/{identifier}-{version}_fakts_cache.json",
93
+ hash=manifest.hash() + url,
94
+ ),
97
95
  )
@@ -12,6 +12,7 @@ from arkitekt_next.base_models import Manifest
12
12
  from qtpy import QtCore, QtWidgets
13
13
  from fakts_next.cache.qt.settings import QtSettingsCache
14
14
 
15
+
15
16
  class ArkitektNextFaktsQtRemoteGrant(RemoteGrant):
16
17
  """An ArkitektNext Fakts grant that uses Qt widgets for token and endpoint storage"""
17
18
 
@@ -38,19 +39,19 @@ def build_arkitekt_next_qt_fakts_next(
38
39
  return ArkitektNextFaktsQt(
39
40
  grant=ArkitektNextFaktsQtRemoteGrant(
40
41
  demander=DeviceCodeDemander(
41
- manifest=manifest,
42
- redirect_uri="http://127.0.0.1:6767",
43
- open_browser=True,
44
- requested_client_kind="desktop",
45
- ),
42
+ manifest=manifest,
43
+ redirect_uri="http://127.0.0.1:6767",
44
+ open_browser=True,
45
+ requested_client_kind="desktop",
46
+ ),
46
47
  discovery=QtSelectableDiscovery(
47
- widget=beacon_widget,
48
- settings=settings,
49
- allow_appending_slash=True,
50
- auto_protocols=["http", "https"],
51
- additional_beacons=["http://localhost"],
52
- ),
53
- claimer=ClaimEndpointClaimer()
48
+ widget=beacon_widget,
49
+ settings=settings,
50
+ allow_appending_slash=True,
51
+ auto_protocols=["http", "https"],
52
+ additional_beacons=["http://localhost"],
53
+ ),
54
+ claimer=ClaimEndpointClaimer(),
54
55
  ),
55
- cache=QtSettingsCache(settings=settings)
56
+ cache=QtSettingsCache(settings=settings),
56
57
  )
@@ -15,7 +15,9 @@ def build_arkitekt_next_herre_next(fakts_next: Fakts) -> ArkitektNextHerre:
15
15
  return ArkitektNextHerre(
16
16
  grant=RefreshGrant(
17
17
  grant=FaktsGrant(
18
- fakts=fakts_next, fakts_group="lok", grant_registry=ARKITEKT_GRANT_REGISTRY
18
+ fakts=fakts_next,
19
+ fakts_group="lok",
20
+ grant_registry=ARKITEKT_GRANT_REGISTRY,
19
21
  ),
20
22
  ),
21
23
  fetcher=FaktsUserFetcher(
@@ -42,7 +42,6 @@ class App(Composition):
42
42
  """Register a service"""
43
43
  self.services["rekuest"].register(*args, **kwargs)
44
44
 
45
-
46
45
  async def __aenter__(self):
47
46
  await super().__aenter__()
48
47
  for service in self.services.values():
@@ -17,8 +17,6 @@ class Requirement(BaseModel):
17
17
  """ The description is a human readable description of the requirement. Will be show to the user when asking for the requirement."""
18
18
 
19
19
 
20
-
21
-
22
20
  class Manifest(BaseModel):
23
21
  """A manifest for an app that can be installed in ArkitektNext
24
22
 
@@ -42,9 +40,7 @@ class Manifest(BaseModel):
42
40
  """ Scopes that this app should request from the user """
43
41
  logo: Optional[str]
44
42
  """ A URL to the logo of the app TODO: We should enforce this to be a http URL as local paths won't work """
45
- requirements: Optional[List[Requirement]] = Field(
46
- default_factory=list
47
- )
43
+ requirements: Optional[List[Requirement]] = Field(default_factory=list)
48
44
  """ Requirements that this app has TODO: What are the requirements? """
49
45
 
50
46
  class Config:
@@ -52,7 +48,7 @@ class Manifest(BaseModel):
52
48
 
53
49
  def hash(self):
54
50
  """Hash the manifest
55
-
51
+
56
52
  A manifest describes all the metadata of an app. This method
57
53
  hashes the manifest to create a unique hash for the current configuration of the app.
58
54
  This hash can be used to check if the app has changed since the last time it was run,
@@ -60,7 +56,7 @@ class Manifest(BaseModel):
60
56
 
61
57
  Returns:
62
58
  str: The hash of the manifest
63
-
59
+
64
60
  """
65
61
 
66
62
  unsorted_dict = self.model_dump()
@@ -76,7 +72,6 @@ class Manifest(BaseModel):
76
72
  json_dd = json.dumps(unsorted_dict, sort_keys=True)
77
73
  # Hash the JSON encoded dictionary
78
74
  return sha256(json_dd.encode()).hexdigest()
79
-
80
75
 
81
76
  @field_validator("identifier")
82
77
  def check_identifier(cls, v):
@@ -1,16 +1,19 @@
1
+ from typing import Any, Dict, Optional
2
+
1
3
  from pydantic import BaseModel
2
- from typing import Dict, Any
4
+
5
+ from arkitekt_next.bloks.kraph import KraphBlok
3
6
  from arkitekt_next.bloks.tailscale import TailscaleBlok
4
- from blok import blok, InitContext, Renderer, Panel
5
- from .livekit import LocalLiveKitBlok
6
- from .mikro import MikroBlok
7
- from .kabinet import KabinetBlok
8
- from .rekuest import RekuestBlok
7
+ from blok import InitContext, Panel, Renderer, blok
8
+
9
9
  from .fluss import FlussBlok
10
- from .gateway import GatewayBlok
11
10
  from .internal_docker import InternalDockerBlok
11
+ from .kabinet import KabinetBlok
12
+ from .livekit import LocalLiveKitBlok
13
+ from .mikro import MikroBlok
12
14
  from .orkestrator import OrkestratorBlok
13
- from typing import Optional
15
+ from .rekuest import RekuestBlok
16
+ from .ollama import OllamaBlok
14
17
 
15
18
 
16
19
  class AdminCredentials(BaseModel):
@@ -19,8 +22,20 @@ class AdminCredentials(BaseModel):
19
22
  email: str
20
23
 
21
24
 
22
- @blok("live.arkitekt")
25
+ @blok("live.arkitekt", dependencies=[
26
+ MikroBlok.as_dependency(True, True),
27
+ KabinetBlok.as_dependency(True, True),
28
+ RekuestBlok.as_dependency(True, True),
29
+ FlussBlok.as_dependency(True, True),
30
+ InternalDockerBlok.as_dependency(True, True),
31
+ OrkestratorBlok.as_dependency(True, True),
32
+ KraphBlok.as_dependency(True, False),
33
+ LocalLiveKitBlok.as_dependency(True, False),
34
+ TailscaleBlok.as_dependency(True, False),
35
+ OllamaBlok.as_dependency(True, False),
36
+ ])
23
37
  class ArkitektBlok:
38
+
24
39
  def entry(self, renderer: Renderer):
25
40
  renderer.render(
26
41
  Panel(
@@ -31,19 +46,6 @@ class ArkitektBlok:
31
46
  )
32
47
  )
33
48
 
34
- def preflight(
35
- self,
36
- gateway: GatewayBlok,
37
- livekit: Optional[LocalLiveKitBlok] = None,
38
- mikro: Optional[MikroBlok] = None,
39
- kabinet: Optional[KabinetBlok] = None,
40
- rekuest: Optional[RekuestBlok] = None,
41
- fluss: Optional[FlussBlok] = None,
42
- internal_engine: Optional[InternalDockerBlok] = None,
43
- scale: Optional[TailscaleBlok] = None,
44
- orkestrator: Optional[OrkestratorBlok] = None,
45
- ):
46
- pass
47
49
 
48
50
  def build(self, cwd):
49
51
  pass
@@ -94,7 +94,9 @@ class BaseArkitektService:
94
94
  self.get_blok_meta().service_identifier, self.get_builder()
95
95
  )
96
96
 
97
- dns_result = init.get_service(DnsService).get_dns_result()
97
+ django_secret = secret.retrieve_secret()
98
+
99
+ dns_result = dns.get_dns_result()
98
100
 
99
101
  csrf_trusted_origins = []
100
102
  for hostname in dns_result.hostnames:
@@ -108,7 +110,7 @@ class BaseArkitektService:
108
110
  "admin": asdict(admin_access),
109
111
  "debug": True,
110
112
  "hosts": ["*"],
111
- "secret_key": self.secret_key,
113
+ "secret_key": django_secret,
112
114
  },
113
115
  "redis": asdict(redis_access),
114
116
  "lok": asdict(lok_access),
@@ -1,8 +1,9 @@
1
+ from arkitekt_next.bloks.services.certer import CerterService
1
2
  from arkitekt_next.bloks.services.name import NameService
2
3
  from blok import blok, InitContext, ExecutionContext, Option
3
4
  from blok.tree import YamlFile, Repo
4
5
  from pydantic import BaseModel
5
- from typing import Dict, Any
6
+ from typing import Dict, Any, Optional
6
7
 
7
8
  from blok import blok, InitContext
8
9
  from blok.bloks.services.dns import DnsService
@@ -34,7 +35,7 @@ class ExposedPort(BaseModel):
34
35
  @blok(
35
36
  "live.arkitekt.gateway", description="A gateway for exposing services on the host"
36
37
  )
37
- class GatewayBlok:
38
+ class CaddyBlok:
38
39
  def __init__(self) -> None:
39
40
  self.exposed_hosts = {}
40
41
  self.exposed_to_hosts = {}
@@ -47,6 +48,8 @@ class GatewayBlok:
47
48
  self.https_port = 443
48
49
  self.public_ips = DEFAULT_PUBLIC_URLS
49
50
  self.public_hosts = DEFAULT_PUBLIC_HOSTS
51
+ self.cert_mount = None
52
+ self.depends_on = []
50
53
 
51
54
  def get_internal_host(self):
52
55
  return "caddy"
@@ -60,7 +63,7 @@ class GatewayBlok:
60
63
  def retrieve_gateway_network(self):
61
64
  return self.gateway_network
62
65
 
63
- def preflight(self, init: InitContext, dns: DnsService, name: NameService):
66
+ def preflight(self, init: InitContext, dns: DnsService, name: NameService, certer: Optional[CerterService] = None):
64
67
  for key, value in init.kwargs.items():
65
68
  setattr(self, key, value)
66
69
 
@@ -68,6 +71,11 @@ class GatewayBlok:
68
71
  self.public_hosts = dns.get_dns_result().hostnames
69
72
  self.gateway_network = name.retrieve_name().replace("-", "_")
70
73
 
74
+ if certer is not None:
75
+ self.cert_mount = certer.retrieve_certs_mount()
76
+ self.depends_on = certer.retrieve_depends_on()
77
+
78
+
71
79
  def build(
72
80
  self,
73
81
  context: ExecutionContext,
@@ -153,22 +161,25 @@ class GatewayBlok:
153
161
 
154
162
  context.file_tree.set_nested("configs", "Caddyfile", caddyfile)
155
163
 
156
- caddy_depends_on = []
157
- if self.with_certer:
158
- caddy_depends_on.append("certer")
164
+ caddy_depends_on = self.depends_on
159
165
 
160
166
  exposed_ports_strings = [
161
167
  f"{port.port}:{port.port}" for port in self.exposed_ports.values()
162
168
  ]
163
169
 
170
+
171
+ volumes = ["./configs/Caddyfile:/etc/caddy/Caddyfile"]
172
+ if self.cert_mount:
173
+ volumes.append(f"{self.cert_mount}:/certs")
174
+
164
175
  caddy_container = {
165
176
  "image": "caddy:latest",
166
- "volumes": ["./configs/Caddyfile:/etc/caddy/Caddyfile", "./certs:/certs"],
167
177
  "ports": [
168
178
  f"{self.http_port}:80",
169
179
  f"{self.https_port}:443",
170
180
  ]
171
181
  + exposed_ports_strings,
182
+ "volumes": volumes,
172
183
  "depends_on": caddy_depends_on,
173
184
  "networks": [self.gateway_network, "default"],
174
185
  }
@@ -17,7 +17,7 @@ class InternalDockerBlok:
17
17
  def __init__(self) -> None:
18
18
  self.host = "internal_docker"
19
19
 
20
- self.image = "jhnnsrs/deployer:0.0.8-vanilla"
20
+ self.image = "jhnnsrs/deployer:nightly"
21
21
  self.instance_id = "INTERNAL_DOCKER"
22
22
 
23
23
  def preflight(
@@ -51,10 +51,6 @@ class InternalDockerBlok:
51
51
  if self.skip:
52
52
  return
53
53
  db_service = {
54
- "labels": [
55
- "fakts.service=io.livekit.livekit",
56
- "fakts.builder=livekitio.livekit",
57
- ],
58
54
  "image": self.image,
59
55
  "command": self.command,
60
56
  "volumes": [f"{self._socket}:/var/run/docker.sock"],
@@ -0,0 +1,42 @@
1
+ import click
2
+ from pydantic import BaseModel
3
+ from typing import Dict, Any
4
+ import yaml
5
+ import secrets
6
+ from blok import blok, InitContext
7
+
8
+ from blok import blok, InitContext, ExecutionContext, Option
9
+ from blok.tree import YamlFile, Repo
10
+ from arkitekt_next.bloks.base import BaseArkitektService
11
+
12
+
13
+ class AccessCredentials(BaseModel):
14
+ password: str
15
+ username: str
16
+ host: str
17
+ port: str
18
+ db_name: str
19
+
20
+
21
+ @blok("live.arkitekt.kraph", description="Kraph allows you to interconnect structures in a graph database")
22
+ class KraphBlok(BaseArkitektService):
23
+ def __init__(self) -> None:
24
+ self.dev = False
25
+ self.host = "kraph"
26
+ self.command = "bash run-debug.sh"
27
+ self.repo = "https://github.com/arkitektio/kraph-server"
28
+ self.scopes = {
29
+ "kraph_read": "Read from the graph database",
30
+ "mikro_write": "Write image to the database",
31
+ }
32
+ self.image = "jhnnsrs/kraph:nightly"
33
+ self.mount_repo = False
34
+ self.build_repo = False
35
+ self.buckets = ["media"]
36
+ self.secret_key = secrets.token_hex(16)
37
+
38
+ def get_builder(self):
39
+ return "arkitekt.generic"
40
+
41
+ def build(self, context: ExecutionContext):
42
+ context.docker_compose.set_nested("services", self.host, self.service)
@@ -202,7 +202,10 @@ class LokBlok:
202
202
  depends_on.append(self.postgress_access.dependency)
203
203
 
204
204
  db_service = {
205
- "labels": ["fakts_next.service=live.arkitekt.lok", "fakts_next.builder=arkitekt.lok"],
205
+ "labels": [
206
+ "fakts.service=live.arkitekt.lok",
207
+ "fakts.builder=arkitekt.lok",
208
+ ],
206
209
  "depends_on": depends_on,
207
210
  "volumes": [
208
211
  "/var/run/docker.sock:/var/run/docker.sock",
@@ -0,0 +1,92 @@
1
+ from typing import Dict, Any
2
+ import secrets
3
+
4
+ from arkitekt_next.bloks.services.gateway import GatewayService
5
+ from arkitekt_next.bloks.services.ollama import OllamaService, OllamaCredentials
6
+ from blok import blok, InitContext, ExecutionContext, Option
7
+ from blok.tree import YamlFile, Repo
8
+
9
+
10
+ @blok(OllamaService, description="a self-hosted Ollama LLM server")
11
+ class OllamaBlok:
12
+ def __init__(self) -> None:
13
+ self.host = "ollama"
14
+ self.image = "ollama/ollama:latest"
15
+ self.port = 11434
16
+ self.skip = False
17
+ self.gpu = bool
18
+
19
+ def preflight(self, init: InitContext, gateway: GatewayService):
20
+ for key, value in init.kwargs.items():
21
+ setattr(self, key, value)
22
+
23
+
24
+ if self.skip:
25
+ return
26
+
27
+ gateway.expose_port_to(self.port, self.host, 11434, False)
28
+
29
+ self.initialized = True
30
+
31
+
32
+ def build(self, context: ExecutionContext):
33
+ if self.skip:
34
+ return
35
+ db_service = {
36
+ "labels": [
37
+ "fakts.service=io.ollama.ollama",
38
+ "fakts.builder=ollama.ollama",
39
+ ],
40
+ "image": self.image,
41
+ "environment": {
42
+ "OLLAMA_KEEP_ALIVE": "24h",
43
+ }
44
+ }
45
+
46
+ if self.gpu:
47
+ db_service["deploy"] = {
48
+ "resources": {
49
+ "reservations": {
50
+ "devices": [
51
+ {
52
+ "driver": "nvidia",
53
+ "count": 1,
54
+ "capabilities": ["gpu"],
55
+ }
56
+ ]
57
+ }
58
+ }
59
+ }
60
+
61
+
62
+ context.docker_compose.set_nested("services", self.host, db_service)
63
+
64
+ def get_options(self):
65
+ with_host = Option(
66
+ subcommand="host",
67
+ help="The fakts url for connection",
68
+ default=self.host,
69
+ )
70
+ with_skip = Option(
71
+ subcommand="skip",
72
+ help="The fakts_next url for connection",
73
+ default=False,
74
+ type=bool,
75
+ )
76
+ with_gpu = Option(
77
+ subcommand="gpu",
78
+ help="Whether to use a gpu",
79
+ default=False,
80
+ type=self.gpu,
81
+ )
82
+
83
+ return [
84
+ with_host,
85
+ with_skip,
86
+ with_gpu,
87
+ ]
88
+
89
+ def __str__(self) -> str:
90
+ return (
91
+ f"LiveKitBlok(host={self.host}, command={self.command}, image={self.image})"
92
+ )
@@ -1,7 +1,9 @@
1
1
  from typing import Dict, Any
2
2
  import secrets
3
+ from arkitekt_next.bloks.services.gateway import GatewayService
3
4
  from arkitekt_next.bloks.services.mount import MountService
4
5
  from blok import blok, InitContext, ExecutionContext, Option, Command
6
+ from blok.bloks.services.dns import DnsService
5
7
  from blok.bloks.services.vscode import VsCodeService
6
8
  from blok.tree import Repo, YamlFile
7
9
 
@@ -14,6 +16,8 @@ class OrkestratorBlok:
14
16
  def __init__(self) -> None:
15
17
  self.dev = False
16
18
  self.disable = True
19
+ self.host = "orkestrator"
20
+ self.path_name = "orkestrator"
17
21
  self.repo = "https://github.com/arkitektio/orkestrator-next"
18
22
  self.build_command = ["yarn"]
19
23
  self.up_command = ["yarn", "start"]
@@ -21,36 +25,58 @@ class OrkestratorBlok:
21
25
  def preflight(
22
26
  self,
23
27
  init: InitContext,
28
+ gateway: GatewayService,
24
29
  mount: MountService,
25
30
  vscode: VsCodeService | None = None,
26
31
  ):
27
32
  for key, value in init.kwargs.items():
28
33
  setattr(self, key, value)
29
34
 
30
- if self.disable and not self.dev:
35
+ if self.disable:
31
36
  return
32
- self.mount = mount.register_mount("orkestrator", Repo(self.repo))
37
+
38
+ if not self.dev:
39
+ gateway.expose(self.path_name, 80, self.host)
33
40
 
34
- if vscode is not None:
35
- vscode.register_task(
36
- "Run Orkestrator",
37
- "shell",
38
- "yarn",
39
- ["start"],
40
- {"cwd": f"{self.mount}"},
41
- )
42
- vscode.register_task(
43
- "Build Orkestrator",
44
- "shell",
45
- "yarn",
46
- [],
47
- {"cwd": f"{self.mount}"},
48
- )
49
41
 
50
- self.initialized = True
42
+ self.service = {
43
+ "image": "jhnnsrs/orkestrator_next:nightly",
44
+ "environment": {
45
+ "PATH_NAME": self.path_name,
46
+ },
47
+ }
48
+
49
+ return
50
+
51
+ else:
52
+
53
+ self.mount = mount.register_mount("orkestrator", Repo(self.repo))
54
+
55
+ if vscode is not None:
56
+ vscode.register_task(
57
+ "Run Orkestrator",
58
+ "shell",
59
+ "yarn",
60
+ ["start"],
61
+ {"cwd": f"{self.mount}"},
62
+ )
63
+ vscode.register_task(
64
+ "Build Orkestrator",
65
+ "shell",
66
+ "yarn",
67
+ [],
68
+ {"cwd": f"{self.mount}"},
69
+ )
70
+
71
+ self.initialized = True
51
72
 
52
73
  def build(self, context: ExecutionContext):
53
- if self.disable and not self.dev:
74
+ if self.disable:
75
+ return
76
+
77
+ if self.dev:
78
+ context.docker_compose.set_nested("services", self.host, self.service)
79
+
54
80
  return
55
81
 
56
82
  context.install_commands.set_nested(
@@ -77,9 +103,21 @@ class OrkestratorBlok:
77
103
  help="Should we mount orkestrator as dev?",
78
104
  default=self.dev,
79
105
  )
106
+ with_path_name = Option(
107
+ subcommand="path_name",
108
+ help="The path name for the orkestrator service",
109
+ default=self.path_name,
110
+ )
111
+ with_host = Option(
112
+ subcommand="host",
113
+ help="The host for the orkestrator service",
114
+ default=self.host,
115
+ )
80
116
 
81
117
  return [
82
118
  with_dev,
83
119
  with_repos,
120
+ with_path_name,
84
121
  with_disable,
122
+ with_host,
85
123
  ]