arkitekt-next 0.7.32__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.
- arkitekt_next/__blok__.py +37 -0
- arkitekt_next/bloks/__init__.py +2 -0
- arkitekt_next/bloks/admin.py +45 -0
- arkitekt_next/bloks/arkitekt.py +38 -0
- arkitekt_next/bloks/config.py +42 -0
- arkitekt_next/bloks/fluss.py +88 -0
- arkitekt_next/bloks/funcs.py +86 -0
- arkitekt_next/bloks/gateway.py +173 -0
- arkitekt_next/bloks/internal_docker.py +80 -0
- arkitekt_next/bloks/kabinet.py +93 -0
- arkitekt_next/bloks/livekit.py +92 -0
- arkitekt_next/bloks/lok.py +381 -0
- arkitekt_next/bloks/mikro.py +98 -0
- arkitekt_next/bloks/minio.py +180 -0
- arkitekt_next/bloks/mount.py +35 -0
- arkitekt_next/bloks/postgres.py +86 -0
- arkitekt_next/bloks/redis.py +77 -0
- arkitekt_next/bloks/rekuest.py +93 -0
- arkitekt_next/bloks/services/__init__.py +0 -0
- arkitekt_next/bloks/services/admin.py +22 -0
- arkitekt_next/bloks/services/config.py +18 -0
- arkitekt_next/bloks/services/db.py +27 -0
- arkitekt_next/bloks/services/gateway.py +20 -0
- arkitekt_next/bloks/services/livekit.py +19 -0
- arkitekt_next/bloks/services/lok.py +27 -0
- arkitekt_next/bloks/services/mount.py +15 -0
- arkitekt_next/bloks/services/redis.py +28 -0
- arkitekt_next/bloks/services/s3.py +26 -0
- arkitekt_next/bloks/services/socket.py +16 -0
- arkitekt_next/bloks/socket.py +38 -0
- arkitekt_next/cli/commands/server/init.py +4 -63
- {arkitekt_next-0.7.32.dist-info → arkitekt_next-0.7.34.dist-info}/METADATA +1 -1
- {arkitekt_next-0.7.32.dist-info → arkitekt_next-0.7.34.dist-info}/RECORD +36 -6
- {arkitekt_next-0.7.32.dist-info → arkitekt_next-0.7.34.dist-info}/LICENSE +0 -0
- {arkitekt_next-0.7.32.dist-info → arkitekt_next-0.7.34.dist-info}/WHEEL +0 -0
- {arkitekt_next-0.7.32.dist-info → arkitekt_next-0.7.34.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from blok import blok, InitContext, ExecutionContext, Option
|
|
4
|
+
from blok.tree import YamlFile, Repo
|
|
5
|
+
from pydantic import BaseModel
|
|
6
|
+
from typing import Dict, Optional
|
|
7
|
+
import secrets
|
|
8
|
+
from blok import blok, InitContext
|
|
9
|
+
from arkitekt_next.bloks.services.s3 import S3Credentials, S3Service
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BucketMapParamType(click.ParamType):
|
|
13
|
+
name = "redeem_token"
|
|
14
|
+
|
|
15
|
+
def convert(self, value, param, ctx):
|
|
16
|
+
if isinstance(value, dict):
|
|
17
|
+
return value
|
|
18
|
+
try:
|
|
19
|
+
user, token = value.split(":")
|
|
20
|
+
return {"user": user, "token": token}
|
|
21
|
+
except ValueError:
|
|
22
|
+
self.fail(
|
|
23
|
+
f"RedeemToken '{value}' is not in the correct format. It should be 'username:token'.",
|
|
24
|
+
param,
|
|
25
|
+
ctx,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
TOKEN = BucketMapParamType()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@blok(S3Service)
|
|
33
|
+
class MinioBlok:
|
|
34
|
+
db_name: str
|
|
35
|
+
|
|
36
|
+
def __init__(self) -> None:
|
|
37
|
+
self.users = []
|
|
38
|
+
self.username = secrets.token_hex(16)
|
|
39
|
+
self.password = secrets.token_hex(16)
|
|
40
|
+
self.protocol = "http"
|
|
41
|
+
self.host = "minio"
|
|
42
|
+
self.port = 9000
|
|
43
|
+
self.skip = False
|
|
44
|
+
self.scopes = {}
|
|
45
|
+
self.init_image = "jhnnsrs/init:paper"
|
|
46
|
+
self.minio_image = "minio/minio:RELEASE.2023-02-10T18-48-39Z"
|
|
47
|
+
self.buckets = []
|
|
48
|
+
self.registered_clients = []
|
|
49
|
+
self.preformed_bucket_names = [secrets.token_hex(16) for i in range(100)]
|
|
50
|
+
self.preformed_access_keys = [secrets.token_hex(16) for i in range(100)]
|
|
51
|
+
self.preformed_secret_keys = [secrets.token_hex(16) for i in range(100)]
|
|
52
|
+
|
|
53
|
+
def get_identifier(self):
|
|
54
|
+
return "live.arkitekt.s3"
|
|
55
|
+
|
|
56
|
+
def get_dependencies(self):
|
|
57
|
+
return ["live.arkitekt.config", "live.arkitekt.gateway"]
|
|
58
|
+
|
|
59
|
+
def create_buckets(self, buckets: list[str]) -> S3Credentials:
|
|
60
|
+
new_access_key = self.preformed_access_keys.pop()
|
|
61
|
+
new_secret_key = self.preformed_secret_keys.pop()
|
|
62
|
+
|
|
63
|
+
bucket_map = {}
|
|
64
|
+
|
|
65
|
+
for bucket in buckets:
|
|
66
|
+
bucket_map[bucket] = self.preformed_bucket_names.pop()
|
|
67
|
+
|
|
68
|
+
self.buckets.extend(bucket_map.values())
|
|
69
|
+
|
|
70
|
+
creds = S3Credentials(
|
|
71
|
+
access_key=new_access_key,
|
|
72
|
+
buckets=bucket_map,
|
|
73
|
+
host=self.host,
|
|
74
|
+
port=self.port,
|
|
75
|
+
secret_key=new_secret_key,
|
|
76
|
+
protocol=self.protocol,
|
|
77
|
+
dependency=self.host if not self.skip else None,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
self.registered_clients.append(creds)
|
|
81
|
+
|
|
82
|
+
return creds
|
|
83
|
+
|
|
84
|
+
def preflight(self, init: InitContext):
|
|
85
|
+
for key, value in init.kwargs.items():
|
|
86
|
+
setattr(self, key, value)
|
|
87
|
+
|
|
88
|
+
self.preformed_bucket_names = list(
|
|
89
|
+
init.kwargs.get("preformed_bucket_names", [])
|
|
90
|
+
)
|
|
91
|
+
self.preformed_access_keys = list(init.kwargs.get("preformed_access_keys", []))
|
|
92
|
+
self.preformed_secret_keys = list(init.kwargs.get("preformed_secret_keys", []))
|
|
93
|
+
|
|
94
|
+
init.dependencies["live.arkitekt.gateway"].expose_default(9000, self.host)
|
|
95
|
+
|
|
96
|
+
self.config_path = init.dependencies["live.arkitekt.config"].get_path(
|
|
97
|
+
self.host + ".yaml"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
def build(self, context: ExecutionContext):
|
|
101
|
+
minio_service_init = {
|
|
102
|
+
"depends_on": {
|
|
103
|
+
"minio": {
|
|
104
|
+
"condition": "service_started",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
"environment": {
|
|
108
|
+
"MINIO_ROOT_PASSWORD": self.password,
|
|
109
|
+
"MINIO_ROOT_USER": self.username,
|
|
110
|
+
"MINIO_HOST": f"{self.host}:9000",
|
|
111
|
+
},
|
|
112
|
+
"image": self.init_image,
|
|
113
|
+
"volumes": [f"{self.config_path}:/workspace/config.yaml"],
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
minio_service = {
|
|
117
|
+
"command": ["server", "/data"],
|
|
118
|
+
"environment": {
|
|
119
|
+
"MINIO_ROOT_PASSWORD": self.password,
|
|
120
|
+
"MINIO_ROOT_USER": self.username,
|
|
121
|
+
},
|
|
122
|
+
"image": self.minio_image,
|
|
123
|
+
"volumes": ["./data:/data"],
|
|
124
|
+
"labels": ["fakts.service=live.arkitekt.s3", "fakts.builder=arkitekt.s3"],
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
context.file_tree.set_nested("data", {})
|
|
128
|
+
|
|
129
|
+
context.docker_compose.set_nested("services", self.host, minio_service)
|
|
130
|
+
context.docker_compose.set_nested(
|
|
131
|
+
"services", f"{self.host}_init", minio_service_init
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
context.file_tree.set_nested(
|
|
135
|
+
*self.config_path.split("/"), YamlFile(**{"buckets": list(self.buckets)})
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
def get_options(self):
|
|
139
|
+
with_host = Option(
|
|
140
|
+
subcommand="host",
|
|
141
|
+
help="The fakts url for connection",
|
|
142
|
+
default=self.host,
|
|
143
|
+
)
|
|
144
|
+
with_username = Option(
|
|
145
|
+
subcommand="username",
|
|
146
|
+
help="The fakts url for connection",
|
|
147
|
+
default=self.username,
|
|
148
|
+
)
|
|
149
|
+
with_password = Option(
|
|
150
|
+
subcommand="password",
|
|
151
|
+
help="The fakts url for connection",
|
|
152
|
+
default=self.password,
|
|
153
|
+
)
|
|
154
|
+
with_preformed_bucket_names = Option(
|
|
155
|
+
subcommand="preformed_bucket_names",
|
|
156
|
+
help="The fakts url for connection",
|
|
157
|
+
multiple=True,
|
|
158
|
+
default=self.preformed_bucket_names,
|
|
159
|
+
)
|
|
160
|
+
with_preformed_acces_key = Option(
|
|
161
|
+
subcommand="preformed_access_keys",
|
|
162
|
+
help="The fakts url for connection",
|
|
163
|
+
multiple=True,
|
|
164
|
+
default=self.preformed_access_keys,
|
|
165
|
+
)
|
|
166
|
+
with_preformed_secret_keys = Option(
|
|
167
|
+
subcommand="preformed_secret_keys",
|
|
168
|
+
help="The fakts url for connection",
|
|
169
|
+
multiple=True,
|
|
170
|
+
default=self.preformed_secret_keys,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
return [
|
|
174
|
+
with_host,
|
|
175
|
+
with_password,
|
|
176
|
+
with_username,
|
|
177
|
+
with_preformed_bucket_names,
|
|
178
|
+
with_preformed_acces_key,
|
|
179
|
+
with_preformed_secret_keys,
|
|
180
|
+
]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Dict, Any
|
|
3
|
+
from arkitekt_next.bloks.services.mount import MountService
|
|
4
|
+
from blok import blok, InitContext, Option, ExecutionContext
|
|
5
|
+
|
|
6
|
+
from blok.tree import YamlFile
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@blok(MountService)
|
|
10
|
+
class MountBlok:
|
|
11
|
+
|
|
12
|
+
def __init__(self) -> None:
|
|
13
|
+
self.mount_path = "mounts"
|
|
14
|
+
self.registered_configs = {}
|
|
15
|
+
|
|
16
|
+
def preflight(self, mount_path: str):
|
|
17
|
+
self.mount_path = mount_path
|
|
18
|
+
|
|
19
|
+
def build(self, ex: ExecutionContext):
|
|
20
|
+
for name, file in self.registered_configs.items():
|
|
21
|
+
ex.file_tree.set_nested(*f"{self.mount_path}/{name}".split("/"), file)
|
|
22
|
+
|
|
23
|
+
def register_mount(self, name: str, file: YamlFile) -> str:
|
|
24
|
+
self.registered_configs[name] = file
|
|
25
|
+
return f"./{self.mount_path}/" + name
|
|
26
|
+
|
|
27
|
+
def get_options(self):
|
|
28
|
+
config_path = Option(
|
|
29
|
+
subcommand="mount_path",
|
|
30
|
+
help="Which path to use for configs",
|
|
31
|
+
default=self.mount_path,
|
|
32
|
+
show_default=True,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return [config_path]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from arkitekt_next.bloks.services.db import DBService, DBCredentials
|
|
4
|
+
from blok import blok, InitContext, ExecutionContext, Option
|
|
5
|
+
from blok.tree import YamlFile, Repo
|
|
6
|
+
from pydantic import BaseModel
|
|
7
|
+
import pydantic
|
|
8
|
+
import namegenerator
|
|
9
|
+
import secrets
|
|
10
|
+
from blok import blok, InitContext
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@blok(DBService)
|
|
16
|
+
class PostgresBlok(BaseModel):
|
|
17
|
+
host: str = "db"
|
|
18
|
+
port: int = 5432
|
|
19
|
+
skip: bool = False
|
|
20
|
+
password: str = pydantic.Field(default_factory=lambda: secrets.token_hex(16))
|
|
21
|
+
user: str = pydantic.Field(default_factory=lambda: namegenerator.gen(separator=""))
|
|
22
|
+
image: str = "jhnnsrs/daten:next"
|
|
23
|
+
|
|
24
|
+
registered_dbs: dict[str, DBCredentials] = {}
|
|
25
|
+
|
|
26
|
+
def get_dependencies(self):
|
|
27
|
+
return []
|
|
28
|
+
|
|
29
|
+
def get_identifier(self):
|
|
30
|
+
return "live.arkitekt.postgres"
|
|
31
|
+
|
|
32
|
+
def register_db(self, db_name: str) -> DBCredentials:
|
|
33
|
+
if db_name in self.registered_dbs:
|
|
34
|
+
return self.registered_dbs[db_name]
|
|
35
|
+
else:
|
|
36
|
+
access_credentials = DBCredentials(
|
|
37
|
+
password=self.password,
|
|
38
|
+
username=self.user,
|
|
39
|
+
host=self.host,
|
|
40
|
+
port=self.port,
|
|
41
|
+
db_name=db_name,
|
|
42
|
+
dependency=self.host if not self.skip else None,
|
|
43
|
+
)
|
|
44
|
+
self.registered_dbs[db_name] = access_credentials
|
|
45
|
+
return access_credentials
|
|
46
|
+
|
|
47
|
+
def preflight(self, init: InitContext):
|
|
48
|
+
for key, value in init.kwargs.items():
|
|
49
|
+
setattr(self, key, value)
|
|
50
|
+
|
|
51
|
+
def build(self, context: ExecutionContext):
|
|
52
|
+
db_service = {
|
|
53
|
+
"environment": {
|
|
54
|
+
"POSTGRES_USER": self.user,
|
|
55
|
+
"POSTGRES_PASSWORD": self.password,
|
|
56
|
+
"POSTGRES_MULTIPLE_DATABASES": ",".join(self.registered_dbs.keys()),
|
|
57
|
+
},
|
|
58
|
+
"image": self.image,
|
|
59
|
+
"labels": ["fakts.service=live.arkitekt.postgres"],
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
context.docker_compose.set_nested(f"services", self.host, db_service)
|
|
63
|
+
|
|
64
|
+
def get_options(self):
|
|
65
|
+
with_postgres_password = Option(
|
|
66
|
+
subcommand="password",
|
|
67
|
+
help="The postgres password for connection",
|
|
68
|
+
default=self.password,
|
|
69
|
+
)
|
|
70
|
+
with_user_password = Option(
|
|
71
|
+
subcommand="user",
|
|
72
|
+
help="The postgress user_name",
|
|
73
|
+
default=self.user,
|
|
74
|
+
)
|
|
75
|
+
skip_build = Option(
|
|
76
|
+
subcommand="skip",
|
|
77
|
+
help="Should the service not be created? E.g when pointing outwards?",
|
|
78
|
+
default=self.skip,
|
|
79
|
+
)
|
|
80
|
+
with_image = Option(
|
|
81
|
+
subcommand="image",
|
|
82
|
+
help="The image to use for the service",
|
|
83
|
+
default=self.image,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return [with_postgres_password, skip_build, with_user_password, with_image]
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from arkitekt_next.bloks.services.redis import RedisService, RedisConnection
|
|
4
|
+
from blok import blok, InitContext, ExecutionContext, Option
|
|
5
|
+
from blok.tree import YamlFile, Repo
|
|
6
|
+
from pydantic import BaseModel
|
|
7
|
+
from typing import Dict, Any, Optional
|
|
8
|
+
|
|
9
|
+
from blok import blok, InitContext
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@blok(RedisService)
|
|
14
|
+
class RedisBlok:
|
|
15
|
+
def __init__(self) -> None:
|
|
16
|
+
self.host = "redis"
|
|
17
|
+
self.port = 6379
|
|
18
|
+
self.skip = False
|
|
19
|
+
self.image = "redis"
|
|
20
|
+
|
|
21
|
+
def get_identifier(self):
|
|
22
|
+
return "live.arkitekt.redis"
|
|
23
|
+
|
|
24
|
+
def get_dependencies(self):
|
|
25
|
+
return []
|
|
26
|
+
|
|
27
|
+
def register(self) -> RedisConnection:
|
|
28
|
+
return RedisConnection(
|
|
29
|
+
host=self.host,
|
|
30
|
+
port=self.port,
|
|
31
|
+
dependency=self.host if not self.skip else None,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def preflight(self, init: InitContext):
|
|
35
|
+
for key, value in init.kwargs.items():
|
|
36
|
+
setattr(self, key, value)
|
|
37
|
+
|
|
38
|
+
def build(self, context: ExecutionContext):
|
|
39
|
+
redis_service = {
|
|
40
|
+
"environment": {
|
|
41
|
+
"REDIS_HOST": self.host,
|
|
42
|
+
"REDIS_PORT": self.port,
|
|
43
|
+
},
|
|
44
|
+
"image": self.image,
|
|
45
|
+
"ports": [f"{self.port}:{self.port}"],
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
context.docker_compose.set_nested(f"services", self.host, redis_service)
|
|
49
|
+
|
|
50
|
+
def get_options(self):
|
|
51
|
+
with_port = Option(
|
|
52
|
+
subcommand="port",
|
|
53
|
+
help="Which port to use",
|
|
54
|
+
type=int,
|
|
55
|
+
default=self.port,
|
|
56
|
+
show_default=True,
|
|
57
|
+
)
|
|
58
|
+
with_host = Option(
|
|
59
|
+
subcommand="host",
|
|
60
|
+
help="Which public hosts to use",
|
|
61
|
+
type=str,
|
|
62
|
+
default=self.host,
|
|
63
|
+
show_default=True,
|
|
64
|
+
)
|
|
65
|
+
with_skip = Option(
|
|
66
|
+
subcommand="skip",
|
|
67
|
+
help="Skip docker creation (if using external redis?)",
|
|
68
|
+
is_flag=True,
|
|
69
|
+
default=self.skip,
|
|
70
|
+
)
|
|
71
|
+
with_image = Option(
|
|
72
|
+
subcommand="image",
|
|
73
|
+
help="The image to use for the service",
|
|
74
|
+
default=self.image,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
return [with_port, with_host, with_skip, with_image]
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
from typing import Dict, Any
|
|
2
|
+
import secrets
|
|
3
|
+
|
|
4
|
+
from arkitekt_next.bloks.funcs import create_default_service_yaml
|
|
5
|
+
from blok import blok, InitContext, ExecutionContext, Option
|
|
6
|
+
from blok.tree import Repo, YamlFile
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@blok("live.arkitekt.rekuest")
|
|
10
|
+
class RekuestBlok:
|
|
11
|
+
def __init__(self) -> None:
|
|
12
|
+
self.host = "rekuest"
|
|
13
|
+
self.command = "bash run-debug.sh"
|
|
14
|
+
self.repo = "https://github.com/jhnnsrs/rekuest-server_next"
|
|
15
|
+
self.scopes = {"read_image": "Read image from the database"}
|
|
16
|
+
self.mount_repo = False
|
|
17
|
+
self.build_repo = False
|
|
18
|
+
self.buckets = ["media"]
|
|
19
|
+
self.secret_key = secrets.token_hex(16)
|
|
20
|
+
self.ensured_repos = []
|
|
21
|
+
self.image = "jhnnsrs/rekuest:next"
|
|
22
|
+
|
|
23
|
+
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
|
+
]
|
|
34
|
+
|
|
35
|
+
def preflight(self, init: InitContext):
|
|
36
|
+
for key, value in init.kwargs.items():
|
|
37
|
+
setattr(self, key, value)
|
|
38
|
+
|
|
39
|
+
self.service = create_default_service_yaml(init, self)
|
|
40
|
+
|
|
41
|
+
self.initialized = True
|
|
42
|
+
|
|
43
|
+
def build(self, context: ExecutionContext):
|
|
44
|
+
context.docker_compose.set_nested("services", self.host, self.service)
|
|
45
|
+
|
|
46
|
+
def get_options(self):
|
|
47
|
+
with_repo = Option(
|
|
48
|
+
subcommand="with_repo",
|
|
49
|
+
help="Which repo should we use when building the service? Only active if build_repo or mount_repo is active",
|
|
50
|
+
default=self.repo,
|
|
51
|
+
)
|
|
52
|
+
with_command = Option(
|
|
53
|
+
subcommand="command",
|
|
54
|
+
help="Which command should be run when starting the service",
|
|
55
|
+
default=self.command,
|
|
56
|
+
)
|
|
57
|
+
mount_repo = Option(
|
|
58
|
+
subcommand="mount_repo",
|
|
59
|
+
help="Should we mount the repo into the container?",
|
|
60
|
+
is_flag=True,
|
|
61
|
+
default=self.mount_repo,
|
|
62
|
+
)
|
|
63
|
+
build_repo = Option(
|
|
64
|
+
subcommand="build_repo",
|
|
65
|
+
help="Should we build the container from the repo?",
|
|
66
|
+
is_flag=True,
|
|
67
|
+
default=self.build_repo,
|
|
68
|
+
)
|
|
69
|
+
with_host = Option(
|
|
70
|
+
subcommand="host",
|
|
71
|
+
help="How should the service be named inside the docker-compose file?",
|
|
72
|
+
default=self.host,
|
|
73
|
+
)
|
|
74
|
+
with_secret_key = Option(
|
|
75
|
+
subcommand="secret_key",
|
|
76
|
+
help="The secret key to use for the django service",
|
|
77
|
+
default=self.secret_key,
|
|
78
|
+
)
|
|
79
|
+
with_repos = Option(
|
|
80
|
+
subcommand="repos",
|
|
81
|
+
help="The default repos to enable for the service",
|
|
82
|
+
default=self.secret_key,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
return [
|
|
86
|
+
with_repo,
|
|
87
|
+
mount_repo,
|
|
88
|
+
build_repo,
|
|
89
|
+
with_host,
|
|
90
|
+
with_command,
|
|
91
|
+
with_secret_key,
|
|
92
|
+
with_repos,
|
|
93
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from typing import Dict, Any, Protocol
|
|
2
|
+
from blok import blok, InitContext, Option
|
|
3
|
+
from blok import service
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class AdminCredentials:
|
|
8
|
+
password: str
|
|
9
|
+
username: str
|
|
10
|
+
email: str
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@service("live.arkitekt.admin")
|
|
14
|
+
class AdminService(Protocol):
|
|
15
|
+
|
|
16
|
+
def retrieve(self):
|
|
17
|
+
return AdminCredentials(
|
|
18
|
+
password=self.password,
|
|
19
|
+
username=self.username,
|
|
20
|
+
email=self.email,
|
|
21
|
+
)
|
|
22
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from typing import Dict, Any, Protocol
|
|
2
|
+
from blok import blok, InitContext, Option, ExecutionContext, service
|
|
3
|
+
from blok.tree import YamlFile
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@service("live.arkitekt.config")
|
|
9
|
+
class ConfigService(Protocol):
|
|
10
|
+
|
|
11
|
+
def register_config(self, name: str, file: YamlFile) -> str:
|
|
12
|
+
...
|
|
13
|
+
|
|
14
|
+
def get_path(self, name: str) -> str:
|
|
15
|
+
...
|
|
16
|
+
return f"./{self.config_path}/" + name
|
|
17
|
+
|
|
18
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from blok import blok, InitContext, ExecutionContext, Option
|
|
2
|
+
from blok.tree import YamlFile, Repo
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Dict, Any, Protocol, Optional
|
|
5
|
+
|
|
6
|
+
from blok import blok, InitContext, service
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class DBCredentials:
|
|
11
|
+
password: str
|
|
12
|
+
username: str
|
|
13
|
+
host: str
|
|
14
|
+
port: int
|
|
15
|
+
db_name: str
|
|
16
|
+
engine: str = "django.db.backends.postgresql"
|
|
17
|
+
dependency: Optional[str] = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@blok("live.arkitekt.postgres")
|
|
22
|
+
class DBService(Protocol):
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def register_db(self, db_name: str) -> DBCredentials:
|
|
26
|
+
...
|
|
27
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from blok import blok, InitContext, ExecutionContext, Option
|
|
2
|
+
from blok.tree import YamlFile, Repo
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Dict, Any, Protocol
|
|
5
|
+
|
|
6
|
+
from blok import blok, InitContext, service
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@blok("live.arkitekt.gateway")
|
|
10
|
+
class GatewayService(Protocol):
|
|
11
|
+
|
|
12
|
+
def expose(self, path_name: str, port: int, host: str, strip_prefix: bool = True):
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
def expose_default(self, port: int, host: str):
|
|
16
|
+
...
|
|
17
|
+
|
|
18
|
+
def expose_port(self, port: int, host: str, tls: bool = False):
|
|
19
|
+
...
|
|
20
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Any, Protocol
|
|
4
|
+
from blok import blok, InitContext, Option
|
|
5
|
+
from blok import service
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class LivekitCredentials:
|
|
10
|
+
api_key: str
|
|
11
|
+
api_secret: str
|
|
12
|
+
api_url: str
|
|
13
|
+
|
|
14
|
+
@service("io.livekit.livekit")
|
|
15
|
+
class LivekitService(Protocol):
|
|
16
|
+
|
|
17
|
+
def retrieve_access(self) -> LivekitCredentials:
|
|
18
|
+
...
|
|
19
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Any, Protocol
|
|
4
|
+
from blok import blok, InitContext, Option
|
|
5
|
+
from blok import service
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class LokCredentials:
|
|
10
|
+
issuer: str
|
|
11
|
+
key_type: str
|
|
12
|
+
public_key: str
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@service("live.arkitekt.lok")
|
|
16
|
+
class LokService(Protocol):
|
|
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
|
+
|
|
27
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import Dict, Any, Protocol
|
|
2
|
+
from blok import blok, InitContext, Option, ExecutionContext, service
|
|
3
|
+
from blok.tree import YamlFile
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@service("live.arkitekt.mount")
|
|
9
|
+
class MountService(Protocol):
|
|
10
|
+
|
|
11
|
+
def register_mount(self, name: str, file: YamlFile) -> str:
|
|
12
|
+
...
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from blok import blok, InitContext, ExecutionContext, Option
|
|
2
|
+
from blok.tree import YamlFile, Repo
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Dict, Any, Protocol, Optional
|
|
5
|
+
|
|
6
|
+
from blok import blok, InitContext, service
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class RedisConnection:
|
|
11
|
+
host: str
|
|
12
|
+
port: int
|
|
13
|
+
dependency: Optional[str] = None
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@blok("live.arkitekt.redis")
|
|
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
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Any, List, Protocol, Optional
|
|
4
|
+
from blok import blok, InitContext, Option
|
|
5
|
+
from blok import service
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class S3Credentials:
|
|
10
|
+
access_key: str
|
|
11
|
+
buckets: Dict[str, str]
|
|
12
|
+
host: str
|
|
13
|
+
port: int
|
|
14
|
+
secret_key: str
|
|
15
|
+
protocol: str
|
|
16
|
+
dependency: Optional[str] = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@service("live.arkitekt.s3")
|
|
20
|
+
class S3Service(Protocol):
|
|
21
|
+
|
|
22
|
+
def create_buckets(self, buckets: List[str]) -> S3Credentials:
|
|
23
|
+
...
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|