Skip to main content

Infrastructure migration toolkit: detect → plan → apply

Project description

redeploy

AI Cost Tracking

AI Cost AI Model

This project uses AI-generated code. Total cost: $0.1500 with 1 AI commits.

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.1.tar.gz (19.0 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.1-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: redeploy-0.1.1.tar.gz
  • Upload date:
  • Size: 19.0 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.1.tar.gz
Algorithm Hash digest
SHA256 82b7e663e22277feb4899bd1cf4ae7de2bbfce7f1566e368bc429d11a6357288
MD5 8d9110e31890e2bb4ba82cc5b64812d0
BLAKE2b-256 648bc613ff1c021b31bdaea64292e6a52e3a8f2c5613d8e19958fc641f865fe4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: redeploy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 86bae4bb870ec742db8e368fbaed2fab06163f33b58827996ec04761122ecc6d
MD5 26428bd94e487060b92a542b86987d4f
BLAKE2b-256 c721730d1e57c4d99abda8ac3406846e1f11220e727f881b94d8d1a322441a75

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