katalon-cli 0.4.0__tar.gz → 0.5.1__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 (22) hide show
  1. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/PKG-INFO +1 -1
  2. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/pyproject.toml +1 -1
  3. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/pyproject.toml.orig +1 -1
  4. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/checks.py +16 -20
  5. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/main.py +1 -0
  6. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/templates/compose.yaml.j2 +2 -0
  7. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/templates/nginx.conf.j2 +19 -0
  8. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/README.md +0 -0
  9. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/__init__.py +0 -0
  10. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/__init__.py +0 -0
  11. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/backup.py +0 -0
  12. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/compose_gen.py +0 -0
  13. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/docker.py +0 -0
  14. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/images.py +0 -0
  15. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/paths.py +0 -0
  16. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/permissions.py +0 -0
  17. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/reindex.py +0 -0
  18. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/release.py +0 -0
  19. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/selfupdate.py +0 -0
  20. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/core/state.py +0 -0
  21. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/py.typed +0 -0
  22. {katalon_cli-0.4.0 → katalon_cli-0.5.1}/src/katalon_cli/templates/Caddyfile.j2 +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: katalon-cli
3
- Version: 0.4.0
3
+ Version: 0.5.1
4
4
  Summary: Installer & Updater CLI für Katalon Production-Instanzen
5
5
  Author: Karl Krägelin
6
6
  Author-email: Karl Krägelin <karlkraegelin@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "katalon-cli"
3
- version = "0.4.0"
3
+ version = "0.5.1"
4
4
  description = "Installer & Updater CLI für Katalon Production-Instanzen"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "katalon-cli"
3
- version = "0.4.0"
3
+ version = "0.5.1"
4
4
  description = "Installer & Updater CLI für Katalon Production-Instanzen"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -8,10 +8,11 @@ import subprocess
8
8
  from dataclasses import dataclass
9
9
  from pathlib import Path
10
10
 
11
+ from . import docker
12
+
11
13
  MIN_FREE_DISK_GB = 5
12
14
  # Elasticsearch verweigert Shard-Allokation ab 90 % (high watermark).
13
15
  MAX_USED_PERCENT = 90
14
- REAL_FS = {"ext2", "ext3", "ext4", "xfs", "btrfs", "zfs", "f2fs"}
15
16
 
16
17
 
17
18
  @dataclass
@@ -52,30 +53,25 @@ def check_disk_space(path: Path, min_gb: int = MIN_FREE_DISK_GB) -> CheckResult:
52
53
  "Diskspace", ok, f"{free_gb:.1f} GB frei (min. {min_gb} GB) in {path}"
53
54
  )
54
55
 
55
- def _mount_points(instance_dir: Path) -> list[Path]:
56
- """Alle echten Dateisysteme des Hosts; ohne /proc/mounts Instanzverzeichnis und `/`."""
57
- try:
58
- lines = Path("/proc/mounts").read_text().splitlines()
59
- except OSError:
60
- return [instance_dir, Path("/")]
61
- return [Path(f[1].replace("\\040", " ")) for f in map(str.split, lines) if f[2] in REAL_FS]
56
+ ES_DATA_PATH = "/usr/share/elasticsearch/data"
62
57
 
63
58
 
64
59
  def check_server_disk(instance_dir: Path, max_used: int = MAX_USED_PERCENT) -> CheckResult:
65
- full = []
66
- for mount in _mount_points(instance_dir):
67
- try:
68
- usage = shutil.disk_usage(mount)
69
- except OSError:
70
- continue
71
- used = usage.used * 100 / (usage.used + usage.free)
72
- if used >= max_used:
73
- full.append(f"{mount} {used:.0f} %")
74
- if full:
60
+ """Belegung des Dateisystems mit dem Elasticsearch-Datenpfad, gemessen im Container (auch Docker Desktop)."""
61
+ if not docker.is_running(instance_dir, "elasticsearch"):
62
+ return CheckResult("Server-Disk", True, "Elasticsearch läuft nicht — Prüfung übersprungen")
63
+ result = docker.compose(
64
+ instance_dir, "exec", "-T", "elasticsearch", "df", "-Pk", ES_DATA_PATH, check=False, capture=True
65
+ )
66
+ try:
67
+ used = int(result.stdout.splitlines()[-1].split()[4].rstrip("%"))
68
+ except (IndexError, ValueError):
69
+ return CheckResult("Server-Disk", True, "Belegung nicht lesbar — Prüfung übersprungen")
70
+ if used >= max_used:
75
71
  return CheckResult(
76
- "Server-Disk", False, f"≥ {max_used} % belegt: {', '.join(full)} — Elasticsearch blockiert ab 90 %"
72
+ "Server-Disk", False, f"Elasticsearch-Daten {used} % belegt (≥ {max_used} %) — Elasticsearch blockiert ab 90 %"
77
73
  )
78
- return CheckResult("Server-Disk", True, f"alle Dateisysteme < {max_used} % belegt")
74
+ return CheckResult("Server-Disk", True, f"Elasticsearch-Daten {used} % belegt (< {max_used} %)")
79
75
 
80
76
 
81
77
  def check_openssl() -> CheckResult:
@@ -77,6 +77,7 @@ OPTIONAL_ENV_BLOCK = f"""
77
77
  # SMTP_FROM=
78
78
  # CORS_ORIGINS=["http://localhost"]
79
79
  # MAX_UPLOAD_SIZE_MB=200
80
+ # ATTACHMENT_MAX_UPLOAD_MB=200
80
81
  """
81
82
 
82
83
 
@@ -109,6 +109,7 @@ services:
109
109
  CANTALOUPE_URL: ${CANTALOUPE_URL:-http://cantaloupe:8182}
110
110
  CANTALOUPE_PUBLIC_URL: ${CANTALOUPE_PUBLIC_URL:-http://localhost}
111
111
  MEDIA_ROOT: /var/lib/katalon/media
112
+ ATTACHMENT_MAX_UPLOAD_MB: ${ATTACHMENT_MAX_UPLOAD_MB:-200}
112
113
  FIRST_RUN_CREDENTIALS_PATH: ${FIRST_RUN_CREDENTIALS_PATH:-/var/lib/katalon/first-run-credentials.txt}
113
114
  DEBUG: "false"
114
115
  volumes:
@@ -136,6 +137,7 @@ services:
136
137
  CANTALOUPE_URL: ${CANTALOUPE_URL:-http://cantaloupe:8182}
137
138
  CANTALOUPE_PUBLIC_URL: ${CANTALOUPE_PUBLIC_URL:-http://localhost}
138
139
  MEDIA_ROOT: /var/lib/katalon/media
140
+ ATTACHMENT_MAX_UPLOAD_MB: ${ATTACHMENT_MAX_UPLOAD_MB:-200}
139
141
  volumes:
140
142
  - ${MEDIA_ROOT:-./media}:/var/lib/katalon/media
141
143
  depends_on:
@@ -38,6 +38,25 @@ server {
38
38
  proxy_set_header X-Forwarded-Proto {{ '$http_x_forwarded_proto' if tls_mode == 'caddy' else '$scheme' }};
39
39
  }
40
40
 
41
+ # Attachment and media files bring their own CSP per content type from the API (sandbox for image/audio/video,
42
+ # PDF-capable for PDF). The server-level page CSP (object-src 'none') blocks the browser PDF viewer,
43
+ # so this location omits CSP and X-Content-Type-Options, which the API sets itself.
44
+ # An add_header here drops the server-level ones: the remaining headers are repeated.
45
+ location ~ "^/(portal/)?v1/(attachments/[0-9a-fA-F-]{36}/(file|stream)|objects/[0-9a-fA-F-]{36}/media/[0-9a-fA-F-]{36}/(file|stream)|media/[0-9a-fA-F-]{36}/(file|download))$" {
46
+ set $upstream_api api:8000;
47
+ proxy_pass http://$upstream_api;
48
+ proxy_set_header Host $host;
49
+ proxy_set_header X-Real-IP $remote_addr;
50
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
51
+ proxy_set_header X-Forwarded-Proto {{ '$http_x_forwarded_proto' if tls_mode == 'caddy' else '$scheme' }};
52
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
53
+ add_header X-Frame-Options "SAMEORIGIN" always;
54
+ add_header Permissions-Policy "camera=(), geolocation=(), microphone=()" always;
55
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
56
+ add_header Cross-Origin-Opener-Policy "same-origin" always;
57
+ add_header Cross-Origin-Resource-Policy "same-origin" always;
58
+ }
59
+
41
60
  location /v1/ {
42
61
  set $upstream_api api:8000;
43
62
  proxy_pass http://$upstream_api;
File without changes