Skip to main content

Infrastructure migration toolkit: detect → plan → apply

Project description

redeploy

AI Cost Tracking

PyPI Version Python License AI Cost Human Time Model

  • 🤖 LLM usage: $0.3000 (2 commits)
  • 👤 Human dev: ~$135 (1.4h @ $100/h, 30min dedup)

Generated on 2026-04-20 using openrouter/qwen/qwen3-coder-next


Infrastructure migration toolkit z 3 funkcjami:

redeploy detect   →  infra.yaml           (co jest teraz)
redeploy plan     →  migration-plan.yaml  (co zrobić)
redeploy apply    →  wykonanie planu      (wykonaj migrację)

Instalacja

pip install -e .

Użycie

# 1. Wykryj aktualną infrastrukturę (lokalną lub zdalną)
redeploy detect --host root@87.106.87.183 --app c2004 -o infra.yaml

# 2. Zaplanuj migrację (np. z k3s → docker_full)
redeploy plan --infra infra.yaml --target target.yaml -o migration-plan.yaml

# 3. Wykonaj plan
redeploy apply --plan migration-plan.yaml

# Lub wszystko naraz (detect → plan → apply)
redeploy migrate --host root@87.106.87.183 --app c2004 --target target.yaml

Funkcje

detect — Skanowanie infrastruktury

Wykrywa aktualny stan:

  • Zdalny host: SSH, Docker, k3s, systemd, Podman, porty
  • Usługi: działające kontenery, pody k8s/k3s, serwisy systemd
  • Sieć: iptables, nginx, Traefik, zajęte porty
  • Aplikacja: wersja, healthcheck, DB
  • Wyjście: infra.yaml

plan — Planowanie migracji

Na podstawie infra.yaml (stan obecny) i target.yaml (cel):

  • Identyfikuje konflikty (porty, stare serwisy)
  • Generuje sekwencję kroków migracji
  • Szacuje ryzyko i downtime
  • Wyjście: migration-plan.yaml

apply — Wykonanie migracji

Wykonuje plan krok po kroku:

  • Dry-run przed wykonaniem
  • Rollback przy błędzie
  • Verify po każdym etapie
  • Log wszystkich operacji

Format plików

infra.yaml (wynik detect)

host: root@87.106.87.183
app: c2004
scanned_at: "2026-04-20T13:00:00"
runtime:
  docker: "27.0.3"
  k3s: "v1.31.5+k3s1"      # lub null
  podman: null
  systemd: "257"
ports:
  80:  { process: docker-proxy, via: traefik }
  443: { process: docker-proxy, via: traefik }
services:
  docker:
    - name: c2004-backend
      image: c2004-backend
      status: healthy
      version: "1.0.19"
      ports: [8000]
  k3s:
    - namespace: identification
      name: backend
      status: running
      version: "1.0.18"
conflicts:
  - type: port_steal
    description: "k3s iptables DNAT on :443 before docker-proxy"
    severity: high

target.yaml (cel migracji)

strategy: docker_full
app: c2004
compose_files:
  - docker-compose.vps.yml
env_file: envs/vps.env
stop_services:
  - k3s
  - nginx

migration-plan.yaml (wynik plan)

from_infra: infra.yaml
target: target.yaml
created_at: "2026-04-20T13:05:00"
risk: medium
estimated_downtime: "30s"
steps:
  - id: stop_k3s
    action: systemctl_stop
    service: k3s
    reason: "k3s steals iptables DNAT on :443"
  - id: deploy_docker
    action: docker_compose_up
    compose: docker-compose.vps.yml
    flags: [--build, -d]
  - id: verify
    action: http_check
    url: https://c2004.mask.services/api/v1/health
    expect: "1.0.19"

License

Licensed under Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redeploy-0.1.2.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redeploy-0.1.2-py3-none-any.whl (31.5 kB view details)

Uploaded Python 3

File details

Details for the file redeploy-0.1.2.tar.gz.

File metadata

  • Download URL: redeploy-0.1.2.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for redeploy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bdd22a908e8f3e85c1c0b4a22f143377c9da8cbed3e5954307423b266fd078c6
MD5 1eba7bb5584a25fbf7e7edb37c67d450
BLAKE2b-256 f533b124892374ee91bf4c121be40865cb8ac4d8d3e1efbc6bfc5a25fdc7325d

See more details on using hashes here.

File details

Details for the file redeploy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: redeploy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 31.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for redeploy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f656ab48a230eecaabc32cb4cb25cd1fac2f36ace894400c8fcedd79889867ff
MD5 f2c5943e217c0c69a80d8c1dfaf9f8bf
BLAKE2b-256 adde649751c488db96be6341ce689e08e8ca519b60d62f07e6c1d2fa4b562218

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page