arkitekt-next 0.7.33__py3-none-any.whl → 0.7.35__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 +14 -2
- arkitekt_next/bloks/__init__.py +1 -0
- arkitekt_next/bloks/admin.py +7 -15
- arkitekt_next/bloks/arkitekt.py +10 -23
- arkitekt_next/bloks/config.py +42 -0
- arkitekt_next/bloks/fluss.py +20 -70
- arkitekt_next/bloks/funcs.py +86 -0
- arkitekt_next/bloks/gateway.py +53 -33
- arkitekt_next/bloks/internal_docker.py +80 -0
- arkitekt_next/bloks/kabinet.py +20 -70
- arkitekt_next/bloks/livekit.py +33 -12
- arkitekt_next/bloks/lok.py +69 -33
- arkitekt_next/bloks/mikro.py +19 -73
- arkitekt_next/bloks/minio.py +28 -28
- arkitekt_next/bloks/mount.py +35 -0
- arkitekt_next/bloks/postgres.py +13 -19
- arkitekt_next/bloks/redis.py +8 -17
- 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.33.dist-info → arkitekt_next-0.7.35.dist-info}/METADATA +1 -1
- {arkitekt_next-0.7.33.dist-info → arkitekt_next-0.7.35.dist-info}/RECORD +36 -20
- arkitekt_next/bloks/services.py +0 -2
- {arkitekt_next-0.7.33.dist-info → arkitekt_next-0.7.35.dist-info}/LICENSE +0 -0
- {arkitekt_next-0.7.33.dist-info → arkitekt_next-0.7.35.dist-info}/WHEEL +0 -0
- {arkitekt_next-0.7.33.dist-info → arkitekt_next-0.7.35.dist-info}/entry_points.txt +0 -0
arkitekt_next/bloks/minio.py
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
|
-
from blok import blok, InitContext, ExecutionContext,
|
|
3
|
+
from blok import blok, InitContext, ExecutionContext, Option
|
|
4
4
|
from blok.tree import YamlFile, Repo
|
|
5
5
|
from pydantic import BaseModel
|
|
6
6
|
from typing import Dict, Optional
|
|
7
7
|
import secrets
|
|
8
8
|
from blok import blok, InitContext
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class S3Credentials(BaseModel):
|
|
12
|
-
access_key: str
|
|
13
|
-
buckets: Dict[str, str]
|
|
14
|
-
host: str
|
|
15
|
-
port: int
|
|
16
|
-
secret_key: str
|
|
17
|
-
protocol: str
|
|
18
|
-
dependency: Optional[str] = None
|
|
9
|
+
from arkitekt_next.bloks.services.s3 import S3Credentials, S3Service
|
|
19
10
|
|
|
20
11
|
|
|
21
12
|
class BucketMapParamType(click.ParamType):
|
|
@@ -38,7 +29,7 @@ class BucketMapParamType(click.ParamType):
|
|
|
38
29
|
TOKEN = BucketMapParamType()
|
|
39
30
|
|
|
40
31
|
|
|
41
|
-
@blok(
|
|
32
|
+
@blok(S3Service)
|
|
42
33
|
class MinioBlok:
|
|
43
34
|
db_name: str
|
|
44
35
|
|
|
@@ -51,6 +42,8 @@ class MinioBlok:
|
|
|
51
42
|
self.port = 9000
|
|
52
43
|
self.skip = False
|
|
53
44
|
self.scopes = {}
|
|
45
|
+
self.init_image = "jhnnsrs/init:paper"
|
|
46
|
+
self.minio_image = "minio/minio:RELEASE.2023-02-10T18-48-39Z"
|
|
54
47
|
self.buckets = []
|
|
55
48
|
self.registered_clients = []
|
|
56
49
|
self.preformed_bucket_names = [secrets.token_hex(16) for i in range(100)]
|
|
@@ -61,9 +54,9 @@ class MinioBlok:
|
|
|
61
54
|
return "live.arkitekt.s3"
|
|
62
55
|
|
|
63
56
|
def get_dependencies(self):
|
|
64
|
-
return []
|
|
57
|
+
return ["live.arkitekt.config", "live.arkitekt.gateway"]
|
|
65
58
|
|
|
66
|
-
def
|
|
59
|
+
def create_buckets(self, buckets: list[str]) -> S3Credentials:
|
|
67
60
|
new_access_key = self.preformed_access_keys.pop()
|
|
68
61
|
new_secret_key = self.preformed_secret_keys.pop()
|
|
69
62
|
|
|
@@ -88,7 +81,7 @@ class MinioBlok:
|
|
|
88
81
|
|
|
89
82
|
return creds
|
|
90
83
|
|
|
91
|
-
def
|
|
84
|
+
def preflight(self, init: InitContext):
|
|
92
85
|
for key, value in init.kwargs.items():
|
|
93
86
|
setattr(self, key, value)
|
|
94
87
|
|
|
@@ -98,6 +91,12 @@ class MinioBlok:
|
|
|
98
91
|
self.preformed_access_keys = list(init.kwargs.get("preformed_access_keys", []))
|
|
99
92
|
self.preformed_secret_keys = list(init.kwargs.get("preformed_secret_keys", []))
|
|
100
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
|
+
|
|
101
100
|
def build(self, context: ExecutionContext):
|
|
102
101
|
minio_service_init = {
|
|
103
102
|
"depends_on": {
|
|
@@ -110,17 +109,18 @@ class MinioBlok:
|
|
|
110
109
|
"MINIO_ROOT_USER": self.username,
|
|
111
110
|
"MINIO_HOST": f"{self.host}:9000",
|
|
112
111
|
},
|
|
112
|
+
"image": self.init_image,
|
|
113
|
+
"volumes": [f"{self.config_path}:/workspace/config.yaml"],
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
minio_service = {
|
|
117
|
+
"command": ["server", "/data"],
|
|
116
118
|
"environment": {
|
|
117
119
|
"MINIO_ROOT_PASSWORD": self.password,
|
|
118
120
|
"MINIO_ROOT_USER": self.username,
|
|
119
121
|
},
|
|
120
|
-
"image":
|
|
121
|
-
"volumes":
|
|
122
|
-
"./data": "/data",
|
|
123
|
-
},
|
|
122
|
+
"image": self.minio_image,
|
|
123
|
+
"volumes": ["./data:/data"],
|
|
124
124
|
"labels": ["fakts.service=live.arkitekt.s3", "fakts.builder=arkitekt.s3"],
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -131,39 +131,39 @@ class MinioBlok:
|
|
|
131
131
|
"services", f"{self.host}_init", minio_service_init
|
|
132
132
|
)
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
context.file_tree.set_nested(
|
|
135
|
+
*self.config_path.split("/"), YamlFile(**{"buckets": list(self.buckets)})
|
|
136
|
+
)
|
|
137
137
|
|
|
138
138
|
def get_options(self):
|
|
139
|
-
with_host =
|
|
139
|
+
with_host = Option(
|
|
140
140
|
subcommand="host",
|
|
141
141
|
help="The fakts url for connection",
|
|
142
142
|
default=self.host,
|
|
143
143
|
)
|
|
144
|
-
with_username =
|
|
144
|
+
with_username = Option(
|
|
145
145
|
subcommand="username",
|
|
146
146
|
help="The fakts url for connection",
|
|
147
147
|
default=self.username,
|
|
148
148
|
)
|
|
149
|
-
with_password =
|
|
149
|
+
with_password = Option(
|
|
150
150
|
subcommand="password",
|
|
151
151
|
help="The fakts url for connection",
|
|
152
152
|
default=self.password,
|
|
153
153
|
)
|
|
154
|
-
with_preformed_bucket_names =
|
|
154
|
+
with_preformed_bucket_names = Option(
|
|
155
155
|
subcommand="preformed_bucket_names",
|
|
156
156
|
help="The fakts url for connection",
|
|
157
157
|
multiple=True,
|
|
158
158
|
default=self.preformed_bucket_names,
|
|
159
159
|
)
|
|
160
|
-
with_preformed_acces_key =
|
|
160
|
+
with_preformed_acces_key = Option(
|
|
161
161
|
subcommand="preformed_access_keys",
|
|
162
162
|
help="The fakts url for connection",
|
|
163
163
|
multiple=True,
|
|
164
164
|
default=self.preformed_access_keys,
|
|
165
165
|
)
|
|
166
|
-
with_preformed_secret_keys =
|
|
166
|
+
with_preformed_secret_keys = Option(
|
|
167
167
|
subcommand="preformed_secret_keys",
|
|
168
168
|
help="The fakts url for connection",
|
|
169
169
|
multiple=True,
|
|
@@ -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]
|
arkitekt_next/bloks/postgres.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from arkitekt_next.bloks.services.db import DBService, DBCredentials
|
|
4
|
+
from blok import blok, InitContext, ExecutionContext, Option
|
|
4
5
|
from blok.tree import YamlFile, Repo
|
|
5
6
|
from pydantic import BaseModel
|
|
6
7
|
import pydantic
|
|
@@ -9,16 +10,9 @@ import secrets
|
|
|
9
10
|
from blok import blok, InitContext
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
class AccessCredentials(BaseModel):
|
|
13
|
-
password: str
|
|
14
|
-
username: str
|
|
15
|
-
host: str
|
|
16
|
-
port: str
|
|
17
|
-
db_name: str
|
|
18
|
-
dependency: Optional[str] = None
|
|
19
13
|
|
|
20
14
|
|
|
21
|
-
@blok(
|
|
15
|
+
@blok(DBService)
|
|
22
16
|
class PostgresBlok(BaseModel):
|
|
23
17
|
host: str = "db"
|
|
24
18
|
port: int = 5432
|
|
@@ -27,7 +21,7 @@ class PostgresBlok(BaseModel):
|
|
|
27
21
|
user: str = pydantic.Field(default_factory=lambda: namegenerator.gen(separator=""))
|
|
28
22
|
image: str = "jhnnsrs/daten:next"
|
|
29
23
|
|
|
30
|
-
registered_dbs: dict[str,
|
|
24
|
+
registered_dbs: dict[str, DBCredentials] = {}
|
|
31
25
|
|
|
32
26
|
def get_dependencies(self):
|
|
33
27
|
return []
|
|
@@ -35,11 +29,11 @@ class PostgresBlok(BaseModel):
|
|
|
35
29
|
def get_identifier(self):
|
|
36
30
|
return "live.arkitekt.postgres"
|
|
37
31
|
|
|
38
|
-
def register_db(self, db_name: str) ->
|
|
32
|
+
def register_db(self, db_name: str) -> DBCredentials:
|
|
39
33
|
if db_name in self.registered_dbs:
|
|
40
34
|
return self.registered_dbs[db_name]
|
|
41
35
|
else:
|
|
42
|
-
access_credentials =
|
|
36
|
+
access_credentials = DBCredentials(
|
|
43
37
|
password=self.password,
|
|
44
38
|
username=self.user,
|
|
45
39
|
host=self.host,
|
|
@@ -50,7 +44,7 @@ class PostgresBlok(BaseModel):
|
|
|
50
44
|
self.registered_dbs[db_name] = access_credentials
|
|
51
45
|
return access_credentials
|
|
52
46
|
|
|
53
|
-
def
|
|
47
|
+
def preflight(self, init: InitContext):
|
|
54
48
|
for key, value in init.kwargs.items():
|
|
55
49
|
setattr(self, key, value)
|
|
56
50
|
|
|
@@ -61,29 +55,29 @@ class PostgresBlok(BaseModel):
|
|
|
61
55
|
"POSTGRES_PASSWORD": self.password,
|
|
62
56
|
"POSTGRES_MULTIPLE_DATABASES": ",".join(self.registered_dbs.keys()),
|
|
63
57
|
},
|
|
64
|
-
"image":
|
|
58
|
+
"image": self.image,
|
|
65
59
|
"labels": ["fakts.service=live.arkitekt.postgres"],
|
|
66
60
|
}
|
|
67
61
|
|
|
68
62
|
context.docker_compose.set_nested(f"services", self.host, db_service)
|
|
69
63
|
|
|
70
64
|
def get_options(self):
|
|
71
|
-
with_postgres_password =
|
|
65
|
+
with_postgres_password = Option(
|
|
72
66
|
subcommand="password",
|
|
73
67
|
help="The postgres password for connection",
|
|
74
68
|
default=self.password,
|
|
75
69
|
)
|
|
76
|
-
with_user_password =
|
|
70
|
+
with_user_password = Option(
|
|
77
71
|
subcommand="user",
|
|
78
72
|
help="The postgress user_name",
|
|
79
|
-
default=self.
|
|
73
|
+
default=self.user,
|
|
80
74
|
)
|
|
81
|
-
skip_build =
|
|
75
|
+
skip_build = Option(
|
|
82
76
|
subcommand="skip",
|
|
83
77
|
help="Should the service not be created? E.g when pointing outwards?",
|
|
84
78
|
default=self.skip,
|
|
85
79
|
)
|
|
86
|
-
with_image =
|
|
80
|
+
with_image = Option(
|
|
87
81
|
subcommand="image",
|
|
88
82
|
help="The image to use for the service",
|
|
89
83
|
default=self.image,
|
arkitekt_next/bloks/redis.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from arkitekt_next.bloks.services.redis import RedisService, RedisConnection
|
|
4
|
+
from blok import blok, InitContext, ExecutionContext, Option
|
|
4
5
|
from blok.tree import YamlFile, Repo
|
|
5
6
|
from pydantic import BaseModel
|
|
6
7
|
from typing import Dict, Any, Optional
|
|
@@ -8,17 +9,8 @@ from typing import Dict, Any, Optional
|
|
|
8
9
|
from blok import blok, InitContext
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
DEFAULT_PUBLIC_URLS = ["127.0.0.1"]
|
|
12
|
-
DEFAULT_PUBLIC_HOSTS = ["localhost"]
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
class RedisConnection(BaseModel):
|
|
16
|
-
host: str
|
|
17
|
-
port: str
|
|
18
|
-
dependency: Optional[str] = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@blok("live.arkitekt.redis")
|
|
13
|
+
@blok(RedisService)
|
|
22
14
|
class RedisBlok:
|
|
23
15
|
def __init__(self) -> None:
|
|
24
16
|
self.host = "redis"
|
|
@@ -39,7 +31,7 @@ class RedisBlok:
|
|
|
39
31
|
dependency=self.host if not self.skip else None,
|
|
40
32
|
)
|
|
41
33
|
|
|
42
|
-
def
|
|
34
|
+
def preflight(self, init: InitContext):
|
|
43
35
|
for key, value in init.kwargs.items():
|
|
44
36
|
setattr(self, key, value)
|
|
45
37
|
|
|
@@ -51,33 +43,32 @@ class RedisBlok:
|
|
|
51
43
|
},
|
|
52
44
|
"image": self.image,
|
|
53
45
|
"ports": [f"{self.port}:{self.port}"],
|
|
54
|
-
"name": self.host,
|
|
55
46
|
}
|
|
56
47
|
|
|
57
48
|
context.docker_compose.set_nested(f"services", self.host, redis_service)
|
|
58
49
|
|
|
59
50
|
def get_options(self):
|
|
60
|
-
with_port =
|
|
51
|
+
with_port = Option(
|
|
61
52
|
subcommand="port",
|
|
62
53
|
help="Which port to use",
|
|
63
54
|
type=int,
|
|
64
55
|
default=self.port,
|
|
65
56
|
show_default=True,
|
|
66
57
|
)
|
|
67
|
-
with_host =
|
|
58
|
+
with_host = Option(
|
|
68
59
|
subcommand="host",
|
|
69
60
|
help="Which public hosts to use",
|
|
70
61
|
type=str,
|
|
71
62
|
default=self.host,
|
|
72
63
|
show_default=True,
|
|
73
64
|
)
|
|
74
|
-
with_skip =
|
|
65
|
+
with_skip = Option(
|
|
75
66
|
subcommand="skip",
|
|
76
67
|
help="Skip docker creation (if using external redis?)",
|
|
77
68
|
is_flag=True,
|
|
78
69
|
default=self.skip,
|
|
79
70
|
)
|
|
80
|
-
with_image =
|
|
71
|
+
with_image = Option(
|
|
81
72
|
subcommand="image",
|
|
82
73
|
help="The image to use for the service",
|
|
83
74
|
default=self.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
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
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.docker_socket")
|
|
10
|
+
class DockerSocketService(Protocol):
|
|
11
|
+
|
|
12
|
+
def register_socket(self, name: str) -> str:
|
|
13
|
+
self.registered_configs[name] = name
|
|
14
|
+
return self.docker_socket
|
|
15
|
+
|
|
16
|
+
|