arkitekt-next 0.7.33__py3-none-any.whl → 0.7.34__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 +14 -2
  2. arkitekt_next/bloks/__init__.py +1 -0
  3. arkitekt_next/bloks/admin.py +7 -15
  4. arkitekt_next/bloks/arkitekt.py +10 -23
  5. arkitekt_next/bloks/config.py +42 -0
  6. arkitekt_next/bloks/fluss.py +20 -70
  7. arkitekt_next/bloks/funcs.py +86 -0
  8. arkitekt_next/bloks/gateway.py +48 -28
  9. arkitekt_next/bloks/internal_docker.py +80 -0
  10. arkitekt_next/bloks/kabinet.py +20 -70
  11. arkitekt_next/bloks/livekit.py +33 -12
  12. arkitekt_next/bloks/lok.py +69 -33
  13. arkitekt_next/bloks/mikro.py +19 -73
  14. arkitekt_next/bloks/minio.py +28 -28
  15. arkitekt_next/bloks/mount.py +35 -0
  16. arkitekt_next/bloks/postgres.py +13 -19
  17. arkitekt_next/bloks/redis.py +8 -17
  18. arkitekt_next/bloks/rekuest.py +93 -0
  19. arkitekt_next/bloks/services/__init__.py +0 -0
  20. arkitekt_next/bloks/services/admin.py +22 -0
  21. arkitekt_next/bloks/services/config.py +18 -0
  22. arkitekt_next/bloks/services/db.py +27 -0
  23. arkitekt_next/bloks/services/gateway.py +20 -0
  24. arkitekt_next/bloks/services/livekit.py +19 -0
  25. arkitekt_next/bloks/services/lok.py +27 -0
  26. arkitekt_next/bloks/services/mount.py +15 -0
  27. arkitekt_next/bloks/services/redis.py +28 -0
  28. arkitekt_next/bloks/services/s3.py +26 -0
  29. arkitekt_next/bloks/services/socket.py +16 -0
  30. arkitekt_next/bloks/socket.py +38 -0
  31. arkitekt_next/cli/commands/server/init.py +4 -63
  32. {arkitekt_next-0.7.33.dist-info → arkitekt_next-0.7.34.dist-info}/METADATA +1 -1
  33. {arkitekt_next-0.7.33.dist-info → arkitekt_next-0.7.34.dist-info}/RECORD +36 -20
  34. arkitekt_next/bloks/services.py +0 -2
  35. {arkitekt_next-0.7.33.dist-info → arkitekt_next-0.7.34.dist-info}/LICENSE +0 -0
  36. {arkitekt_next-0.7.33.dist-info → arkitekt_next-0.7.34.dist-info}/WHEEL +0 -0
  37. {arkitekt_next-0.7.33.dist-info → arkitekt_next-0.7.34.dist-info}/entry_points.txt +0 -0
@@ -1,7 +1,8 @@
1
1
  from typing import Dict, Any
2
2
  import secrets
3
3
 
4
- from blok import blok, InitContext, ExecutionContext
4
+ from arkitekt_next.bloks.funcs import create_default_service_yaml
5
+ from blok import blok, InitContext, ExecutionContext, Option
5
6
  from blok.tree import Repo, YamlFile
6
7
 
7
8
 
@@ -12,13 +13,17 @@ class KabinetBlok:
12
13
  self.command = "bash run-debug.sh"
13
14
  self.repo = "https://github.com/jhnnsrs/kabinet-server"
14
15
  self.scopes = {"read_image": "Read image from the database"}
15
- self.mount_repo = True
16
- self.build_repo = True
16
+ self.mount_repo = False
17
+ self.build_repo = False
18
+ self.buckets = ["media"]
17
19
  self.secret_key = secrets.token_hex(16)
18
20
  self.ensured_repos = []
21
+ self.image = "jhnnsrs/kabinet:next"
19
22
 
20
23
  def get_dependencies(self):
21
24
  return [
25
+ "live.arkitekt.mount",
26
+ "live.arkitekt.config",
22
27
  "live.arkitekt.gateway",
23
28
  "live.arkitekt.postgres",
24
29
  "live.arkitekt.lok",
@@ -27,106 +32,51 @@ class KabinetBlok:
27
32
  "live.arkitekt.s3",
28
33
  ]
29
34
 
30
- def init(self, init: InitContext):
35
+ def preflight(self, init: InitContext):
31
36
  for key, value in init.kwargs.items():
32
37
  setattr(self, key, value)
33
38
 
34
- deps = init.dependencies
39
+ self.service = create_default_service_yaml(init, self)
35
40
 
36
- deps["live.arkitekt.lok"].register_scopes(self.scopes)
37
-
38
- self.gateway_access = deps["live.arkitekt.gateway"].expose(
39
- self.host, 80, self.host
40
- )
41
-
42
- self.postgress_access = deps["live.arkitekt.postgres"].register_db(self.host)
43
- self.redis_access = deps["live.arkitekt.redis"].register()
44
- self.lok_access = deps["live.arkitekt.lok"].retrieve_credentials()
45
- self.admin_access = deps["live.arkitekt.admin"].retrieve()
46
- self.minio_access = deps["live.arkitekt.s3"].retrieve_credentials(["media"])
47
41
  self.initialized = True
48
42
 
49
43
  def build(self, context: ExecutionContext):
50
- depends_on = []
51
-
52
- if self.redis_access.dependency:
53
- depends_on.append(self.redis_access.dependency)
54
-
55
- if self.postgress_access.dependency:
56
- depends_on.append(self.postgress_access.dependency)
57
-
58
- db_service = {
59
- "labels": [
60
- "fakts.service=live.arkitekt.mikro",
61
- "fakts.builder=arkitekt.mikro",
62
- ],
63
- "depends_on": depends_on,
64
- }
65
-
66
- if self.mount_repo:
67
- context.file_tree.set_nested("mounts", self.host, Repo(self.repo))
68
- db_service["volumes"] = [f"./mounts/{self.host}:/workspace"]
69
-
70
- if self.build_repo:
71
- context.file_tree.set_nested("mounts", self.host, Repo(self.repo))
72
- db_service["build"] = f"./mounts/{self.host}"
73
-
74
- db_service["command"] = self.command
75
-
76
- configuration = YamlFile(
77
- **{
78
- "db": self.postgress_access.dict(),
79
- "django": {
80
- "admin": self.admin_access.dict(),
81
- "debug": True,
82
- "hosts": ["*"],
83
- "secret_key": self.secret_key,
84
- },
85
- "redis": self.redis_access.dict(),
86
- "lok": self.lok_access.dict(),
87
- "s3": self.minio_access.dict(),
88
- "scopes": self.scopes,
89
- }
90
- )
91
-
92
- context.file_tree.set_nested("configs", "kabinet.yaml", configuration)
93
-
94
- context.docker_compose.set_nested("services", self.host, db_service)
44
+ context.docker_compose.set_nested("services", self.host, self.service)
95
45
 
96
46
  def get_options(self):
97
- with_repo = CLIOptions(
47
+ with_repo = Option(
98
48
  subcommand="with_repo",
99
49
  help="Which repo should we use when building the service? Only active if build_repo or mount_repo is active",
100
50
  default=self.repo,
101
51
  )
102
- with_command = CLIOptions(
52
+ with_command = Option(
103
53
  subcommand="command",
104
54
  help="Which command should be run when starting the service",
105
55
  default=self.command,
106
56
  )
107
- mount_repo = CLIOptions(
57
+ mount_repo = Option(
108
58
  subcommand="mount_repo",
109
59
  help="Should we mount the repo into the container?",
110
60
  is_flag=True,
111
- default=True,
61
+ default=self.mount_repo,
112
62
  )
113
- build_repo = CLIOptions(
63
+ build_repo = Option(
114
64
  subcommand="build_repo",
115
65
  help="Should we build the container from the repo?",
116
66
  is_flag=True,
117
- default=True,
67
+ default=self.build_repo,
118
68
  )
119
- with_host = CLIOptions(
69
+ with_host = Option(
120
70
  subcommand="host",
121
71
  help="How should the service be named inside the docker-compose file?",
122
72
  default=self.host,
123
73
  )
124
- with_secret_key = CLIOptions(
74
+ with_secret_key = Option(
125
75
  subcommand="secret_key",
126
76
  help="The secret key to use for the django service",
127
77
  default=self.secret_key,
128
78
  )
129
- with_repos = CLIOptions(
79
+ with_repos = Option(
130
80
  subcommand="repos",
131
81
  help="The default repos to enable for the service",
132
82
  default=self.secret_key,
@@ -1,12 +1,14 @@
1
1
  from typing import Dict, Any
2
2
  import secrets
3
3
 
4
- from blok import blok, InitContext, ExecutionContext, CLIOption
4
+ from arkitekt_next.bloks.services.gateway import GatewayService
5
+ from arkitekt_next.bloks.services.livekit import LivekitService, LivekitCredentials
6
+ from blok import blok, InitContext, ExecutionContext, Option
5
7
  from blok.tree import YamlFile, Repo
6
8
 
7
9
 
8
- @blok("io.livekit.livekit")
9
- class LiveKitBlok:
10
+ @blok(LivekitService)
11
+ class LocalLiveKitBlok:
10
12
  def __init__(self) -> None:
11
13
  self.host = "livekit"
12
14
  self.command = ["--dev", "--bind", "0.0.0.0"]
@@ -16,24 +18,35 @@ class LiveKitBlok:
16
18
  self.secret_key = secrets.token_hex(16)
17
19
  self.ensured_repos = []
18
20
  self.port_range = [50000, 50030]
21
+ self.api_key = "devkey"
22
+ self.api_secret = "secret"
23
+ self.skip = False
19
24
 
20
- def get_dependencies(self):
21
- return [
22
- "live.arkitekt.gateway",
23
- ]
24
25
 
25
- def init(self, init: InitContext):
26
+ def preflight(self, init: InitContext, gateway: GatewayService):
26
27
  for key, value in init.kwargs.items():
27
28
  setattr(self, key, value)
28
29
 
29
30
  deps = init.dependencies
30
31
 
31
- deps["live.arkitekt.gateway"].expose_port(7880, self.host, True)
32
- deps["live.arkitekt.gateway"].expose_port(7881, self.host, True)
32
+ if self.skip:
33
+ return
34
+
35
+ gateway.expose_port(7880, self.host, True)
36
+ gateway.expose_port(7881, self.host, True)
33
37
 
34
38
  self.initialized = True
35
39
 
40
+ 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
+ })
46
+
36
47
  def build(self, context: ExecutionContext):
48
+ if self.skip:
49
+ return
37
50
  db_service = {
38
51
  "labels": [
39
52
  "fakts.service=io.livekit.livekit",
@@ -49,20 +62,28 @@ class LiveKitBlok:
49
62
  context.docker_compose.set_nested("services", self.host, db_service)
50
63
 
51
64
  def get_options(self):
52
- with_command = CLIOption(
65
+ with_command = Option(
53
66
  subcommand="command",
54
67
  help="The fakts url for connection",
55
68
  default=self.command,
56
69
  )
57
- with_host = CLIOption(
70
+ with_host = Option(
58
71
  subcommand="host",
59
72
  help="The fakts url for connection",
60
73
  default=self.host,
61
74
  )
75
+ with_skip = Option(
76
+ subcommand="skip",
77
+ help="The fakts url for connection",
78
+ default=False,
79
+ type=bool,
80
+ is_flag=True,
81
+ )
62
82
 
63
83
  return [
64
84
  with_host,
65
85
  with_command,
86
+ with_skip,
66
87
  ]
67
88
 
68
89
  def __str__(self) -> str:
@@ -5,21 +5,23 @@ from cryptography.hazmat.primitives import serialization as crypto_serialization
5
5
  from cryptography.hazmat.primitives.asymmetric import rsa
6
6
  from cryptography.hazmat.backends import default_backend as crypto_default_backend
7
7
  from typing import Dict
8
+ from arkitekt_next.bloks.services.admin import AdminService
9
+ from arkitekt_next.bloks.services.db import DBService
10
+ from arkitekt_next.bloks.services.gateway import GatewayService
11
+ from arkitekt_next.bloks.services.livekit import LivekitService
12
+ from arkitekt_next.bloks.services.lok import LokCredentials, LokService
8
13
  import yaml
9
14
  import secrets
15
+ from dataclasses import asdict
10
16
 
11
- from blok import blok, InitContext, ExecutionContext, CLIOption
17
+ from arkitekt_next.bloks.services.redis import RedisService
18
+ from blok import blok, InitContext, ExecutionContext, Option
12
19
  from blok.tree import YamlFile, Repo
13
20
  from blok import blok, InitContext
14
21
 
15
22
 
16
- DEFAULT_ARKITEKT_URL = "http://localhost:8000"
17
-
18
23
 
19
- class LokCredentials(BaseModel):
20
- issuer: str
21
- key_type: str
22
- public_key: str
24
+ DEFAULT_ARKITEKT_URL = "http://localhost:8000"
23
25
 
24
26
 
25
27
  # Define a custom user type that will parse and validate the user input
@@ -110,7 +112,7 @@ class ScopeParamType(click.ParamType):
110
112
  SCOPE = ScopeParamType()
111
113
 
112
114
 
113
- @blok("live.arkitekt.lok")
115
+ @blok(LokService)
114
116
  class LokBlok:
115
117
  db_name: str
116
118
 
@@ -124,15 +126,29 @@ class LokBlok:
124
126
  self.with_repo = False
125
127
  self.command = "bash run-debug.sh"
126
128
  self.repo = "https://github.com/jhnnsrs/lok-server-next"
129
+ self.image = "jhnnsrs/lok:next"
127
130
  self.users = []
128
131
  self.tokens = []
129
132
  self.groups = []
130
133
  self.secret_key = secrets.token_hex(16)
131
134
  self.scopes = {"hallo": "welt"}
132
135
  self.key = None
136
+ self.deployment_name = "default"
137
+ self.base_routes = [
138
+ "ht",
139
+ "o",
140
+ "graphql",
141
+ ".well-known",
142
+ "f",
143
+ "admin",
144
+ "static",
145
+ "accounts",
146
+ ]
147
+ self.token_expiry_seconds = 700000
133
148
 
134
149
  def get_dependencies(self):
135
150
  return [
151
+ "io.livekit.livekit",
136
152
  "live.arkitekt.postgres",
137
153
  "live.arkitekt.redis",
138
154
  "live.arkitekt.admin",
@@ -144,24 +160,33 @@ class LokBlok:
144
160
  public_key=self.public_key, key_type="RS256", issuer="lok"
145
161
  )
146
162
 
163
+ def retrieve_labels(self, service_name: str) -> list[str]:
164
+ return [
165
+ f"fakts.service={service_name}",
166
+ f"fakts.builder=arkitekt.{service_name}",
167
+ ]
168
+
147
169
  def register_scopes(self, scopes_dict: Dict[str, str]) -> LokCredentials:
148
170
  self.scopes = self.scopes | scopes_dict
149
171
 
150
- def init(self, init: InitContext):
172
+ def preflight(self, init: InitContext, gateway: GatewayService, db: DBService, redis: RedisService, admin: AdminService, livekit: LivekitService, scopes: list[Dict[str, str]]):
151
173
  for key, value in init.kwargs.items():
152
174
  setattr(self, key, value)
153
175
 
154
176
  assert self.public_key, "Public key is required"
155
177
  assert self.private_key, "Private key is required"
156
178
 
157
- kwargs = init.kwargs
158
- deps = init.dependencies
159
- scopes = kwargs.get("scopes", [])
160
179
  self.scopes = {scope["scope"]: scope["description"] for scope in scopes}
161
180
 
162
- self.postgress_access = deps["live.arkitekt.postgres"].register_db(self.host)
163
- self.redis_access = deps["live.arkitekt.redis"].register()
164
- self.admin_access = deps["live.arkitekt.admin"].retrieve()
181
+ for i in self.base_routes:
182
+ gateway.expose(
183
+ i, 80, self.host, strip_prefix=False
184
+ )
185
+
186
+ self.postgress_access = db.register_db(self.host)
187
+ self.redis_access = redis.register()
188
+ self.admin_access = admin.retrieve()
189
+ self.local_access = livekit.retrieve_access()
165
190
  self.initialized = True
166
191
 
167
192
  def build(self, context: ExecutionContext):
@@ -176,35 +201,46 @@ class LokBlok:
176
201
  db_service = {
177
202
  "labels": ["fakts.service=live.arkitekt.lok", "fakts.builder=arkitekt.lok"],
178
203
  "depends_on": depends_on,
204
+ "volumes": [
205
+ "/var/run/docker.sock:/var/run/docker.sock",
206
+ "./configs/lok.yaml:/workspace/config.yaml",
207
+ "./certs:/certs",
208
+ ],
179
209
  }
180
210
 
181
211
  if self.mount_repo:
182
212
  context.file_tree.set_nested("mounts", "lok", Repo(self.repo))
183
- db_service["volumes"] = ["./mounts/lok:/lok"]
213
+ db_service["volumes"].append("./mounts/lok:/lok")
184
214
 
185
215
  if self.build_repo:
186
216
  context.file_tree.set_nested("mounts", "lok", Repo(self.repo))
187
217
  db_service["build"] = "./mounts/lok"
218
+ else:
219
+ db_service["image"] = self.image
188
220
 
189
221
  db_service["command"] = self.command
190
222
 
191
223
  configuration = YamlFile(
192
224
  **{
193
- "db": self.postgress_access.dict(),
225
+ "db": asdict(self.postgress_access),
194
226
  "users": [user for user in self.users],
195
227
  "django": {
196
- "admin": self.admin_access.dict(),
228
+ "admin": asdict(self.admin_access),
197
229
  "debug": True,
198
230
  "hosts": ["*"],
199
231
  "secret_key": self.secret_key,
200
232
  },
201
- "redis": self.redis_access.dict(),
202
- "lok": self.retrieve_credentials().dict(),
233
+ "redis": asdict(self.redis_access),
234
+ "lok": asdict(self.retrieve_credentials()),
203
235
  "private_key": self.private_key,
204
236
  "public_key": self.public_key,
205
237
  "scopes": self.scopes,
206
238
  "redeem_tokens": [token for token in self.tokens],
207
239
  "groups": [group for group in self.groups],
240
+ "deployment": {"name": self.deployment_name},
241
+ "livekit": asdict(self.local_access),
242
+ "token_expire_seconds": self.token_expiry_seconds,
243
+ "apps": [],
208
244
  }
209
245
  )
210
246
 
@@ -232,82 +268,82 @@ class LokBlok:
232
268
  .decode()
233
269
  )
234
270
 
235
- with_fakts_url = CLIOption(
271
+ with_fakts_url = Option(
236
272
  subcommand="db_name",
237
273
  help="The fakts url for connection",
238
274
  default="db_name",
239
275
  )
240
- with_users = CLIOption(
276
+ with_users = Option(
241
277
  subcommand="users",
242
278
  help="The fakts url for connection",
243
279
  default=["admin:admin"],
244
280
  multiple=True,
245
281
  type=USER,
246
282
  )
247
- with_groups = CLIOption(
283
+ with_groups = Option(
248
284
  subcommand="groups",
249
285
  help="The fakts url for connection",
250
286
  default=["admin:admin_group"],
251
287
  multiple=True,
252
288
  type=GROUP,
253
289
  )
254
- with_redeem_token = CLIOption(
290
+ with_redeem_token = Option(
255
291
  subcommand="tokens",
256
292
  help="The fakts url for connection",
257
293
  default=[],
258
294
  multiple=True,
259
295
  type=TOKEN,
260
296
  )
261
- with_scopes = CLIOption(
297
+ with_scopes = Option(
262
298
  subcommand="scopes",
263
299
  help="The scopes",
264
300
  default=[f"{key}:{value}" for key, value in self.scopes.items()],
265
301
  multiple=True,
266
302
  type=SCOPE,
267
303
  )
268
- with_repo = CLIOption(
304
+ with_repo = Option(
269
305
  subcommand="with_repo",
270
306
  help="The fakts url for connection",
271
307
  default=self.repo,
272
308
  )
273
- with_repo = CLIOption(
309
+ with_repo = Option(
274
310
  subcommand="command",
275
311
  help="The fakts url for connection",
276
312
  default=self.command,
277
313
  )
278
- mount_repo = CLIOption(
314
+ mount_repo = Option(
279
315
  subcommand="mount_repo",
280
316
  help="The fakts url for connection",
281
317
  is_flag=True,
282
318
  default=False,
283
319
  )
284
- build_repo = CLIOption(
320
+ build_repo = Option(
285
321
  subcommand="build_repo",
286
322
  help="The fakts url for connection",
287
323
  is_flag=True,
288
324
  default=False,
289
325
  )
290
- with_host = CLIOption(
326
+ with_host = Option(
291
327
  subcommand="host",
292
328
  help="The fakts url for connection",
293
329
  default=self.host,
294
330
  )
295
331
  #
296
- with_public_key = CLIOption(
332
+ with_public_key = Option(
297
333
  subcommand="public_key",
298
334
  help="The fakts url for connection",
299
335
  default=public_key,
300
336
  required=True,
301
337
  callback=validate_public_key,
302
338
  )
303
- with_private_key = CLIOption(
339
+ with_private_key = Option(
304
340
  subcommand="private_key",
305
341
  help="The fakts url for connection",
306
342
  default=private_key,
307
343
  callback=validate_private_key,
308
344
  required=True,
309
345
  )
310
- with_secret_key = CLIOption(
346
+ with_secret_key = Option(
311
347
  subcommand="secret_key",
312
348
  help="The fakts url for connection",
313
349
  default=self.secret_key,
@@ -5,8 +5,9 @@ import yaml
5
5
  import secrets
6
6
  from blok import blok, InitContext
7
7
 
8
- from blok import blok, InitContext, ExecutionContext, CLIOption
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
11
 
11
12
 
12
13
  class AccessCredentials(BaseModel):
@@ -24,15 +25,16 @@ class MikroBlok:
24
25
  self.command = "bash run-debug.sh"
25
26
  self.repo = "https://github.com/jhnnsrs/mikro-server-next"
26
27
  self.scopes = {"read_image": "Read image from the database"}
27
- self.mount_repo = True
28
- self.build_repo = True
28
+ self.image = "jhnnsrs/mikro:next"
29
+ self.mount_repo = False
30
+ self.build_repo = False
31
+ self.buckets = ["media", "zarr", "parquet"]
29
32
  self.secret_key = secrets.token_hex(16)
30
33
 
31
- def get_identifier(self):
32
- return "live.arkitekt.mikro"
33
-
34
34
  def get_dependencies(self):
35
35
  return [
36
+ "live.arkitekt.mount",
37
+ "live.arkitekt.config",
36
38
  "live.arkitekt.gateway",
37
39
  "live.arkitekt.postgres",
38
40
  "live.arkitekt.lok",
@@ -41,102 +43,46 @@ class MikroBlok:
41
43
  "live.arkitekt.s3",
42
44
  ]
43
45
 
44
- def init(self, init: InitContext):
46
+ def preflight(self, init: InitContext):
45
47
  for key, value in init.kwargs.items():
46
48
  setattr(self, key, value)
47
49
 
48
- deps = init.dependencies
49
- deps["live.arkitekt.lok"].register_scopes(self.scopes)
50
-
51
- self.gateway_access = deps["live.arkitekt.gateway"].expose(
52
- self.host, 80, self.host
53
- )
50
+ self.service = create_default_service_yaml(init, self)
54
51
 
55
- self.postgress_access = deps["live.arkitekt.postgres"].register_db(self.host)
56
- self.redis_access = deps["live.arkitekt.redis"].register()
57
- self.lok_access = deps["live.arkitekt.lok"].retrieve_credentials()
58
- self.admin_access = deps["live.arkitekt.admin"].retrieve()
59
- self.minio_access = deps["live.arkitekt.s3"].retrieve_credentials(
60
- ["zarr", "media"]
61
- )
62
52
  self.initialized = True
63
53
 
64
54
  def build(self, context: ExecutionContext):
65
- depends_on = []
66
-
67
- if self.redis_access.dependency:
68
- depends_on.append(self.redis_access.dependency)
69
-
70
- if self.postgress_access.dependency:
71
- depends_on.append(self.postgress_access.dependency)
72
-
73
- db_service = {
74
- "labels": [
75
- "fakts.service=live.arkitekt.mikro",
76
- "fakts.builder=arkitekt.mikro",
77
- ],
78
- "depends_on": depends_on,
79
- }
80
-
81
- if self.mount_repo:
82
- context.file_tree.set_nested("mounts", self.host, Repo(self.repo))
83
- db_service["volumes"] = [f"./mounts/{self.host}:/workspace"]
84
-
85
- if self.build_repo:
86
- context.file_tree.set_nested("mounts", self.host, Repo(self.repo))
87
- db_service["build"] = f"./mounts/{self.host}"
88
-
89
- db_service["command"] = self.command
90
-
91
- configuration = YamlFile(
92
- **{
93
- "db": self.postgress_access.dict(),
94
- "django": {
95
- "admin": self.admin_access.dict(),
96
- "debug": True,
97
- "hosts": ["*"],
98
- "secret_key": self.secret_key,
99
- },
100
- "redis": self.redis_access.dict(),
101
- "lok": self.lok_access.dict(),
102
- "s3": self.minio_access.dict(),
103
- "scopes": self.scopes,
104
- }
105
- )
106
-
107
- context.file_tree.set_nested("configs", "mikro.yaml", configuration)
108
-
109
- context.docker_compose.set_nested("services", self.host, db_service)
55
+ context.docker_compose.set_nested("services", self.host, self.service)
110
56
 
111
57
  def get_options(self):
112
- with_repo = CLIOption(
58
+ with_repo = Option(
113
59
  subcommand="with_repo",
114
60
  help="The fakts url for connection",
115
61
  default=self.repo,
116
62
  )
117
- with_command = CLIOption(
63
+ with_command = Option(
118
64
  subcommand="command",
119
65
  help="The fakts url for connection",
120
66
  default=self.command,
121
67
  )
122
- mount_repo = CLIOption(
68
+ mount_repo = Option(
123
69
  subcommand="mount_repo",
124
70
  help="The fakts url for connection",
125
71
  is_flag=True,
126
- default=True,
72
+ default=self.mount_repo,
127
73
  )
128
- build_repo = CLIOption(
74
+ build_repo = Option(
129
75
  subcommand="build_repo",
130
76
  help="The fakts url for connection",
131
77
  is_flag=True,
132
- default=True,
78
+ default=self.build_repo,
133
79
  )
134
- with_host = CLIOption(
80
+ with_host = Option(
135
81
  subcommand="host",
136
82
  help="The fakts url for connection",
137
83
  default=self.host,
138
84
  )
139
- with_secret_key = CLIOption(
85
+ with_secret_key = Option(
140
86
  subcommand="secret_key",
141
87
  help="The fakts url for connection",
142
88
  default=self.secret_key,