redundanet 2.0.2__tar.gz → 2.0.3__tar.gz

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.
Files changed (36) hide show
  1. {redundanet-2.0.2 → redundanet-2.0.3}/PKG-INFO +1 -1
  2. {redundanet-2.0.2 → redundanet-2.0.3}/pyproject.toml +1 -1
  3. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/cli/network.py +100 -6
  4. {redundanet-2.0.2 → redundanet-2.0.3}/LICENSE +0 -0
  5. {redundanet-2.0.2 → redundanet-2.0.3}/README.md +0 -0
  6. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/__init__.py +0 -0
  7. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/__main__.py +0 -0
  8. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/auth/__init__.py +0 -0
  9. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/auth/gpg.py +0 -0
  10. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/auth/keyserver.py +0 -0
  11. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/cli/__init__.py +0 -0
  12. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/cli/main.py +0 -0
  13. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/cli/node.py +0 -0
  14. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/cli/storage.py +0 -0
  15. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/core/__init__.py +0 -0
  16. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/core/config.py +0 -0
  17. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/core/exceptions.py +0 -0
  18. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/core/manifest.py +0 -0
  19. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/core/node.py +0 -0
  20. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/network/__init__.py +0 -0
  21. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/network/discovery.py +0 -0
  22. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/network/dns.py +0 -0
  23. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/network/validation.py +0 -0
  24. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/storage/__init__.py +0 -0
  25. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/storage/client.py +0 -0
  26. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/storage/furl.py +0 -0
  27. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/storage/introducer.py +0 -0
  28. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/storage/storage.py +0 -0
  29. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/utils/__init__.py +0 -0
  30. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/utils/files.py +0 -0
  31. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/utils/logging.py +0 -0
  32. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/utils/process.py +0 -0
  33. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/vpn/__init__.py +0 -0
  34. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/vpn/keys.py +0 -0
  35. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/vpn/mesh.py +0 -0
  36. {redundanet-2.0.2 → redundanet-2.0.3}/src/redundanet/vpn/tinc.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: redundanet
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: Distributed encrypted storage on a mesh VPN network
5
5
  Home-page: https://github.com/alessandrodefilippo/redundanet
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "redundanet"
3
- version = "2.0.2"
3
+ version = "2.0.3"
4
4
  description = "Distributed encrypted storage on a mesh VPN network"
5
5
  authors = ["Alessandro De Filippo <alessandro@example.com>"]
6
6
  license = "MIT"
@@ -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
- with console.status("[bold green]Cloning manifest repository..."):
41
- # In a real implementation, we'd clone the repo
42
- console.print(f"[green]Repository:[/green] {repo}")
43
- console.print(f"[green]Branch:[/green] {branch}")
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. Start the VPN: [cyan]redundanet network vpn start[/cyan]")
48
- console.print("2. Start storage: [cyan]redundanet storage start[/cyan]")
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")
File without changes
File without changes