arkitekt-next 0.7.8__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/__init__.py +43 -0
- arkitekt_next/apps/__init__.py +3 -0
- arkitekt_next/apps/easy.py +99 -0
- arkitekt_next/apps/next.py +40 -0
- arkitekt_next/apps/qt.py +97 -0
- arkitekt_next/apps/service/__init__.py +3 -0
- arkitekt_next/apps/service/fakts.py +88 -0
- arkitekt_next/apps/service/fakts_next.py +79 -0
- arkitekt_next/apps/service/fakts_qt.py +82 -0
- arkitekt_next/apps/service/fluss_next.py +31 -0
- arkitekt_next/apps/service/grant_registry.py +27 -0
- arkitekt_next/apps/service/herre.py +24 -0
- arkitekt_next/apps/service/herre_qt.py +57 -0
- arkitekt_next/apps/service/kabinet.py +31 -0
- arkitekt_next/apps/service/mikro_next.py +81 -0
- arkitekt_next/apps/service/rekuest_next.py +53 -0
- arkitekt_next/apps/service/unlok_next.py +32 -0
- arkitekt_next/apps/types.py +53 -0
- arkitekt_next/builders.py +264 -0
- arkitekt_next/cli/__init__.py +0 -0
- arkitekt_next/cli/commands/call/__init__.py +0 -0
- arkitekt_next/cli/commands/call/local.py +132 -0
- arkitekt_next/cli/commands/call/main.py +22 -0
- arkitekt_next/cli/commands/call/remote.py +90 -0
- arkitekt_next/cli/commands/gen/__init__.py +0 -0
- arkitekt_next/cli/commands/gen/compile.py +45 -0
- arkitekt_next/cli/commands/gen/init.py +122 -0
- arkitekt_next/cli/commands/gen/main.py +29 -0
- arkitekt_next/cli/commands/gen/watch.py +32 -0
- arkitekt_next/cli/commands/init/__init__.py +0 -0
- arkitekt_next/cli/commands/init/main.py +194 -0
- arkitekt_next/cli/commands/inspect/__init__.py +0 -0
- arkitekt_next/cli/commands/inspect/definitions.py +53 -0
- arkitekt_next/cli/commands/inspect/main.py +22 -0
- arkitekt_next/cli/commands/inspect/variables.py +92 -0
- arkitekt_next/cli/commands/manifest/__init__.py +0 -0
- arkitekt_next/cli/commands/manifest/inspect.py +42 -0
- arkitekt_next/cli/commands/manifest/main.py +25 -0
- arkitekt_next/cli/commands/manifest/scopes.py +155 -0
- arkitekt_next/cli/commands/manifest/version.py +147 -0
- arkitekt_next/cli/commands/manifest/wizard.py +94 -0
- arkitekt_next/cli/commands/port/__init__.py +0 -0
- arkitekt_next/cli/commands/port/build.py +231 -0
- arkitekt_next/cli/commands/port/init.py +82 -0
- arkitekt_next/cli/commands/port/main.py +31 -0
- arkitekt_next/cli/commands/port/publish.py +102 -0
- arkitekt_next/cli/commands/port/stage.py +59 -0
- arkitekt_next/cli/commands/port/utils.py +47 -0
- arkitekt_next/cli/commands/port/validate.py +78 -0
- arkitekt_next/cli/commands/port/wizard.py +329 -0
- arkitekt_next/cli/commands/run/__init__.py +0 -0
- arkitekt_next/cli/commands/run/dev.py +349 -0
- arkitekt_next/cli/commands/run/main.py +22 -0
- arkitekt_next/cli/commands/run/prod.py +57 -0
- arkitekt_next/cli/commands/run/utils.py +10 -0
- arkitekt_next/cli/commands/server/__init__.py +0 -0
- arkitekt_next/cli/commands/server/down.py +56 -0
- arkitekt_next/cli/commands/server/init.py +74 -0
- arkitekt_next/cli/commands/server/inspect.py +59 -0
- arkitekt_next/cli/commands/server/main.py +33 -0
- arkitekt_next/cli/commands/server/open.py +66 -0
- arkitekt_next/cli/commands/server/remove.py +60 -0
- arkitekt_next/cli/commands/server/stop.py +56 -0
- arkitekt_next/cli/commands/server/up.py +70 -0
- arkitekt_next/cli/commands/server/utils.py +33 -0
- arkitekt_next/cli/configs/base.yaml +867 -0
- arkitekt_next/cli/constants.py +63 -0
- arkitekt_next/cli/dockerfiles/vanilla.dockerfile +8 -0
- arkitekt_next/cli/errors.py +4 -0
- arkitekt_next/cli/inspect.py +1 -0
- arkitekt_next/cli/io.py +255 -0
- arkitekt_next/cli/main.py +83 -0
- arkitekt_next/cli/options.py +166 -0
- arkitekt_next/cli/schemas/fluss.schema.graphql +2446 -0
- arkitekt_next/cli/schemas/gucker.schema.graphql +8908 -0
- arkitekt_next/cli/schemas/kabinet.schema.graphql +515 -0
- arkitekt_next/cli/schemas/kluster.schema.graphql +109 -0
- arkitekt_next/cli/schemas/konviktion.schema.graphql +70 -0
- arkitekt_next/cli/schemas/kuay.schema.graphql +356 -0
- arkitekt_next/cli/schemas/mikro.schema.graphql +8908 -0
- arkitekt_next/cli/schemas/mikro_next.schema.graphql +1639 -0
- arkitekt_next/cli/schemas/napari.schema.graphql +8908 -0
- arkitekt_next/cli/schemas/omero_ark.schema.graphql +100 -0
- arkitekt_next/cli/schemas/port.schema.graphql +356 -0
- arkitekt_next/cli/schemas/rekuest.schema.graphql +4630 -0
- arkitekt_next/cli/schemas/rekuest_next.schema.graphql +1159 -0
- arkitekt_next/cli/schemas/unlok.schema.graphql +1013 -0
- arkitekt_next/cli/templates/filter.py +26 -0
- arkitekt_next/cli/templates/simple.py +67 -0
- arkitekt_next/cli/texts.py +20 -0
- arkitekt_next/cli/types.py +365 -0
- arkitekt_next/cli/ui.py +111 -0
- arkitekt_next/cli/utils.py +15 -0
- arkitekt_next/cli/validators.py +17 -0
- arkitekt_next/cli/vars.py +39 -0
- arkitekt_next/cli/versions/v1.yaml +1 -0
- arkitekt_next/constants.py +6 -0
- arkitekt_next/model.py +110 -0
- arkitekt_next/qt/__init__.py +9 -0
- arkitekt_next/qt/assets/dark/gear.png +0 -0
- arkitekt_next/qt/assets/dark/green pulse.gif +0 -0
- arkitekt_next/qt/assets/dark/orange pulse.gif +0 -0
- arkitekt_next/qt/assets/dark/pink pulse.gif +0 -0
- arkitekt_next/qt/assets/dark/red pulse.gif +0 -0
- arkitekt_next/qt/assets/light/gear.png +0 -0
- arkitekt_next/qt/assets/light/green pulse.gif +0 -0
- arkitekt_next/qt/assets/light/orange pulse.gif +0 -0
- arkitekt_next/qt/assets/light/pink pulse.gif +0 -0
- arkitekt_next/qt/assets/light/red pulse.gif +0 -0
- arkitekt_next/qt/magic_bar.py +545 -0
- arkitekt_next/qt/utils.py +30 -0
- arkitekt_next/service_registry.py +51 -0
- arkitekt_next/tqdm.py +43 -0
- arkitekt_next/utils.py +38 -0
- arkitekt_next-0.7.8.dist-info/LICENSE +21 -0
- arkitekt_next-0.7.8.dist-info/METADATA +155 -0
- arkitekt_next-0.7.8.dist-info/RECORD +119 -0
- arkitekt_next-0.7.8.dist-info/WHEEL +4 -0
- arkitekt_next-0.7.8.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import rich_click as click
|
|
2
|
+
from arkitekt_next.cli.options import *
|
|
3
|
+
import asyncio
|
|
4
|
+
from arkitekt_next.cli.ui import construct_run_panel
|
|
5
|
+
from importlib import import_module
|
|
6
|
+
from .utils import import_builder
|
|
7
|
+
from arkitekt_next.constants import DEFAULT_ARKITEKT_URL
|
|
8
|
+
|
|
9
|
+
async def run_app(app):
|
|
10
|
+
async with app:
|
|
11
|
+
await app.rekuest.run()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@click.command("prod")
|
|
15
|
+
@click.option(
|
|
16
|
+
"--url",
|
|
17
|
+
help="The fakts url for connection",
|
|
18
|
+
default=DEFAULT_ARKITEKT_URL,
|
|
19
|
+
envvar="FAKTS_URL",
|
|
20
|
+
)
|
|
21
|
+
@with_builder
|
|
22
|
+
@with_token
|
|
23
|
+
@with_instance_id
|
|
24
|
+
@with_headless
|
|
25
|
+
@with_log_level
|
|
26
|
+
@with_skip_cache
|
|
27
|
+
@click.pass_context
|
|
28
|
+
def prod(ctx, entrypoint=None, builder=None, **builder_kwargs):
|
|
29
|
+
"""Runs the app in production mode
|
|
30
|
+
|
|
31
|
+
\n
|
|
32
|
+
You can specify the builder to use with the --builder flag. By default, the easy builder is used, which is designed to be easy to use and to get started with.
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
manifest = get_manifest(ctx)
|
|
37
|
+
console = get_console(ctx)
|
|
38
|
+
entrypoint = entrypoint or manifest.entrypoint
|
|
39
|
+
|
|
40
|
+
builder = import_builder(builder)
|
|
41
|
+
|
|
42
|
+
with console.status("Loading entrypoint module..."):
|
|
43
|
+
try:
|
|
44
|
+
import_module(entrypoint)
|
|
45
|
+
except ModuleNotFoundError as e:
|
|
46
|
+
console.print(f"Could not find entrypoint module {entrypoint}")
|
|
47
|
+
raise e
|
|
48
|
+
|
|
49
|
+
app = builder(
|
|
50
|
+
**manifest.to_builder_dict(),
|
|
51
|
+
**builder_kwargs,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
panel = construct_run_panel(app)
|
|
55
|
+
console.print(panel)
|
|
56
|
+
|
|
57
|
+
asyncio.run(run_app(app))
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from importlib import import_module
|
|
2
|
+
from typing import Callable
|
|
3
|
+
from arkitekt_next.apps.types import App
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def import_builder(builder: str) -> Callable[..., App]:
|
|
7
|
+
module_path, function_name = builder.rsplit(".", 1)
|
|
8
|
+
module = import_module(module_path)
|
|
9
|
+
function = getattr(module, function_name)
|
|
10
|
+
return function
|
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import rich_click as click
|
|
2
|
+
from click import Context
|
|
3
|
+
from dokker.projects.dokker import DokkerProject
|
|
4
|
+
from dokker.loggers.print import PrintLogger
|
|
5
|
+
from dokker.deployment import Deployment
|
|
6
|
+
from typing import Optional
|
|
7
|
+
import os
|
|
8
|
+
from .utils import compile_options
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.command()
|
|
12
|
+
@click.option(
|
|
13
|
+
"--name",
|
|
14
|
+
help="The name of the deployment",
|
|
15
|
+
default=None,
|
|
16
|
+
required=False,
|
|
17
|
+
type=click.Choice(compile_options()),
|
|
18
|
+
)
|
|
19
|
+
@click.pass_context
|
|
20
|
+
def down(
|
|
21
|
+
ctx: Context,
|
|
22
|
+
name: Optional[str] = None,
|
|
23
|
+
) -> None:
|
|
24
|
+
"""
|
|
25
|
+
Down a deployment
|
|
26
|
+
|
|
27
|
+
Removing a deployment will stop all containers and call docker compose down
|
|
28
|
+
on the project. This will remove all containers and networks created by the
|
|
29
|
+
deployment. The deployment will still be available in the .dokker folder
|
|
30
|
+
However (depending on your settings) data that was stored in volumes managed
|
|
31
|
+
by the deployment will be removed.
|
|
32
|
+
|
|
33
|
+
If you want to simple Stop the deployment, use the stop command instead.
|
|
34
|
+
|
|
35
|
+
"""
|
|
36
|
+
if not name:
|
|
37
|
+
options = compile_options()
|
|
38
|
+
if not options:
|
|
39
|
+
raise click.ClickException(
|
|
40
|
+
"No deployments found. Please run arkitekt_next server init first"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
name = options[0]
|
|
44
|
+
|
|
45
|
+
print(f"Running {name}")
|
|
46
|
+
|
|
47
|
+
project = DokkerProject(
|
|
48
|
+
name=name,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
deployment = Deployment(project=project, logger=PrintLogger())
|
|
52
|
+
with deployment:
|
|
53
|
+
deployment.down()
|
|
54
|
+
print("Shutting down...")
|
|
55
|
+
|
|
56
|
+
print("Done")
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import rich_click as click
|
|
2
|
+
from click import Context
|
|
3
|
+
from dokker.projects.contrib.konstruktor import KonstruktorProject, RemoteRepo
|
|
4
|
+
import asyncio
|
|
5
|
+
from typing import Optional
|
|
6
|
+
import os
|
|
7
|
+
from arkitekt_next.cli.vars import get_console
|
|
8
|
+
|
|
9
|
+
DEFAULT_REPO_URL = "https://arkitekt_next.live/repo.json"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@click.command()
|
|
13
|
+
@click.option(
|
|
14
|
+
"--repo-url",
|
|
15
|
+
help="The repo to use",
|
|
16
|
+
default=DEFAULT_REPO_URL,
|
|
17
|
+
prompt="What repo do you want to use?",
|
|
18
|
+
)
|
|
19
|
+
@click.option(
|
|
20
|
+
"--channel",
|
|
21
|
+
help="The channel to use",
|
|
22
|
+
default="beta",
|
|
23
|
+
prompt="What channel do you want to use?",
|
|
24
|
+
)
|
|
25
|
+
@click.option(
|
|
26
|
+
"--name",
|
|
27
|
+
help="The name of the deployment",
|
|
28
|
+
default=None,
|
|
29
|
+
required=False,
|
|
30
|
+
)
|
|
31
|
+
@click.option(
|
|
32
|
+
"--overwrite",
|
|
33
|
+
help="Should we overwrite the old deployment?",
|
|
34
|
+
default=False,
|
|
35
|
+
is_flag=True,
|
|
36
|
+
)
|
|
37
|
+
@click.option(
|
|
38
|
+
"--setup",
|
|
39
|
+
"-s",
|
|
40
|
+
"setup",
|
|
41
|
+
help="Additional setup variables",
|
|
42
|
+
type=(str, str),
|
|
43
|
+
multiple=True,
|
|
44
|
+
)
|
|
45
|
+
@click.pass_context
|
|
46
|
+
def init(
|
|
47
|
+
ctx: Context,
|
|
48
|
+
channel: str,
|
|
49
|
+
repo_url: str,
|
|
50
|
+
overwrite: bool = False,
|
|
51
|
+
setup: Optional[list] = None,
|
|
52
|
+
name: Optional[str] = None,
|
|
53
|
+
) -> None:
|
|
54
|
+
"""
|
|
55
|
+
Initializes a new server
|
|
56
|
+
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
extra_content = dict(setup or [])
|
|
60
|
+
|
|
61
|
+
project = KonstruktorProject(
|
|
62
|
+
channel=channel,
|
|
63
|
+
repo=RemoteRepo(url=repo_url),
|
|
64
|
+
reinit_if_exists=overwrite,
|
|
65
|
+
name=name,
|
|
66
|
+
extra_context=extra_content,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
asyncio.run(project.ainititialize())
|
|
71
|
+
get_console(ctx).print("Done :)")
|
|
72
|
+
except Exception as e:
|
|
73
|
+
get_console(ctx).print_exception()
|
|
74
|
+
raise click.ClickException("Failed to initialize project") from e
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import rich_click as click
|
|
2
|
+
from click import Context
|
|
3
|
+
from dokker.projects.dokker import DokkerProject
|
|
4
|
+
from dokker.loggers.print import PrintLogger
|
|
5
|
+
from dokker.deployment import Deployment
|
|
6
|
+
from typing import Optional
|
|
7
|
+
import os
|
|
8
|
+
from .utils import compile_options
|
|
9
|
+
from rich.table import Table
|
|
10
|
+
from rich.live import Live
|
|
11
|
+
from arkitekt_next.cli.vars import get_console
|
|
12
|
+
import json
|
|
13
|
+
|
|
14
|
+
DEFAULT_REPO_URL = (
|
|
15
|
+
"https://raw.githubusercontent.com/jhnnsrs/konstruktor/master/repo/channels.json"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@click.command()
|
|
20
|
+
@click.option(
|
|
21
|
+
"--name",
|
|
22
|
+
help="The name of the deployment",
|
|
23
|
+
default=None,
|
|
24
|
+
required=False,
|
|
25
|
+
type=click.Choice(compile_options()),
|
|
26
|
+
)
|
|
27
|
+
@click.pass_context
|
|
28
|
+
def inspect(
|
|
29
|
+
ctx: Context,
|
|
30
|
+
name: Optional[str] = None,
|
|
31
|
+
) -> None:
|
|
32
|
+
"""
|
|
33
|
+
Inspect a deployment
|
|
34
|
+
|
|
35
|
+
Inspect helps you find information about a deployment. It will show you
|
|
36
|
+
information about the containers, networks and volumes created by the
|
|
37
|
+
deployment. If you have not run arkitekt_next server init before, this will
|
|
38
|
+
fail.
|
|
39
|
+
|
|
40
|
+
"""
|
|
41
|
+
if not name:
|
|
42
|
+
options = compile_options()
|
|
43
|
+
if not options:
|
|
44
|
+
raise click.ClickException(
|
|
45
|
+
"No deployments found. Please run arkitekt_next server init first"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
name = options[0]
|
|
49
|
+
|
|
50
|
+
project = DokkerProject(
|
|
51
|
+
name=name,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
console = get_console(ctx)
|
|
55
|
+
|
|
56
|
+
deployment = Deployment(project=project)
|
|
57
|
+
|
|
58
|
+
with deployment:
|
|
59
|
+
print(json.dumps(deployment.inspect().dict(), indent=4))
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import rich_click as click
|
|
2
|
+
from .init import init
|
|
3
|
+
from .up import up
|
|
4
|
+
from .down import down
|
|
5
|
+
from .inspect import inspect
|
|
6
|
+
from .remove import remove
|
|
7
|
+
from .open import open
|
|
8
|
+
from .stop import stop
|
|
9
|
+
from click import Context
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@click.group()
|
|
13
|
+
@click.pass_context
|
|
14
|
+
def server(ctx: Context) -> None:
|
|
15
|
+
"""Manages your arkitekt_next deployments
|
|
16
|
+
|
|
17
|
+
You can directly deploy your app to a server with the arkitekt_next server command. This will
|
|
18
|
+
create a local docker-compose.yml file and a .arkitekt_next folder in your project. You can then
|
|
19
|
+
use the arkitekt_next server build command to build your app for port and the arkitekt_next server run
|
|
20
|
+
command to run your app on the server.
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
server.add_command(init, "init")
|
|
28
|
+
server.add_command(up, "up")
|
|
29
|
+
server.add_command(down, "down")
|
|
30
|
+
server.add_command(remove, "remove")
|
|
31
|
+
server.add_command(inspect, "inspect")
|
|
32
|
+
server.add_command(open, "open")
|
|
33
|
+
server.add_command(stop, "stop")
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import rich_click as click
|
|
2
|
+
from click import Context
|
|
3
|
+
from dokker.projects.dokker import DokkerProject
|
|
4
|
+
from dokker.loggers.print import PrintLogger
|
|
5
|
+
from dokker.deployment import Deployment
|
|
6
|
+
from typing import Optional, List
|
|
7
|
+
import os
|
|
8
|
+
from .utils import compile_options
|
|
9
|
+
from rich.table import Table
|
|
10
|
+
from rich.live import Live
|
|
11
|
+
from arkitekt_next.cli.vars import get_console
|
|
12
|
+
import webbrowser
|
|
13
|
+
|
|
14
|
+
DEFAULT_REPO_URL = (
|
|
15
|
+
"https://raw.githubusercontent.com/jhnnsrs/konstruktor/master/repo/channels.json"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@click.command()
|
|
20
|
+
@click.option(
|
|
21
|
+
"--name",
|
|
22
|
+
help="The name of the deployment",
|
|
23
|
+
default=None,
|
|
24
|
+
required=False,
|
|
25
|
+
type=click.Choice(compile_options()),
|
|
26
|
+
)
|
|
27
|
+
@click.argument("services", nargs=-1, required=False)
|
|
28
|
+
@click.pass_context
|
|
29
|
+
def open(
|
|
30
|
+
ctx: Context,
|
|
31
|
+
name: Optional[str] = None,
|
|
32
|
+
services: List[str] = None,
|
|
33
|
+
) -> None:
|
|
34
|
+
"""
|
|
35
|
+
Opens a service in the browser
|
|
36
|
+
|
|
37
|
+
This will open the service in the browser. If you have not run arkitekt_next server init
|
|
38
|
+
before, this will fail.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
if not name:
|
|
43
|
+
options = compile_options()
|
|
44
|
+
if not options:
|
|
45
|
+
raise click.ClickException(
|
|
46
|
+
"No deployments found. Please run arkitekt_next server init first"
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
name = options[0]
|
|
50
|
+
|
|
51
|
+
project = DokkerProject(
|
|
52
|
+
name=name,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
console = get_console(ctx)
|
|
56
|
+
|
|
57
|
+
deployment = Deployment(project=project)
|
|
58
|
+
|
|
59
|
+
if not services:
|
|
60
|
+
services = ["orkestrator"]
|
|
61
|
+
|
|
62
|
+
with deployment:
|
|
63
|
+
for service in services:
|
|
64
|
+
link = deployment.inspect().find_service(service).get_label("arkitekt_next.link")
|
|
65
|
+
console.print(f"Opening {service} at [link={link}]{link}[/link]")
|
|
66
|
+
webbrowser.open(link)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import rich_click as click
|
|
2
|
+
from click import Context
|
|
3
|
+
from dokker.projects.dokker import DokkerProject
|
|
4
|
+
from dokker.loggers.print import PrintLogger
|
|
5
|
+
from dokker.deployment import Deployment
|
|
6
|
+
from typing import Optional
|
|
7
|
+
import os
|
|
8
|
+
from .utils import compile_options
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.command()
|
|
12
|
+
@click.option(
|
|
13
|
+
"--name",
|
|
14
|
+
help="The name of the deployment",
|
|
15
|
+
default=None,
|
|
16
|
+
required=False,
|
|
17
|
+
type=click.Choice(compile_options()),
|
|
18
|
+
)
|
|
19
|
+
@click.pass_context
|
|
20
|
+
def remove(
|
|
21
|
+
ctx: Context,
|
|
22
|
+
name: Optional[str] = None,
|
|
23
|
+
) -> None:
|
|
24
|
+
"""
|
|
25
|
+
Remove a deployment
|
|
26
|
+
|
|
27
|
+
Removing a deployment will stop all containers and call docker compose down
|
|
28
|
+
on the project. This will remove all containers and networks created by the
|
|
29
|
+
deployment. As opposed to the down command, the deployment will also be
|
|
30
|
+
removed from the .dokker folder, and all data stored in volumes managed by
|
|
31
|
+
the deployment will be removed.
|
|
32
|
+
|
|
33
|
+
This step is irreversible, so use with caution.
|
|
34
|
+
|
|
35
|
+
"""
|
|
36
|
+
if not name:
|
|
37
|
+
options = compile_options()
|
|
38
|
+
if not options:
|
|
39
|
+
raise click.ClickException(
|
|
40
|
+
"No deployments found. Please run arkitekt_next server init first"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
name = options[0]
|
|
44
|
+
|
|
45
|
+
print(f"Running {name}")
|
|
46
|
+
|
|
47
|
+
project = DokkerProject(
|
|
48
|
+
name=name,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
deployment = Deployment(project=project, logger=PrintLogger())
|
|
52
|
+
|
|
53
|
+
with deployment:
|
|
54
|
+
print("Shutting down...")
|
|
55
|
+
deployment.down()
|
|
56
|
+
|
|
57
|
+
print("Removing...")
|
|
58
|
+
deployment.remove()
|
|
59
|
+
|
|
60
|
+
print("Done")
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import rich_click as click
|
|
2
|
+
from click import Context
|
|
3
|
+
from dokker.projects.dokker import DokkerProject
|
|
4
|
+
from dokker.loggers.print import PrintLogger
|
|
5
|
+
from dokker.deployment import Deployment
|
|
6
|
+
from typing import Optional
|
|
7
|
+
import os
|
|
8
|
+
from .utils import compile_options
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.command()
|
|
12
|
+
@click.option(
|
|
13
|
+
"--name",
|
|
14
|
+
help="The name of the deployment",
|
|
15
|
+
default=None,
|
|
16
|
+
required=False,
|
|
17
|
+
type=click.Choice(compile_options()),
|
|
18
|
+
)
|
|
19
|
+
@click.pass_context
|
|
20
|
+
def stop(
|
|
21
|
+
ctx: Context,
|
|
22
|
+
name: Optional[str] = None,
|
|
23
|
+
) -> None:
|
|
24
|
+
"""
|
|
25
|
+
Stop a deployment
|
|
26
|
+
|
|
27
|
+
Stopping a deployment will stop all containers and call docker compose stop
|
|
28
|
+
on the project. This will stop all containers and networks created by the
|
|
29
|
+
deployment. The deployment will still be available in the .dokker folder
|
|
30
|
+
|
|
31
|
+
This should not be confused with the down command, which will remove all
|
|
32
|
+
containers and remove all networks created by the deployment.
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
if not name:
|
|
36
|
+
options = compile_options()
|
|
37
|
+
if not options:
|
|
38
|
+
raise click.ClickException(
|
|
39
|
+
"No deployments found. Please run arkitekt_next server init first"
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
name = options[0]
|
|
43
|
+
|
|
44
|
+
print(f"Stopping {name}")
|
|
45
|
+
|
|
46
|
+
project = DokkerProject(
|
|
47
|
+
name=name,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
deployment = Deployment(project=project, logger=PrintLogger())
|
|
51
|
+
|
|
52
|
+
with deployment:
|
|
53
|
+
print("Shutting down...")
|
|
54
|
+
deployment.stop()
|
|
55
|
+
|
|
56
|
+
print("Done")
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import rich_click as click
|
|
2
|
+
from click import Context
|
|
3
|
+
from dokker.projects.dokker import DokkerProject
|
|
4
|
+
from dokker.loggers.print import PrintLogger
|
|
5
|
+
from dokker.deployment import Deployment
|
|
6
|
+
from typing import Optional
|
|
7
|
+
import os
|
|
8
|
+
from .utils import compile_options
|
|
9
|
+
from rich.table import Table
|
|
10
|
+
from rich.live import Live
|
|
11
|
+
from arkitekt_next.cli.vars import get_console
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
DEFAULT_REPO_URL = (
|
|
15
|
+
"https://raw.githubusercontent.com/jhnnsrs/konstruktor/master/repo/channels.json"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@click.command()
|
|
20
|
+
@click.option(
|
|
21
|
+
"--name",
|
|
22
|
+
help="The name of the deployment",
|
|
23
|
+
default=None,
|
|
24
|
+
required=False,
|
|
25
|
+
type=click.Choice(compile_options()),
|
|
26
|
+
)
|
|
27
|
+
@click.pass_context
|
|
28
|
+
def up(
|
|
29
|
+
ctx: Context,
|
|
30
|
+
name: Optional[str] = None,
|
|
31
|
+
) -> None:
|
|
32
|
+
"""
|
|
33
|
+
Ups a deployment
|
|
34
|
+
|
|
35
|
+
Up starts your deployment. This will create all containers and networks
|
|
36
|
+
needed for your deployment. If you have not run arkitekt_next server init
|
|
37
|
+
before, this will fail.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
"""
|
|
41
|
+
if not name:
|
|
42
|
+
options = compile_options()
|
|
43
|
+
if not options:
|
|
44
|
+
raise click.ClickException(
|
|
45
|
+
"No deployments found. Please run arkitekt_next server init first"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
name = options[0]
|
|
49
|
+
|
|
50
|
+
print(f"Running {name}")
|
|
51
|
+
|
|
52
|
+
project = DokkerProject(
|
|
53
|
+
name=name,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
console = get_console(ctx)
|
|
57
|
+
|
|
58
|
+
logger = PrintLogger(print_function=lambda x: console.log(x))
|
|
59
|
+
|
|
60
|
+
deployment = Deployment(project=project, logger=logger)
|
|
61
|
+
|
|
62
|
+
with deployment:
|
|
63
|
+
port = deployment.inspect().find_service("lok").get_label("arkitekt_next.link")
|
|
64
|
+
|
|
65
|
+
status = console.status(
|
|
66
|
+
f"[bold green]Running on the Lok Server Port {port} Press Ctrl+c once to cancel..."
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
with status:
|
|
70
|
+
x = deployment.up(detach=False)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from typing import List
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def compile_options() -> List[str]:
|
|
6
|
+
"""Compiles the available options for the server up and down commands:
|
|
7
|
+
|
|
8
|
+
All deployments in the .arkitekt_next/deployments folder
|
|
9
|
+
"""
|
|
10
|
+
deployments = os.path.join(os.getcwd(), ".dokker")
|
|
11
|
+
|
|
12
|
+
available_deployments = []
|
|
13
|
+
|
|
14
|
+
if not os.path.exists(deployments):
|
|
15
|
+
return available_deployments
|
|
16
|
+
|
|
17
|
+
for deployment in os.listdir(deployments):
|
|
18
|
+
if os.path.isdir(os.path.join(deployments, deployment)):
|
|
19
|
+
available_deployments.append(deployment)
|
|
20
|
+
|
|
21
|
+
return available_deployments
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def build_server_path(name: str) -> str:
|
|
25
|
+
"""Builds the path to the server
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
name (str): The name of the server
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
str: The path to the server
|
|
32
|
+
"""
|
|
33
|
+
return os.path.join(os.getcwd(), ".arkitekt_next", "servers", name)
|