fujin-cli 0.2.0__py3-none-any.whl → 0.4.0__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 fujin-cli might be problematic. Click here for more details.
- fujin/__main__.py +22 -4
- fujin/commands/__init__.py +1 -2
- fujin/commands/_base.py +34 -41
- fujin/commands/app.py +78 -10
- fujin/commands/config.py +16 -125
- fujin/commands/deploy.py +93 -31
- fujin/commands/docs.py +16 -0
- fujin/commands/down.py +33 -15
- fujin/commands/init.py +82 -0
- fujin/commands/proxy.py +71 -0
- fujin/commands/prune.py +42 -0
- fujin/commands/redeploy.py +39 -10
- fujin/commands/rollback.py +49 -0
- fujin/commands/secrets.py +11 -0
- fujin/commands/server.py +65 -30
- fujin/commands/up.py +4 -5
- fujin/config.py +186 -27
- fujin/connection.py +75 -0
- fujin/hooks.py +48 -8
- fujin/process_managers/__init__.py +16 -5
- fujin/process_managers/systemd.py +98 -48
- fujin/proxies/__init__.py +23 -6
- fujin/proxies/caddy.py +195 -30
- fujin/proxies/dummy.py +16 -3
- fujin/proxies/nginx.py +109 -36
- fujin/templates/simple.service +14 -0
- fujin/templates/web.service +12 -11
- fujin/templates/web.socket +2 -2
- fujin_cli-0.4.0.dist-info/METADATA +66 -0
- fujin_cli-0.4.0.dist-info/RECORD +35 -0
- fujin/host.py +0 -85
- fujin/templates/other.service +0 -15
- fujin_cli-0.2.0.dist-info/METADATA +0 -52
- fujin_cli-0.2.0.dist-info/RECORD +0 -29
- {fujin_cli-0.2.0.dist-info → fujin_cli-0.4.0.dist-info}/WHEEL +0 -0
- {fujin_cli-0.2.0.dist-info → fujin_cli-0.4.0.dist-info}/entry_points.txt +0 -0
- {fujin_cli-0.2.0.dist-info → fujin_cli-0.4.0.dist-info}/licenses/LICENSE.txt +0 -0
fujin/host.py
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from contextlib import contextmanager
|
|
4
|
-
from dataclasses import dataclass
|
|
5
|
-
from functools import cached_property
|
|
6
|
-
|
|
7
|
-
import cappa
|
|
8
|
-
from fabric import Connection
|
|
9
|
-
from invoke import Responder
|
|
10
|
-
from paramiko.ssh_exception import AuthenticationException
|
|
11
|
-
|
|
12
|
-
from .config import HostConfig
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@dataclass(frozen=True)
|
|
16
|
-
class Host:
|
|
17
|
-
config: HostConfig
|
|
18
|
-
|
|
19
|
-
def __str__(self):
|
|
20
|
-
return self.config.ip
|
|
21
|
-
|
|
22
|
-
@property
|
|
23
|
-
def watchers(self) -> list[Responder]:
|
|
24
|
-
if not self.config.password:
|
|
25
|
-
return []
|
|
26
|
-
return [
|
|
27
|
-
Responder(
|
|
28
|
-
pattern=r"\[sudo\] password:",
|
|
29
|
-
response=f"{self.config.password}\n",
|
|
30
|
-
)
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
@cached_property
|
|
34
|
-
def connection(self) -> Connection:
|
|
35
|
-
connect_kwargs = None
|
|
36
|
-
if self.config.key_filename:
|
|
37
|
-
connect_kwargs = {"key_filename": str(self.config.key_filename)}
|
|
38
|
-
elif self.config.password:
|
|
39
|
-
connect_kwargs = {"password": self.config.password}
|
|
40
|
-
|
|
41
|
-
return Connection(
|
|
42
|
-
self.config.ip,
|
|
43
|
-
user=self.config.user,
|
|
44
|
-
port=self.config.ssh_port,
|
|
45
|
-
connect_kwargs=connect_kwargs,
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
def run(self, args: str, **kwargs):
|
|
49
|
-
try:
|
|
50
|
-
return self.connection.run(args, **kwargs, watchers=self.watchers)
|
|
51
|
-
except AuthenticationException as e:
|
|
52
|
-
msg = f"Authentication failed for {self.config.user}@{self.config.ip} -p {self.config.ssh_port}.\n"
|
|
53
|
-
if self.config.key_filename:
|
|
54
|
-
msg += f"An SSH key was provided at {self.config.key_filename.resolve()}. Please verify its validity and correctness."
|
|
55
|
-
elif self.config.password:
|
|
56
|
-
msg += f"A password was provided through the environment variable {self.config.password_env}. Please ensure it is correct for the user {self.config.user}."
|
|
57
|
-
else:
|
|
58
|
-
msg += "No password or SSH key was provided. Ensure your current host has SSH access to the target host."
|
|
59
|
-
raise cappa.Exit(msg, code=1) from e
|
|
60
|
-
|
|
61
|
-
def put(self, *args, **kwargs):
|
|
62
|
-
return self.connection.put(args, **kwargs, watchers=self.watchers)
|
|
63
|
-
|
|
64
|
-
def get(self, *args, **kwargs):
|
|
65
|
-
return self.connection.get(args, **kwargs, watchers=self.watchers)
|
|
66
|
-
|
|
67
|
-
def sudo(self, args: str, **kwargs):
|
|
68
|
-
return self.connection.sudo(args, **kwargs)
|
|
69
|
-
|
|
70
|
-
def run_uv(self, args: str, **kwargs):
|
|
71
|
-
return self.run(f"/home/{self.config.user}/.cargo/bin/uv {args}", **kwargs)
|
|
72
|
-
|
|
73
|
-
def run_caddy(self, args: str, **kwargs):
|
|
74
|
-
return self.run(f"/home/{self.config.user}/.local/bin/caddy {args}", **kwargs)
|
|
75
|
-
|
|
76
|
-
def make_project_dir(self, project_name: str):
|
|
77
|
-
self.run(f"mkdir -p {self.project_dir(project_name)}")
|
|
78
|
-
|
|
79
|
-
def project_dir(self, project_name: str) -> str:
|
|
80
|
-
return f"{self.config.projects_dir}/{project_name}"
|
|
81
|
-
|
|
82
|
-
@contextmanager
|
|
83
|
-
def cd_project_dir(self, project_name: str):
|
|
84
|
-
with self.connection.cd(self.project_dir(project_name)):
|
|
85
|
-
yield
|
fujin/templates/other.service
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
[Unit]
|
|
2
|
-
Description={app} Worker
|
|
3
|
-
|
|
4
|
-
[Service]
|
|
5
|
-
User={user}
|
|
6
|
-
Group=www-data
|
|
7
|
-
WorkingDirectory={project_dir}
|
|
8
|
-
ExecStart={command}
|
|
9
|
-
EnvironmentFile={project_dir}/.env
|
|
10
|
-
Restart=always
|
|
11
|
-
#StandardOutput=append:/var/log/your_project/qcluster.out.log
|
|
12
|
-
#StandardError=append:/var/log/your_project/qcluster.err.log
|
|
13
|
-
|
|
14
|
-
[Install]
|
|
15
|
-
WantedBy=multi-user.target
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: fujin-cli
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: Add your description here
|
|
5
|
-
Project-URL: Documentation, https://github.com/falcopackages/fujin#readme
|
|
6
|
-
Project-URL: Issues, https://github.com/falcopackages/fujin/issues
|
|
7
|
-
Project-URL: Source, https://github.com/falcopackages/fujin
|
|
8
|
-
Author-email: Tobi DEGNON <tobidegnon@proton.me>
|
|
9
|
-
License-File: LICENSE.txt
|
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
|
11
|
-
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: Natural Language :: English
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
|
-
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
20
|
-
Requires-Python: >=3.10
|
|
21
|
-
Requires-Dist: cappa>=0.24.0
|
|
22
|
-
Requires-Dist: fabric>=3.2.2
|
|
23
|
-
Requires-Dist: msgspec[toml]>=0.18.6
|
|
24
|
-
Requires-Dist: rich>=13.9.2
|
|
25
|
-
Description-Content-Type: text/markdown
|
|
26
|
-
|
|
27
|
-
# fujin
|
|
28
|
-
|
|
29
|
-
[](https://pypi.org/project/fujin-cli)
|
|
30
|
-
[](https://pypi.org/project/fujin-cli)
|
|
31
|
-
|
|
32
|
-
-----
|
|
33
|
-
|
|
34
|
-
> [!IMPORTANT]
|
|
35
|
-
> This package currently contains no features and is a work-in-progress
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
**Table of Contents**
|
|
39
|
-
|
|
40
|
-
- [fujin](#fujin)
|
|
41
|
-
- [Installation](#installation)
|
|
42
|
-
- [License](#license)
|
|
43
|
-
|
|
44
|
-
## Installation
|
|
45
|
-
|
|
46
|
-
```console
|
|
47
|
-
pip install fujin-cli
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## License
|
|
51
|
-
|
|
52
|
-
`fujin` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
fujin_cli-0.2.0.dist-info/RECORD
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
fujin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
fujin/__main__.py,sha256=cmbkKqDbGyc_himfDstDjC5SRi07-rU3oxWgoL_v_6c,1278
|
|
3
|
-
fujin/config.py,sha256=5g_KYGc3IDdHLZRLYiw55hGob85Yxovm-47JHiEXcYE,3896
|
|
4
|
-
fujin/errors.py,sha256=74Rh-Sgql1YspPdR_akQ2G3xZ48zecyafYCptpaFo1A,73
|
|
5
|
-
fujin/hooks.py,sha256=Nmi0psj0cwomSaJM6l0r2V5iVn1x0xdrazW1CRQ2wyw,346
|
|
6
|
-
fujin/host.py,sha256=uNYeYO2J5PQ7U3W8Olng7MuRK6uzIoom2yDNX914F14,3023
|
|
7
|
-
fujin/commands/__init__.py,sha256=-9mrBJHtwQELh58HlMEjCE60nowtGzySy4-inph3YY0,78
|
|
8
|
-
fujin/commands/_base.py,sha256=IYK7rXB5QW2Ac4pcgafQTjB1SPPht1ERWE_5WFzdSfo,2765
|
|
9
|
-
fujin/commands/app.py,sha256=Cu3EW1FbOqR40ArsbBpwA3nLCX41leys398obc5lRbM,2347
|
|
10
|
-
fujin/commands/config.py,sha256=bfWCyGYz-n-VNtcs-HiKXB7eP-K_YQkBGTPAqetVYYU,6136
|
|
11
|
-
fujin/commands/deploy.py,sha256=gHrqPdZ8btB9CcwjVv1BDwbeD0RIoMALIeh7cNzUsm8,2032
|
|
12
|
-
fujin/commands/down.py,sha256=iUneVfELnWmh-9NqVGCAwhF1nGSp4mZQAmW6_ER_DTg,1109
|
|
13
|
-
fujin/commands/redeploy.py,sha256=3xtExNvNHDoXgWsY3-evZnBHAEaGKRVyAB4h-9YiVpM,533
|
|
14
|
-
fujin/commands/server.py,sha256=UOl4pQWfj_sCc5l5EBx2PQ8UqIrMuEBJyuT-DvXFK1E,2186
|
|
15
|
-
fujin/commands/up.py,sha256=kkHbNSzTogA_vGqPwzK8a85Hey3rPHSmz2YRqWeQ100,450
|
|
16
|
-
fujin/process_managers/__init__.py,sha256=izJCtaGO-Fwptx4NHHjp8eOFuWfgjRMjt6YiQ0ZkXbA,672
|
|
17
|
-
fujin/process_managers/systemd.py,sha256=Ltt9i1EaY2Ip4WdbcSmuRVvv-Z04lm5izuOT3hxJB1M,3770
|
|
18
|
-
fujin/proxies/__init__.py,sha256=j3YdWdDBAfJ0-EL4APR0gkwTFkZ0BcUJQ_wg8bWVsGE,335
|
|
19
|
-
fujin/proxies/caddy.py,sha256=ehngeBOpUWqR7bJLjdVtoMhEqwStS3FZrZBzzhdA0-g,1620
|
|
20
|
-
fujin/proxies/dummy.py,sha256=Ur1mNxQGBmVLNJ0PV2ODR0fDw8VDItJ6-P1GOUc6o1o,222
|
|
21
|
-
fujin/proxies/nginx.py,sha256=1vNzxtulx6tWe-lW5JV9fK7XrZWdf9_v-VjyHdgHEXQ,1686
|
|
22
|
-
fujin/templates/other.service,sha256=XJUaQ0MxRuqT6KNkcn5ZPrjVtWh1zY9qbOzIhxGYOms,331
|
|
23
|
-
fujin/templates/web.service,sha256=TVMELmlOVo_SZxUqkpyizvZeX0T4b1sL1WVpbJ0D-DE,528
|
|
24
|
-
fujin/templates/web.socket,sha256=W5EtR-J1GNMaMqZDQduSjG2JY7gFFPKEDpPolFus9c0,163
|
|
25
|
-
fujin_cli-0.2.0.dist-info/METADATA,sha256=ahTCcNWwl7V9Zs0RWVH1UJ_L0EURdJliSr7d-wuK1Js,1660
|
|
26
|
-
fujin_cli-0.2.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
27
|
-
fujin_cli-0.2.0.dist-info/entry_points.txt,sha256=Y_TBtKt3j11qhwquMexZR5yqnDEqOBDACtresqQFE-s,46
|
|
28
|
-
fujin_cli-0.2.0.dist-info/licenses/LICENSE.txt,sha256=0QF8XfuH0zkIHhSet6teXfiCze6JSdr8inRkmLLTDyo,1099
|
|
29
|
-
fujin_cli-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|