arkitekt-next 0.7.38__py3-none-any.whl → 0.7.40__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.

@@ -1,5 +1,8 @@
1
1
  import secrets
2
- from arkitekt_next.bloks.funcs import create_default_service_yaml
2
+ from arkitekt_next.bloks.funcs import (
3
+ create_default_service_dependencies,
4
+ create_default_service_yaml,
5
+ )
3
6
  from blok import blok, InitContext, ExecutionContext, Option
4
7
  from blok.tree import YamlFile, Repo
5
8
 
@@ -21,17 +24,11 @@ class FlussBlok:
21
24
  self.secret_key = secrets.token_hex(16)
22
25
  self.ensured_repos = []
23
26
 
27
+ def get_builder(self):
28
+ return "arkitekt.generic"
29
+
24
30
  def get_dependencies(self):
25
- return [
26
- "live.arkitekt.mount",
27
- "live.arkitekt.config",
28
- "live.arkitekt.gateway",
29
- "live.arkitekt.postgres",
30
- "live.arkitekt.lok",
31
- "live.arkitekt.admin",
32
- "live.arkitekt.redis",
33
- "live.arkitekt.s3",
34
- ]
31
+ return create_default_service_dependencies()
35
32
 
36
33
  def preflight(self, init: InitContext):
37
34
  for key, value in init.kwargs.items():
@@ -3,6 +3,20 @@ from blok.tree import YamlFile, Repo
3
3
  from typing import Protocol
4
4
  from blok.utils import check_protocol_compliance
5
5
  from dataclasses import asdict
6
+ from arkitekt_next.bloks.services import (
7
+ GatewayService,
8
+ DBService,
9
+ RedisService,
10
+ S3Service,
11
+ ConfigService,
12
+ MountService,
13
+ AdminService,
14
+ SecretService,
15
+ LokService,
16
+ )
17
+
18
+ from blok.bloks.services.dns import DnsService
19
+
6
20
 
7
21
  class DefaultService(Protocol):
8
22
  service_name: str
@@ -15,6 +29,23 @@ class DefaultService(Protocol):
15
29
 
16
30
  def get_identifier(self) -> str: ...
17
31
 
32
+ def get_builder(self) -> str: ...
33
+
34
+
35
+ def create_default_service_dependencies():
36
+ return [
37
+ DnsService,
38
+ GatewayService,
39
+ DBService,
40
+ RedisService,
41
+ S3Service,
42
+ ConfigService,
43
+ MountService,
44
+ AdminService,
45
+ SecretService,
46
+ LokService,
47
+ ]
48
+
18
49
 
19
50
  def create_default_service_yaml(
20
51
  init: InitContext,
@@ -22,17 +53,28 @@ def create_default_service_yaml(
22
53
  ) -> YamlFile:
23
54
  check_protocol_compliance(self, DefaultService)
24
55
  deps = init.dependencies
25
- deps["live.arkitekt.lok"].register_scopes(self.scopes)
26
56
 
27
- gateway_access = deps["live.arkitekt.gateway"].expose(self.host, 80, self.host)
57
+ init.get_service(LokService).register_scopes(self.scopes)
58
+
59
+ path_name = self.host
60
+
61
+ gateway_access = init.get_service(GatewayService).expose(path_name, 80, self.host)
62
+
63
+ postgress_access = init.get_service(DBService).register_db(self.host)
64
+ redis_access = init.get_service(RedisService).register()
65
+ lok_access = init.get_service(LokService).retrieve_credentials()
66
+ admin_access = init.get_service(AdminService).retrieve()
67
+ minio_access = init.get_service(S3Service).create_buckets(self.buckets)
68
+ lok_labels = init.get_service(LokService).retrieve_labels(
69
+ self.get_identifier(), self.get_builder()
70
+ )
71
+
72
+ dns_result = init.get_service(DnsService).get_dns_result()
28
73
 
29
- postgress_access = deps["live.arkitekt.postgres"].register_db(self.host)
30
- redis_access = deps["live.arkitekt.redis"].register()
31
- lok_access = deps["live.arkitekt.lok"].retrieve_credentials()
32
- admin_access = deps["live.arkitekt.admin"].retrieve()
33
- minio_access = deps["live.arkitekt.s3"].create_buckets(self.buckets)
34
- lok_access = deps["live.arkitekt.lok"].retrieve_credentials()
35
- lok_labels = deps["live.arkitekt.lok"].retrieve_labels(self.get_identifier())
74
+ csrf_trusted_origins = []
75
+ for hostname in dns_result.hostnames:
76
+ csrf_trusted_origins.append(f"http://{hostname}")
77
+ csrf_trusted_origins.append(f"https://{hostname}")
36
78
 
37
79
  configuration = YamlFile(
38
80
  **{
@@ -47,10 +89,12 @@ def create_default_service_yaml(
47
89
  "lok": asdict(lok_access),
48
90
  "s3": asdict(minio_access),
49
91
  "scopes": self.scopes,
92
+ "force_script_name": path_name,
93
+ "csrf_trusted_origins": csrf_trusted_origins,
50
94
  }
51
95
  )
52
96
 
53
- config_mount = deps["live.arkitekt.config"].register_config(
97
+ config_mount = init.get_service(ConfigService).register_config(
54
98
  f"{self.host}.yaml", configuration
55
99
  )
56
100
 
@@ -72,11 +116,15 @@ def create_default_service_yaml(
72
116
  }
73
117
 
74
118
  if self.mount_repo:
75
- mount = deps["live.arkitekt.mount"].register_mount(self.host, Repo(self.repo))
119
+ mount = init.get_service(MountService).register_mount(
120
+ self.host, Repo(self.repo)
121
+ )
76
122
  service["volumes"].extend([f"{mount}:/workspace"])
77
123
 
78
124
  if self.build_repo:
79
- mount = deps["live.arkitekt.mount"].register_mount(self.host, Repo(self.repo))
125
+ mount = init.get_service(MountService).register_mount(
126
+ self.host, Repo(self.repo)
127
+ )
80
128
  service["build"] = mount
81
129
  else:
82
130
  service["image"] = self.image
@@ -16,16 +16,25 @@ class ExposedHost(BaseModel):
16
16
  stip_prefix: bool = True
17
17
 
18
18
 
19
+ class ExpostedToHost(BaseModel):
20
+ port: int
21
+ host: str
22
+ to: str
23
+ tls: bool = False
24
+
25
+
19
26
  class ExposedPort(BaseModel):
20
27
  port: int
21
28
  host: str
22
29
  tls: bool = False
30
+ to: int
23
31
 
24
32
 
25
33
  @blok("live.arkitekt.gateway")
26
34
  class GatewayBlok:
27
35
  def __init__(self) -> None:
28
36
  self.exposed_hosts = {}
37
+ self.exposed_to_hosts = {}
29
38
  self.http_expose_default = None
30
39
  self.exposed_ports = {}
31
40
  self.with_certer = True
@@ -38,10 +47,10 @@ class GatewayBlok:
38
47
 
39
48
  def get_internal_host(self):
40
49
  return "caddy"
41
-
50
+
42
51
  def get_https_port(self):
43
52
  return 443
44
-
53
+
45
54
  def get_http_port(self):
46
55
  return 80
47
56
 
@@ -52,7 +61,10 @@ class GatewayBlok:
52
61
  self.public_ips = dns.get_dns_result().ip_addresses
53
62
  self.public_hosts = dns.get_dns_result().hostnames
54
63
 
55
- def build(self, context: ExecutionContext,):
64
+ def build(
65
+ self,
66
+ context: ExecutionContext,
67
+ ):
56
68
  caddyfile = """
57
69
  {
58
70
  auto_https off
@@ -64,13 +76,13 @@ class GatewayBlok:
64
76
  caddyfile += f"""
65
77
  :{port.port} {{
66
78
  tls /certs/caddy.crt /certs/caddy.key
67
- reverse_proxy {port.host}:{port.port}
79
+ reverse_proxy {port.host}:{port.to}
68
80
  }}
69
81
  """
70
82
  else:
71
83
  caddyfile += f"""
72
84
  :{port.port} {{
73
- reverse_proxy {port.host}:{port.port}
85
+ reverse_proxy {port.host}:{port.to}
74
86
  }}
75
87
  """
76
88
 
@@ -112,6 +124,15 @@ class GatewayBlok:
112
124
  }}
113
125
  """
114
126
 
127
+ for path_name, exposed_to_host in self.exposed_to_hosts.items():
128
+ caddyfile += f"""
129
+ @{path_name} path /{path_name}*
130
+ handle @{path_name} {{
131
+ rewrite * /{exposed_to_host.to}{{uri}}
132
+ reverse_proxy {exposed_to_host.host}:{exposed_to_host.port}
133
+ }}
134
+ """
135
+
115
136
  if self.http_expose_default:
116
137
  caddyfile += f"""
117
138
  handle {{
@@ -129,10 +150,18 @@ class GatewayBlok:
129
150
  if self.with_certer:
130
151
  caddy_depends_on.append("certer")
131
152
 
153
+ exposed_ports_strings = [
154
+ f"{port.port}:{port.port}" for port in self.exposed_ports.values()
155
+ ]
156
+
132
157
  caddy_container = {
133
158
  "image": "caddy:latest",
134
159
  "volumes": ["./configs/Caddyfile:/etc/caddy/Caddyfile", "./certs:/certs"],
135
- "ports": [f"{self.http_port}:80", f"{self.https_port}:443"],
160
+ "ports": [
161
+ f"{self.http_port}:80",
162
+ f"{self.https_port}:443",
163
+ ]
164
+ + exposed_ports_strings,
136
165
  "depends_on": caddy_depends_on,
137
166
  }
138
167
 
@@ -150,16 +179,24 @@ class GatewayBlok:
150
179
 
151
180
  context.docker_compose.set_nested("services", "certer", certer_container)
152
181
 
153
- def expose(self, path_name: str, port: int, host: str, strip_prefix: bool = True):
182
+ def expose(self, path_name: str, port: int, host: str, strip_prefix: bool = False):
154
183
  self.exposed_hosts[path_name] = ExposedHost(
155
184
  host=host, port=port, stip_prefix=strip_prefix
156
185
  )
157
186
 
187
+ def expose_mapped(self, path_name: str, port: int, host: str, to: str):
188
+ self.exposed_to_hosts[path_name] = ExpostedToHost(host=host, port=port, to=to)
189
+
158
190
  def expose_default(self, port: int, host: str):
159
191
  self.http_expose_default = ExposedHost(host=host, port=port, stip_prefix=False)
160
192
 
161
193
  def expose_port(self, port: int, host: str, tls: bool = False):
162
- self.exposed_ports[port] = ExposedPort(port=port, host=host, tls=tls)
194
+ self.exposed_ports[port] = ExposedPort(port=port, host=host, tls=tls, to=port)
195
+
196
+ def expose_port_to(self, port: int, host: str, to_port: int, tls: bool = False):
197
+ self.exposed_ports[port] = ExposedPort(
198
+ port=port, host=host, tls=tls, to=to_port
199
+ )
163
200
 
164
201
  def get_options(self):
165
202
  with_public_urls = Option(
@@ -1,7 +1,10 @@
1
1
  from typing import Dict, Any
2
2
  import secrets
3
3
 
4
- from arkitekt_next.bloks.funcs import create_default_service_yaml
4
+ from arkitekt_next.bloks.funcs import (
5
+ create_default_service_yaml,
6
+ create_default_service_dependencies,
7
+ )
5
8
  from blok import blok, InitContext, ExecutionContext, Option
6
9
  from blok.tree import Repo, YamlFile
7
10
 
@@ -12,7 +15,10 @@ class KabinetBlok:
12
15
  self.host = "kabinet"
13
16
  self.command = "bash run-debug.sh"
14
17
  self.repo = "https://github.com/jhnnsrs/kabinet-server"
15
- self.scopes = {"read_image": "Read image from the database"}
18
+ self.scopes = {
19
+ "kabinet_deploy": "Deploy containers",
20
+ "kabinet_add_repo": "Add repositories to the database",
21
+ }
16
22
  self.mount_repo = False
17
23
  self.build_repo = False
18
24
  self.buckets = ["media"]
@@ -20,17 +26,11 @@ class KabinetBlok:
20
26
  self.ensured_repos = []
21
27
  self.image = "jhnnsrs/kabinet:next"
22
28
 
29
+ def get_builder(self):
30
+ return "arkitekt.generic"
31
+
23
32
  def get_dependencies(self):
24
- return [
25
- "live.arkitekt.mount",
26
- "live.arkitekt.config",
27
- "live.arkitekt.gateway",
28
- "live.arkitekt.postgres",
29
- "live.arkitekt.lok",
30
- "live.arkitekt.admin",
31
- "live.arkitekt.redis",
32
- "live.arkitekt.s3",
33
- ]
33
+ return create_default_service_dependencies()
34
34
 
35
35
  def preflight(self, init: InitContext):
36
36
  for key, value in init.kwargs.items():
@@ -57,7 +57,7 @@ class KabinetBlok:
57
57
  mount_repo = Option(
58
58
  subcommand="mount_repo",
59
59
  help="Should we mount the repo into the container?",
60
- type=bool,
60
+ type=bool,
61
61
  default=self.mount_repo,
62
62
  )
63
63
  build_repo = Option(
@@ -22,7 +22,6 @@ class LocalLiveKitBlok:
22
22
  self.api_secret = "secret"
23
23
  self.skip = False
24
24
 
25
-
26
25
  def preflight(self, init: InitContext, gateway: GatewayService):
27
26
  for key, value in init.kwargs.items():
28
27
  setattr(self, key, value)
@@ -33,16 +32,18 @@ class LocalLiveKitBlok:
33
32
  return
34
33
 
35
34
  gateway.expose_port(7880, self.host, True)
36
- gateway.expose_port(7881, self.host, True)
35
+ gateway.expose_port_to(7882, self.host, 7880, False)
37
36
 
38
37
  self.initialized = True
39
38
 
40
39
  def retrieve_access(self):
41
- return LivekitCredentials(**{
42
- "api_key": self.api_key,
43
- "api_secret": self.api_secret,
44
- "api_url": f"http://{self.host}:7880",
45
- })
40
+ return LivekitCredentials(
41
+ **{
42
+ "api_key": self.api_key,
43
+ "api_secret": self.api_secret,
44
+ "api_url": f"http://{self.host}:7880",
45
+ }
46
+ )
46
47
 
47
48
  def build(self, context: ExecutionContext):
48
49
  if self.skip:
@@ -55,18 +56,14 @@ class LocalLiveKitBlok:
55
56
  "image": self.image,
56
57
  "command": self.command,
57
58
  "ports": [
58
- f"{self.port_range[0]}-{self.port_range[1]}:{self.port_range[0]}-{self.port_range[1]}"
59
+ f"{self.port_range[0]}-{self.port_range[1]}:{self.port_range[0]}-{self.port_range[1]}",
60
+ "7881:7881",
59
61
  ],
60
62
  }
61
63
 
62
64
  context.docker_compose.set_nested("services", self.host, db_service)
63
65
 
64
66
  def get_options(self):
65
- with_command = Option(
66
- subcommand="command",
67
- help="The fakts url for connection",
68
- default=self.command,
69
- )
70
67
  with_host = Option(
71
68
  subcommand="host",
72
69
  help="The fakts url for connection",
@@ -77,12 +74,10 @@ class LocalLiveKitBlok:
77
74
  help="The fakts url for connection",
78
75
  default=False,
79
76
  type=bool,
80
-
81
77
  )
82
78
 
83
79
  return [
84
80
  with_host,
85
- with_command,
86
81
  with_skip,
87
82
  ]
88
83
 
@@ -17,11 +17,11 @@ from dataclasses import asdict
17
17
 
18
18
  from arkitekt_next.bloks.services.redis import RedisService
19
19
  from blok import blok, InitContext, ExecutionContext, Option
20
+ from blok.bloks.services.dns import DnsService
20
21
  from blok.tree import YamlFile, Repo
21
22
  from blok import blok, InitContext
22
23
 
23
24
 
24
-
25
25
  DEFAULT_ARKITEKT_URL = "http://localhost:8000"
26
26
 
27
27
 
@@ -132,35 +132,28 @@ class LokBlok:
132
132
  self.tokens = []
133
133
  self.groups = []
134
134
  self.secret_key = secrets.token_hex(16)
135
- self.scopes = {"hallo": "welt"}
135
+ self.scopes = {
136
+ "openid": "The open id connect scope",
137
+ "read": "A generic read access",
138
+ "write": "A generic write access",
139
+ }
136
140
  self.key = None
137
141
  self.deployment_name = "default"
138
- self.base_routes = [
139
- "ht",
140
- "o",
141
- "graphql",
142
- ".well-known",
143
- "f",
144
- "admin",
145
- "static",
146
- "accounts",
147
- ]
148
142
  self.token_expiry_seconds = 700000
149
143
  self.preformed_redeem_tokens = [secrets.token_hex(16) for i in range(80)]
150
144
  self.registered_tokens = {}
151
145
 
152
-
153
146
  def retrieve_credentials(self) -> LokCredentials:
154
147
  return LokCredentials(
155
148
  public_key=self.public_key, key_type="RS256", issuer="lok"
156
149
  )
157
150
 
158
- def retrieve_labels(self, service_name: str) -> list[str]:
151
+ def retrieve_labels(self, service_name: str, builder_name: str) -> list[str]:
159
152
  return [
160
153
  f"fakts.service={service_name}",
161
- f"fakts.builder=arkitekt.{service_name}",
154
+ f"fakts.builder={builder_name}",
162
155
  ]
163
-
156
+
164
157
  def retrieve_token(self, user: str = "admin") -> str:
165
158
  new_token = self.secret_blok.retrieve_secret()
166
159
  self.registered_tokens[user] = new_token
@@ -170,25 +163,32 @@ class LokBlok:
170
163
  def register_scopes(self, scopes_dict: Dict[str, str]) -> LokCredentials:
171
164
  self.scopes = self.scopes | scopes_dict
172
165
 
173
- def preflight(self, init: InitContext, gateway: GatewayService, db: DBService, redis: RedisService, admin: AdminService, secrets: SecretBlok, livekit: LivekitService, scopes: list[Dict[str, str]]):
166
+ def preflight(
167
+ self,
168
+ init: InitContext,
169
+ gateway: GatewayService,
170
+ db: DBService,
171
+ redis: RedisService,
172
+ admin: AdminService,
173
+ secrets: SecretBlok,
174
+ livekit: LivekitService,
175
+ dns: DnsService,
176
+ ):
174
177
  for key, value in init.kwargs.items():
175
178
  setattr(self, key, value)
176
179
 
177
180
  assert self.public_key, "Public key is required"
178
181
  assert self.private_key, "Private key is required"
179
182
 
180
- self.scopes = {scope["scope"]: scope["description"] for scope in scopes}
181
-
182
- for i in self.base_routes:
183
- gateway.expose(
184
- i, 80, self.host, strip_prefix=False
185
- )
183
+ gateway.expose("lok", 80, self.host, strip_prefix=False)
184
+ gateway.expose_mapped(".well-known", 80, self.host, "lok")
186
185
 
187
186
  self.secret_blok = secrets
188
187
  self.postgress_access = db.register_db(self.host)
189
188
  self.redis_access = redis.register()
190
189
  self.admin_access = admin.retrieve()
191
190
  self.local_access = livekit.retrieve_access()
191
+ self.dns_result = dns.get_dns_result()
192
192
  self.initialized = True
193
193
 
194
194
  def build(self, context: ExecutionContext):
@@ -222,6 +222,12 @@ class LokBlok:
222
222
 
223
223
  db_service["command"] = self.command
224
224
 
225
+ trusted_origins = []
226
+
227
+ for i in self.dns_result.hostnames:
228
+ trusted_origins.append(f"http://{i}")
229
+ trusted_origins.append(f"https://{i}")
230
+
225
231
  configuration = YamlFile(
226
232
  **{
227
233
  "db": asdict(self.postgress_access),
@@ -232,17 +238,22 @@ class LokBlok:
232
238
  "hosts": ["*"],
233
239
  "secret_key": self.secret_key,
234
240
  },
235
- "redis": asdict(self.redis_access),
241
+ "redis": asdict(self.redis_access),
236
242
  "lok": asdict(self.retrieve_credentials()),
237
243
  "private_key": self.private_key,
238
244
  "public_key": self.public_key,
239
245
  "scopes": self.scopes,
240
- "redeem_tokens": [token for token in self.registered_tokens],
246
+ "redeem_tokens": [
247
+ {"user": name, "token": token}
248
+ for name, token in self.registered_tokens.items()
249
+ ],
241
250
  "groups": [group for group in self.groups],
242
251
  "deployment": {"name": self.deployment_name},
243
252
  "livekit": asdict(self.local_access),
244
253
  "token_expire_seconds": self.token_expiry_seconds,
245
254
  "apps": [],
255
+ "force_script_name": "lok",
256
+ "csrf_trusted_origins": trusted_origins,
246
257
  }
247
258
  )
248
259
 
@@ -292,13 +303,6 @@ class LokBlok:
292
303
  type=GROUP,
293
304
  show_default=True,
294
305
  )
295
- with_scopes = Option(
296
- subcommand="scopes",
297
- help="Additional scopes that should be created (normally handled by the bloks)",
298
- default=[f"{key}:{value}" for key, value in self.scopes.items()],
299
- multiple=True,
300
- type=SCOPE,
301
- )
302
306
  with_repo = Option(
303
307
  subcommand="with_repo",
304
308
  help="Which repo should we use when building the service? Only active if build_repo or mount_repo is active",
@@ -314,7 +318,7 @@ class LokBlok:
314
318
  mount_repo = Option(
315
319
  subcommand="mount_repo",
316
320
  help="The fakts url for connection",
317
- type=bool,
321
+ type=bool,
318
322
  default=False,
319
323
  )
320
324
  build_repo = Option(
@@ -361,7 +365,6 @@ class LokBlok:
361
365
  with_host,
362
366
  with_private_key,
363
367
  with_public_key,
364
- with_scopes,
365
368
  with_secret_key,
366
369
  ]
367
370
 
@@ -7,7 +7,11 @@ from blok import blok, InitContext
7
7
 
8
8
  from blok import blok, InitContext, ExecutionContext, Option
9
9
  from blok.tree import YamlFile, Repo
10
- from arkitekt_next.bloks.funcs import create_default_service_yaml
10
+ from arkitekt_next.bloks.funcs import (
11
+ create_default_service_dependencies,
12
+ create_default_service_yaml,
13
+ DefaultService,
14
+ )
11
15
 
12
16
 
13
17
  class AccessCredentials(BaseModel):
@@ -24,7 +28,10 @@ class MikroBlok:
24
28
  self.host = "mikro"
25
29
  self.command = "bash run-debug.sh"
26
30
  self.repo = "https://github.com/arkitektio/mikro-server-next"
27
- self.scopes = {"read_image": "Read image from the database"}
31
+ self.scopes = {
32
+ "mikro_read": "Read image from the database",
33
+ "mikro_write": "Write image to the database",
34
+ }
28
35
  self.image = "jhnnsrs/mikro:next"
29
36
  self.mount_repo = False
30
37
  self.build_repo = False
@@ -32,16 +39,10 @@ class MikroBlok:
32
39
  self.secret_key = secrets.token_hex(16)
33
40
 
34
41
  def get_dependencies(self):
35
- return [
36
- "live.arkitekt.mount",
37
- "live.arkitekt.config",
38
- "live.arkitekt.gateway",
39
- "live.arkitekt.postgres",
40
- "live.arkitekt.lok",
41
- "live.arkitekt.admin",
42
- "live.arkitekt.redis",
43
- "live.arkitekt.s3",
44
- ]
42
+ return create_default_service_dependencies()
43
+
44
+ def get_builder(self):
45
+ return "arkitekt.generic"
45
46
 
46
47
  def preflight(self, init: InitContext):
47
48
  for key, value in init.kwargs.items():
@@ -54,8 +54,6 @@ class MinioBlok:
54
54
  self.preformed_access_keys = [secrets.token_hex(16) for i in range(100)]
55
55
  self.preformed_secret_keys = [secrets.token_hex(16) for i in range(100)]
56
56
 
57
-
58
-
59
57
  def create_buckets(self, buckets: list[str]) -> S3Credentials:
60
58
  new_access_key = self.secret_service.retrieve_secret()
61
59
  new_secret_key = self.secret_service.retrieve_secret()
@@ -63,11 +61,14 @@ class MinioBlok:
63
61
  bucket_map = {}
64
62
 
65
63
  for bucket in buckets:
66
- bucket_map[bucket] = self.name_service.retrieve_name()
64
+ bucket_name = self.name_service.retrieve_name()
65
+ bucket_map[bucket] = bucket_name
66
+ self.gateway_service.expose(bucket_name, 9000, self.host)
67
67
 
68
68
  self.buckets.extend(bucket_map.values())
69
69
 
70
70
  creds = S3Credentials(
71
+ name=self.name_service.retrieve_name(),
71
72
  access_key=new_access_key,
72
73
  buckets=bucket_map,
73
74
  host=self.host,
@@ -81,17 +82,22 @@ class MinioBlok:
81
82
 
82
83
  return creds
83
84
 
84
- def preflight(self, init: InitContext, secret: SecretService, name: NameService, gateway: GatewayService, config: ConfigService):
85
+ def preflight(
86
+ self,
87
+ init: InitContext,
88
+ secret: SecretService,
89
+ name: NameService,
90
+ gateway: GatewayService,
91
+ config: ConfigService,
92
+ ):
85
93
  for key, value in init.kwargs.items():
86
94
  setattr(self, key, value)
87
95
 
88
- gateway.expose_default(9000, self.host)
89
96
  self.secret_service = secret
90
97
  self.name_service = name
98
+ self.gateway_service = gateway
91
99
 
92
- self.config_path = config.get_path(
93
- self.host + ".yaml"
94
- )
100
+ self.config_path = config.get_path(self.host + ".yaml")
95
101
 
96
102
  def build(self, context: ExecutionContext):
97
103
  minio_service_init = {
@@ -103,7 +109,7 @@ class MinioBlok:
103
109
  "environment": {
104
110
  "MINIO_ROOT_PASSWORD": self.password,
105
111
  "MINIO_ROOT_USER": self.username,
106
- "MINIO_HOST": f"{self.host}:9000",
112
+ "MINIO_HOST": f"http://{self.host}:9000",
107
113
  },
108
114
  "image": self.init_image,
109
115
  "volumes": [f"{self.config_path}:/workspace/config.yaml"],
@@ -128,7 +134,19 @@ class MinioBlok:
128
134
  )
129
135
 
130
136
  context.file_tree.set_nested(
131
- *self.config_path.split("/"), YamlFile(**{"buckets": list(self.buckets)})
137
+ *self.config_path.split("/"),
138
+ YamlFile(
139
+ buckets=[{"name": i} for i in self.buckets],
140
+ users=[
141
+ {
142
+ "access_key": i.access_key,
143
+ "secret_key": i.secret_key,
144
+ "name": i.name,
145
+ "policies": ["readwrite"],
146
+ }
147
+ for i in self.registered_clients
148
+ ],
149
+ ),
132
150
  )
133
151
 
134
152
  def get_options(self):
@@ -1,7 +1,10 @@
1
1
  from typing import Dict, Any
2
2
  import secrets
3
3
 
4
- from arkitekt_next.bloks.funcs import create_default_service_yaml
4
+ from arkitekt_next.bloks.funcs import (
5
+ create_default_service_dependencies,
6
+ create_default_service_yaml,
7
+ )
5
8
  from blok import blok, InitContext, ExecutionContext, Option
6
9
  from blok.tree import Repo, YamlFile
7
10
 
@@ -12,7 +15,10 @@ class RekuestBlok:
12
15
  self.host = "rekuest"
13
16
  self.command = "bash run-debug.sh"
14
17
  self.repo = "https://github.com/jhnnsrs/rekuest-server_next"
15
- self.scopes = {"read_image": "Read image from the database"}
18
+ self.scopes = {
19
+ "rekuest_agent": "Act as an agent",
20
+ "rekuest_call": "Call other apps with rekuest",
21
+ }
16
22
  self.mount_repo = False
17
23
  self.build_repo = False
18
24
  self.buckets = ["media"]
@@ -21,16 +27,10 @@ class RekuestBlok:
21
27
  self.image = "jhnnsrs/rekuest:next"
22
28
 
23
29
  def get_dependencies(self):
24
- return [
25
- "live.arkitekt.mount",
26
- "live.arkitekt.config",
27
- "live.arkitekt.gateway",
28
- "live.arkitekt.postgres",
29
- "live.arkitekt.lok",
30
- "live.arkitekt.admin",
31
- "live.arkitekt.redis",
32
- "live.arkitekt.s3",
33
- ]
30
+ return create_default_service_dependencies()
31
+
32
+ def get_builder(self):
33
+ return "arkitekt.rekuest"
34
34
 
35
35
  def preflight(self, init: InitContext):
36
36
  for key, value in init.kwargs.items():
@@ -65,7 +65,7 @@ class RekuestBlok:
65
65
  build_repo = Option(
66
66
  subcommand="build_repo",
67
67
  help="Should we build the container from the repo?",
68
- type=bool,
68
+ type=bool,
69
69
  default=self.build_repo,
70
70
  )
71
71
  with_host = Option(
@@ -0,0 +1,27 @@
1
+ from .admin import AdminService
2
+ from .lok import LokService
3
+ from .db import DBService
4
+ from .redis import RedisService
5
+ from .s3 import S3Service
6
+ from .config import ConfigService
7
+ from .mount import MountService
8
+ from .secret import SecretService
9
+ from .gateway import GatewayService
10
+ from .livekit import LivekitService
11
+
12
+
13
+ __all__ = [
14
+ "AdminService",
15
+ "LokService",
16
+ "DBService",
17
+ "RedisService",
18
+ "S3Service",
19
+ "ConfigService",
20
+ "MountService",
21
+ "SecretService",
22
+ "GatewayService",
23
+ "LivekitService",
24
+ "MountService",
25
+ "ConfigService",
26
+ "SecretService",
27
+ ]
@@ -8,23 +8,20 @@ from blok import blok, InitContext, service
8
8
 
9
9
  @blok("live.arkitekt.gateway")
10
10
  class GatewayService(Protocol):
11
+ def expose(
12
+ self, path_name: str, port: int, host: str, strip_prefix: bool = True
13
+ ): ...
11
14
 
12
- def expose(self, path_name: str, port: int, host: str, strip_prefix: bool = True):
13
- ...
15
+ def expose_mapped(self, path_name: str, port: int, host: str, to_name: str): ...
14
16
 
15
- def expose_default(self, port: int, host: str):
16
- ...
17
+ def expose_default(self, port: int, host: str): ...
17
18
 
18
- def expose_port(self, port: int, host: str, tls: bool = False):
19
- ...
19
+ def expose_port(self, port: int, host: str, tls: bool = False): ...
20
20
 
21
- def get_internal_host(self):
22
- ...
21
+ def expose_port_to(self, port: int, host: str, to_port: str, tls: bool = False): ...
23
22
 
23
+ def get_internal_host(self): ...
24
24
 
25
- def get_https_port(self):
26
- ...
25
+ def get_https_port(self): ...
27
26
 
28
- def get_http_port(self):
29
- ...
30
-
27
+ def get_http_port(self): ...
@@ -1,10 +1,9 @@
1
-
2
-
3
1
  from typing import Dict, Any, Protocol
4
2
  from blok import blok, InitContext, Option
5
3
  from blok import service
6
4
  from dataclasses import dataclass
7
5
 
6
+
8
7
  @dataclass
9
8
  class LokCredentials:
10
9
  issuer: str
@@ -14,14 +13,8 @@ class LokCredentials:
14
13
 
15
14
  @service("live.arkitekt.lok")
16
15
  class LokService(Protocol):
16
+ def retrieve_credentials(self) -> LokCredentials: ...
17
17
 
18
- def retrieve_credentials(self) -> LokCredentials:
19
- ...
20
-
21
- def retrieve_labels(self, service_name: str) -> list[str]:
22
- ...
23
-
24
- def register_scopes(self, scopes_dict: Dict[str, str]):
25
- ...
26
-
18
+ def retrieve_labels(self, service_name: str, builder_name: str) -> list[str]: ...
27
19
 
20
+ def register_scopes(self, scopes_dict: Dict[str, str]): ...
@@ -6,6 +6,7 @@ from typing import Dict, Any, Protocol, Optional
6
6
  from blok import blok, InitContext, service
7
7
  from dataclasses import dataclass
8
8
 
9
+
9
10
  @dataclass
10
11
  class RedisConnection:
11
12
  host: str
@@ -13,16 +14,6 @@ class RedisConnection:
13
14
  dependency: Optional[str] = None
14
15
 
15
16
 
16
-
17
17
  @blok("live.arkitekt.redis")
18
18
  class RedisService(Protocol):
19
-
20
-
21
- def register(self) -> RedisConnection:
22
- return RedisConnection(
23
- host=self.host,
24
- port=self.port,
25
- dependency=self.host if not self.skip else None,
26
- )
27
-
28
-
19
+ def register(self) -> RedisConnection: ...
@@ -1,12 +1,12 @@
1
-
2
-
3
1
  from typing import Dict, Any, List, Protocol, Optional
4
2
  from blok import blok, InitContext, Option
5
3
  from blok import service
6
4
  from dataclasses import dataclass
7
5
 
6
+
8
7
  @dataclass
9
8
  class S3Credentials:
9
+ name: str
10
10
  access_key: str
11
11
  buckets: Dict[str, str]
12
12
  host: str
@@ -18,9 +18,4 @@ class S3Credentials:
18
18
 
19
19
  @service("live.arkitekt.s3")
20
20
  class S3Service(Protocol):
21
-
22
- def create_buckets(self, buckets: List[str]) -> S3Credentials:
23
- ...
24
-
25
-
26
-
21
+ def create_buckets(self, buckets: List[str]) -> S3Credentials: ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arkitekt-next
3
- Version: 0.7.38
3
+ Version: 0.7.40
4
4
  Summary: client for the arkitekt_next platform
5
5
  License: MIT
6
6
  Author: jhnnsrs
@@ -14,25 +14,25 @@ Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Provides-Extra: all
17
+ Provides-Extra: blok
17
18
  Provides-Extra: cli
18
- Provides-Extra: server
19
- Requires-Dist: blok (>=0.0.8) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "all" or extra == "server")
20
- Requires-Dist: cryptography (>=40.0.8) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "all" or extra == "server")
19
+ Requires-Dist: blok (>=0.0.9) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "blok")
20
+ Requires-Dist: cryptography (>=40.0.8) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "blok")
21
21
  Requires-Dist: dokker (>=0.1.21)
22
22
  Requires-Dist: fakts (>=0.5.0)
23
- Requires-Dist: fluss-next (>=0.1.69) ; extra == "all"
23
+ Requires-Dist: fluss-next (>=0.1.70) ; extra == "all"
24
24
  Requires-Dist: herre (>=0.4.3)
25
- Requires-Dist: kabinet (>=0.1.7) ; (python_version >= "3.9" and python_version < "4.0") and (extra == "all")
25
+ Requires-Dist: kabinet (>=0.1.8) ; (python_version >= "3.9" and python_version < "4.0") and (extra == "all")
26
26
  Requires-Dist: koil (>=0.3.6)
27
- Requires-Dist: mikro-next (>=0.1.24) ; (python_version >= "3.10" and python_version < "4.0") and (extra == "all")
28
- Requires-Dist: namegenerator (>=1.0.6) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "all" or extra == "server")
29
- Requires-Dist: netifaces (>=0.11.0) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "all" or extra == "server")
27
+ Requires-Dist: mikro-next (>=0.1.25) ; (python_version >= "3.10" and python_version < "4.0") and (extra == "all")
28
+ Requires-Dist: namegenerator (>=1.0.6) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "blok")
29
+ Requires-Dist: netifaces (>=0.11.0) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "blok")
30
30
  Requires-Dist: reaktion-next (>=0.1.59) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "all")
31
- Requires-Dist: rekuest-next (>=0.2.13) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "cli" or extra == "all")
31
+ Requires-Dist: rekuest-next (>=0.2.14) ; (python_version >= "3.8" and python_version < "4.0") and (extra == "cli" or extra == "all")
32
32
  Requires-Dist: rich-click (>=1.6.1) ; extra == "cli" or extra == "all"
33
33
  Requires-Dist: semver (>=3.0.1) ; extra == "cli" or extra == "all"
34
34
  Requires-Dist: turms (>=0.5.0) ; (python_version >= "3.9" and python_version < "4.0") and (extra == "cli" or extra == "all")
35
- Requires-Dist: unlok-next (>=0.1.64) ; python_version >= "3.8" and python_version < "4.0"
35
+ Requires-Dist: unlok-next (>=0.1.65) ; python_version >= "3.8" and python_version < "4.0"
36
36
  Requires-Dist: watchfiles (>=0.18.1) ; extra == "cli" or extra == "all"
37
37
  Description-Content-Type: text/markdown
38
38
 
@@ -16,32 +16,32 @@ arkitekt_next/bloks/__init__.py,sha256=gXny6-WJ3alV1__xveI_0wcvgDuglR1WB7v7-8h1O
16
16
  arkitekt_next/bloks/admin.py,sha256=MlUQUYCHxCWtSD75mVHgs3DcDa0s8_D6_AIBslnYjZw,1300
17
17
  arkitekt_next/bloks/arkitekt.py,sha256=1h2fyJK-TcuiOVFyE7iO2S1jwLv52APsQpfxddmHWjk,1263
18
18
  arkitekt_next/bloks/config.py,sha256=SqJg9kB0AQ62b_WpIKgJ8Jpcqpc-AKN7gdEj87O-UGY,1268
19
- arkitekt_next/bloks/fluss.py,sha256=WXsE1M-0vDCVj5Fxi6MvHcPQiezkJPQ5GvUq93t4nt8,2814
20
- arkitekt_next/bloks/funcs.py,sha256=6QImH3eOSd6KXd8XfaulexAzy16A_J8GJi58Q18MQms,2641
21
- arkitekt_next/bloks/gateway.py,sha256=1seqZkU0yMai60JB0Rz1J--uNv21osiTVZVSjlusRjE,5184
19
+ arkitekt_next/bloks/fluss.py,sha256=07l8mdS35JyuEthv4xH9qpCCNepMkJGm02PxEakQBD0,2671
20
+ arkitekt_next/bloks/funcs.py,sha256=z1b58hENZfTfXYEqg_pP_2hm3ogDyu9_Ek8wk1P5XkA,3633
21
+ arkitekt_next/bloks/gateway.py,sha256=a1suHpSbdvu-KnkExYtRAxizwHhQXQhvoil8g24sLG4,6234
22
22
  arkitekt_next/bloks/internal_docker.py,sha256=q9gPPtU1m0-0eeqF4zxtCELp4lF8TVZSJi1qVwnSWus,2421
23
- arkitekt_next/bloks/kabinet.py,sha256=gvoXeA4W6Aoc26wWK8nN9i6Gj5bxYE3by28MTLtJNyM,2995
24
- arkitekt_next/bloks/livekit.py,sha256=8_7YgsTnV3zZ_RonZZaOHyKkCoiKqLVv6-h74yGlB0A,2681
25
- arkitekt_next/bloks/lok.py,sha256=x1bu2b03sARVF4mxSBJzzdyCNJVx0feyhCz1qWjRRN4,12466
26
- arkitekt_next/bloks/mikro.py,sha256=x58fbw6INDfiRYwMRFYm8RIygmXoYj28gtn7mS6bEro,2814
27
- arkitekt_next/bloks/minio.py,sha256=6Mi1flePiwIA-durcRsQSE3OtCYwGzVLTJI7jHMrlgk,4918
23
+ arkitekt_next/bloks/kabinet.py,sha256=RMetXRKFRO9z_eGPXyzGCHTo9HJlcPaew2lfCltGoMg,2937
24
+ arkitekt_next/bloks/livekit.py,sha256=yhre3PkIQwKGdGPFC-DhTID3rIbRQMts_UsAX9tw6-A,2561
25
+ arkitekt_next/bloks/lok.py,sha256=MGXKg1NRvydA-wlncBQJwO2GfaQLl2shVo0g45r9J_8,12532
26
+ arkitekt_next/bloks/mikro.py,sha256=vNM9K7I3AK2G0WooaMQl7U8-_TN96P2YUfblqAMsvdI,2772
27
+ arkitekt_next/bloks/minio.py,sha256=k7t1J46lO3eaBO9KdP7iYF--Go-m25dEmOwisbbOoVQ,5496
28
28
  arkitekt_next/bloks/mount.py,sha256=d14w7bMiaWbl5wgvanh4PwfIqEYsDEsw91360xfX0fU,1031
29
29
  arkitekt_next/bloks/namegen.py,sha256=0k4PYya5J4EQyt3XZ3UKhDlO_k29pmUEQSaklZGN8MA,1035
30
30
  arkitekt_next/bloks/postgres.py,sha256=FRUF2fobUlU6OmK1VC7aN_WuX1NctLmZhzJJA1uOOeY,2773
31
31
  arkitekt_next/bloks/redis.py,sha256=_ddmcD3WwX7VA7zzzQ7-yjSM7f4reV0C8Pl70s7R2k8,2130
32
- arkitekt_next/bloks/rekuest.py,sha256=_Er2mgiH0bQS62PWlGDolulpLkeYrQJ8TvQ2jqf6aOU,3044
32
+ arkitekt_next/bloks/rekuest.py,sha256=OgX_OeVeGVK-pSL3S8cocUWsYX929Yv5o9NuEvkwJr0,2975
33
33
  arkitekt_next/bloks/secret.py,sha256=P4Z56FhcgVD0KbokhcMNAXwDjo_86rI99nWh3gUGXSQ,1014
34
- arkitekt_next/bloks/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
+ arkitekt_next/bloks/services/__init__.py,sha256=i9vGNd1lFBem3O2PblTouRzFVQkdwOYoUmqqU43dIWQ,592
35
35
  arkitekt_next/bloks/services/admin.py,sha256=OXMAHph5lABNPFsXm8aboWffJ7CzSSNvke7xpmj9raI,463
36
36
  arkitekt_next/bloks/services/config.py,sha256=BLtbKXRRWmuZxvaaksuxt9EiDcazYwKL_IUIRhXBin8,393
37
37
  arkitekt_next/bloks/services/db.py,sha256=jMO751KJYjNmvHD0tOTWgkkemwTXc6mLHAge_i68JSA,600
38
- arkitekt_next/bloks/services/gateway.py,sha256=YUpz7qkqfOTXS74gU0C7s3o7MHe_9xQJHQLWg7aGhyc,662
38
+ arkitekt_next/bloks/services/gateway.py,sha256=9dDv2aWCErkZ9JreqHdKax63_Imbc2EnWhpeScLnI7Q,799
39
39
  arkitekt_next/bloks/services/livekit.py,sha256=5u-GThgKsgXiiobEL4arm3JJOgNTZae15Q-75i-4D8g,366
40
- arkitekt_next/bloks/services/lok.py,sha256=OYC5BVr3MxeP8AuARO56UFL4490Yygcscdm5DQq-fVs,517
40
+ arkitekt_next/bloks/services/lok.py,sha256=fzOGum0VmcVaONUhTv4jHYky4WrFq2ygDAYJjBv2vAI,500
41
41
  arkitekt_next/bloks/services/mount.py,sha256=MDlwHl5cTfBO8IgkofuFjQBbfIMKDm_R9suWkiyVG48,289
42
42
  arkitekt_next/bloks/services/name.py,sha256=ZMDlZwnSaoIUj7STlpFo32nHKMuOibKzetYWSjh-t-c,254
43
- arkitekt_next/bloks/services/redis.py,sha256=d5cSk2v6A6CvYULocwd2Cnx9RkHKYHmZT1mZmZQNKgs,633
44
- arkitekt_next/bloks/services/s3.py,sha256=njXlLzUssj46w90bMdqO-7HSAVQtZHH2r1yVNlR-mfU,492
43
+ arkitekt_next/bloks/services/redis.py,sha256=hC8cKXkGzwrY183fI-8wjUY8Ge58lNhcX7r4zAPfq_k,469
44
+ arkitekt_next/bloks/services/s3.py,sha256=_mk_9NdaeHRVZ__1M9CL1Ec1gSQKkzlOiQXse7MSx94,485
45
45
  arkitekt_next/bloks/services/secret.py,sha256=iUG1ZH_dR0tL48rueNOK2ILjEnyqNJjQCY-4KKrB_Zg,342
46
46
  arkitekt_next/bloks/services/socket.py,sha256=eXACQPldS9I1xGVDcbF6LrVkHHsBcjvG1VtlvHnM-14,427
47
47
  arkitekt_next/bloks/socket.py,sha256=YIrSKfQezrsKwRKDPdT1aXhlQzjgnx_UaNaQ9LiEfGY,1008
@@ -145,8 +145,8 @@ arkitekt_next/qt/utils.py,sha256=MgBPtPmCSBkIuATov3UgREESwxAHh77lWNNxyE7Qs48,773
145
145
  arkitekt_next/service_registry.py,sha256=pczUuP_Nve7OYwB7-oDBLIw6bkjZPnzL3xFca5TF1io,3405
146
146
  arkitekt_next/tqdm.py,sha256=DlrxPluHao7TvW-Cqgt0UokRS-fM2_ZNiWiddqvCqCc,1488
147
147
  arkitekt_next/utils.py,sha256=gmKWy9M51vimohmmaoIpAJ0CaB22TFP0w3JszRrwiak,2379
148
- arkitekt_next-0.7.38.dist-info/LICENSE,sha256=YZ2oRjC248t-GpoEyw7J13vwKYNG6zhYMaEAix6EzF0,1089
149
- arkitekt_next-0.7.38.dist-info/METADATA,sha256=NJrnRs82cPUTEThfUuwjRUAm0W1lgcLoVqcT7FITWzQ,6055
150
- arkitekt_next-0.7.38.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
151
- arkitekt_next-0.7.38.dist-info/entry_points.txt,sha256=-hxikQx4xZ6TiOnWVDOlTN_kcAISgGFvTHXIchsCHSc,60
152
- arkitekt_next-0.7.38.dist-info/RECORD,,
148
+ arkitekt_next-0.7.40.dist-info/LICENSE,sha256=YZ2oRjC248t-GpoEyw7J13vwKYNG6zhYMaEAix6EzF0,1089
149
+ arkitekt_next-0.7.40.dist-info/METADATA,sha256=Cb4uLTlJt7J7itIWXLDnv1PDJnCJlZEHmhPOZpBextY,5973
150
+ arkitekt_next-0.7.40.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
151
+ arkitekt_next-0.7.40.dist-info/entry_points.txt,sha256=-hxikQx4xZ6TiOnWVDOlTN_kcAISgGFvTHXIchsCHSc,60
152
+ arkitekt_next-0.7.40.dist-info/RECORD,,