redundanet 2.0.1__py3-none-any.whl → 2.0.3__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.
- redundanet/auth/gpg.py +1 -1
- redundanet/cli/network.py +100 -6
- {redundanet-2.0.1.dist-info → redundanet-2.0.3.dist-info}/METADATA +1 -1
- {redundanet-2.0.1.dist-info → redundanet-2.0.3.dist-info}/RECORD +7 -7
- {redundanet-2.0.1.dist-info → redundanet-2.0.3.dist-info}/LICENSE +0 -0
- {redundanet-2.0.1.dist-info → redundanet-2.0.3.dist-info}/WHEEL +0 -0
- {redundanet-2.0.1.dist-info → redundanet-2.0.3.dist-info}/entry_points.txt +0 -0
redundanet/auth/gpg.py
CHANGED
redundanet/cli/network.py
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
from pathlib import Path
|
|
5
8
|
from typing import Annotated, Optional
|
|
6
9
|
|
|
7
10
|
import typer
|
|
@@ -12,6 +15,80 @@ from rich.table import Table
|
|
|
12
15
|
app = typer.Typer(help="Network management commands")
|
|
13
16
|
console = Console()
|
|
14
17
|
|
|
18
|
+
INSTALL_DIR = Path("/opt/redundanet")
|
|
19
|
+
REPO_DIR = Path("/var/lib/redundanet/repo")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _clone_or_pull_repo(repo_url: str, branch: str, target_dir: Path) -> None:
|
|
23
|
+
"""Clone a repo or pull if it already exists."""
|
|
24
|
+
if (target_dir / ".git").exists():
|
|
25
|
+
# Pull latest changes
|
|
26
|
+
subprocess.run(
|
|
27
|
+
["git", "-C", str(target_dir), "fetch", "origin"],
|
|
28
|
+
check=True,
|
|
29
|
+
capture_output=True,
|
|
30
|
+
)
|
|
31
|
+
subprocess.run(
|
|
32
|
+
["git", "-C", str(target_dir), "checkout", branch],
|
|
33
|
+
check=True,
|
|
34
|
+
capture_output=True,
|
|
35
|
+
)
|
|
36
|
+
subprocess.run(
|
|
37
|
+
["git", "-C", str(target_dir), "pull", "origin", branch],
|
|
38
|
+
check=True,
|
|
39
|
+
capture_output=True,
|
|
40
|
+
)
|
|
41
|
+
else:
|
|
42
|
+
# Clone fresh
|
|
43
|
+
target_dir.parent.mkdir(parents=True, exist_ok=True)
|
|
44
|
+
subprocess.run(
|
|
45
|
+
["git", "clone", "--branch", branch, repo_url, str(target_dir)],
|
|
46
|
+
check=True,
|
|
47
|
+
capture_output=True,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _setup_docker_files(repo_dir: Path, install_dir: Path) -> None:
|
|
52
|
+
"""Copy docker files from cloned repo to install directory."""
|
|
53
|
+
src_docker = repo_dir / "docker"
|
|
54
|
+
dst_docker = install_dir / "docker"
|
|
55
|
+
|
|
56
|
+
if not src_docker.exists():
|
|
57
|
+
console.print("[yellow]Warning:[/yellow] No docker directory found in repo")
|
|
58
|
+
return
|
|
59
|
+
|
|
60
|
+
# Remove existing docker dir if present
|
|
61
|
+
if dst_docker.exists():
|
|
62
|
+
shutil.rmtree(dst_docker)
|
|
63
|
+
|
|
64
|
+
# Copy docker directory
|
|
65
|
+
shutil.copytree(src_docker, dst_docker)
|
|
66
|
+
|
|
67
|
+
# Create secrets directory
|
|
68
|
+
(dst_docker / "secrets").mkdir(exist_ok=True)
|
|
69
|
+
|
|
70
|
+
console.print(f"[green]Docker files installed to:[/green] {dst_docker}")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _setup_manifest(repo_dir: Path) -> None:
|
|
74
|
+
"""Copy manifest files to the data directory."""
|
|
75
|
+
src_manifest = repo_dir / "manifests"
|
|
76
|
+
dst_manifest = Path("/var/lib/redundanet/manifest")
|
|
77
|
+
|
|
78
|
+
if not src_manifest.exists():
|
|
79
|
+
console.print("[yellow]Warning:[/yellow] No manifests directory found in repo")
|
|
80
|
+
return
|
|
81
|
+
|
|
82
|
+
dst_manifest.mkdir(parents=True, exist_ok=True)
|
|
83
|
+
|
|
84
|
+
# Copy manifest files
|
|
85
|
+
for f in src_manifest.glob("*.yaml"):
|
|
86
|
+
shutil.copy(f, dst_manifest / f.name)
|
|
87
|
+
for f in src_manifest.glob("*.json"):
|
|
88
|
+
shutil.copy(f, dst_manifest / f.name)
|
|
89
|
+
|
|
90
|
+
console.print(f"[green]Manifest files installed to:[/green] {dst_manifest}")
|
|
91
|
+
|
|
15
92
|
|
|
16
93
|
@app.command("join")
|
|
17
94
|
def join_network(
|
|
@@ -23,6 +100,10 @@ def join_network(
|
|
|
23
100
|
str,
|
|
24
101
|
typer.Option("--branch", "-b", help="Git branch"),
|
|
25
102
|
] = "main",
|
|
103
|
+
install_dir: Annotated[
|
|
104
|
+
Path,
|
|
105
|
+
typer.Option("--install-dir", help="Installation directory"),
|
|
106
|
+
] = INSTALL_DIR,
|
|
26
107
|
) -> None:
|
|
27
108
|
"""Join an existing RedundaNet network."""
|
|
28
109
|
from redundanet.core.config import load_settings
|
|
@@ -37,15 +118,28 @@ def join_network(
|
|
|
37
118
|
|
|
38
119
|
console.print(Panel(f"[bold]Joining RedundaNet Network[/bold]\nRepository: {repo}"))
|
|
39
120
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
121
|
+
# Clone or update the repository
|
|
122
|
+
with console.status("[bold green]Cloning repository..."):
|
|
123
|
+
try:
|
|
124
|
+
_clone_or_pull_repo(repo, branch, REPO_DIR)
|
|
125
|
+
console.print(f"[green]Repository cloned to:[/green] {REPO_DIR}")
|
|
126
|
+
except subprocess.CalledProcessError as e:
|
|
127
|
+
console.print(f"[red]Error cloning repository:[/red] {e}")
|
|
128
|
+
raise typer.Exit(1) from None
|
|
129
|
+
|
|
130
|
+
# Set up docker files
|
|
131
|
+
with console.status("[bold green]Setting up Docker files..."):
|
|
132
|
+
_setup_docker_files(REPO_DIR, install_dir)
|
|
133
|
+
|
|
134
|
+
# Set up manifest
|
|
135
|
+
with console.status("[bold green]Setting up manifest..."):
|
|
136
|
+
_setup_manifest(REPO_DIR)
|
|
44
137
|
|
|
45
138
|
console.print("\n[bold green]Successfully joined the network![/bold green]")
|
|
46
139
|
console.print("\n[bold]Next steps:[/bold]")
|
|
47
|
-
console.print("1.
|
|
48
|
-
console.print("2.
|
|
140
|
+
console.print("1. Configure environment: [cyan]nano /opt/redundanet/.env[/cyan]")
|
|
141
|
+
console.print("2. Export GPG key: [cyan]gpg --armor --export-secret-keys <KEY_ID> > /opt/redundanet/docker/secrets/gpg_private_key.asc[/cyan]")
|
|
142
|
+
console.print("3. Start services: [cyan]cd /opt/redundanet/docker && docker-compose --env-file ../.env up -d[/cyan]")
|
|
49
143
|
|
|
50
144
|
|
|
51
145
|
@app.command("leave")
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
redundanet/__init__.py,sha256=tqG349jbZCq9GmU1zT4gYuVUArBzPiJmyf31kzFXqUA,398
|
|
2
2
|
redundanet/__main__.py,sha256=sI1D-Mn0JeICtGPuNLp-uthhIQxOB_6_9Avf1-iOXLQ,151
|
|
3
3
|
redundanet/auth/__init__.py,sha256=BlmLa620gKsRdiD3d8tsDDweA9kI_fTBY9bxM6jtiyU,202
|
|
4
|
-
redundanet/auth/gpg.py,sha256=
|
|
4
|
+
redundanet/auth/gpg.py,sha256=ztklRsvXqZ1c67cprvjGK7WNdfFdow1iG2F-oHnWBT8,9089
|
|
5
5
|
redundanet/auth/keyserver.py,sha256=1zNIOIY62JaAPNWVjZaBHlx2fSN601WsGsR_KizdiAo,6502
|
|
6
6
|
redundanet/cli/__init__.py,sha256=4XqFI3iyLQO6ko2bcSq_OoMvlrk8voMK8twcsHgUziY,89
|
|
7
7
|
redundanet/cli/main.py,sha256=teFau_SP_rb5aDIBNH7vgwcOa8wjXoLW3SoL36kLQZ0,8129
|
|
8
|
-
redundanet/cli/network.py,sha256=
|
|
8
|
+
redundanet/cli/network.py,sha256=o4s_2Ya2WY1r5hz8PLDZ15uc7LXJRBWAAuQf0LSYH6U,9005
|
|
9
9
|
redundanet/cli/node.py,sha256=AD9ijvoNKlVY_uR2QQTHrcmnwuetWXj76M1jZ_IOKEE,17230
|
|
10
10
|
redundanet/cli/storage.py,sha256=I-n8NO_x_v7vKp3bx3yxfYNLNHNyOOuXMpl0T4mmZzs,8054
|
|
11
11
|
redundanet/core/__init__.py,sha256=fOx3CxtyI4s2wPmBzAuqkcGq5JLKKS3BvebuUandNBQ,673
|
|
@@ -30,8 +30,8 @@ redundanet/vpn/__init__.py,sha256=wM2iePNDGH-CqsNgnEaEecn6Udrx6DTGnk465vso_sg,28
|
|
|
30
30
|
redundanet/vpn/keys.py,sha256=yTfLpqguTNOZlsvgzMS4vq9WTgVL9AUVTcZbftY6a3w,5326
|
|
31
31
|
redundanet/vpn/mesh.py,sha256=EVdYcQY2reV_UESXRHEUKEIhhSSwaG7u1vvPtV6PDZI,6041
|
|
32
32
|
redundanet/vpn/tinc.py,sha256=u5j2ZMPOjTfXM4LPHjg7NZmYdTF51kg58qTuA7CDtTw,10288
|
|
33
|
-
redundanet-2.0.
|
|
34
|
-
redundanet-2.0.
|
|
35
|
-
redundanet-2.0.
|
|
36
|
-
redundanet-2.0.
|
|
37
|
-
redundanet-2.0.
|
|
33
|
+
redundanet-2.0.3.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
34
|
+
redundanet-2.0.3.dist-info/METADATA,sha256=XppVKNfoKN9gaxtmqYa2CI-KgZfg1B9Di0o7wVupQk8,10939
|
|
35
|
+
redundanet-2.0.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
36
|
+
redundanet-2.0.3.dist-info/entry_points.txt,sha256=-0cdQEyYsTHavFdq-k_uws2bxnQrD2Ud0FfllcHGrcw,54
|
|
37
|
+
redundanet-2.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|