From 162e9e20b591d5d7d38340dc3b493db7ca644559 Mon Sep 17 00:00:00 2001 From: 3252a8 <3252a8@proton.me> Date: Tue, 2 Jun 2026 10:21:08 +0300 Subject: [PATCH] fix: keep installer from preparing data directories --- docs/getting-started/deployment.md | 6 ++-- docs/migrations/remnawave-tg-shop.md | 2 +- scripts/install.sh | 45 ++++++++-------------------- tests/test_install_script.py | 2 +- 4 files changed, 17 insertions(+), 38 deletions(-) diff --git a/docs/getting-started/deployment.md b/docs/getting-started/deployment.md index 844cdda..d3d04cc 100644 --- a/docs/getting-started/deployment.md +++ b/docs/getting-started/deployment.md @@ -15,9 +15,7 @@ docker compose logs -f backend worker frontend ## Интерактивный install wizard -Для нового сервера можно не клонировать весь репозиторий и не ставить Python. -Скачайте только POSIX `sh`-скрипт через `raw.githubusercontent.com` и -запустите его: +Для нового сервера скачайте install-скрипт и запустите его: ```bash curl -fsSL https://raw.githubusercontent.com/3252a8/remnawave-minishop/main/scripts/install.sh -o install.sh @@ -31,7 +29,7 @@ Wizard работает через меню с цифрами и подтвер - сохранить backup существующих файлов перед перезаписью; - запустить `docker compose pull && docker compose up -d`; - проверить текущий стек через `docker compose ps` и логи `migrate`; -- запустить миграцию из поддерживаемых legacy-ботов: Remnashop и старый +- запустить миграцию из поддерживаемых ботов: Remnashop и старый `remnawave-tg-shop`; Для тестирования другой ветки или форка задайте источник перед запуском: diff --git a/docs/migrations/remnawave-tg-shop.md b/docs/migrations/remnawave-tg-shop.md index 9ef4b84..789fa71 100644 --- a/docs/migrations/remnawave-tg-shop.md +++ b/docs/migrations/remnawave-tg-shop.md @@ -15,7 +15,7 @@ sh install.sh ``` В меню выберите `Install new stack and run legacy migration` или -`Run legacy migration only`, затем источник `Legacy remnawave-tg-shop`. +`Run legacy migration only`, затем источник `Old remnawave-tg-shop`. Wizard поддерживает два режима: - `Copy old Docker volumes` - тот же безопасный сценарий, что и старый diff --git a/scripts/install.sh b/scripts/install.sh index f365310..bc7c57c 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,16 +1,13 @@ #!/bin/sh set -u -# Dependency-light installer for fresh Linux hosts. -# It intentionally avoids Python and clones only the files selected by the user. +# Interactive installer for fresh Docker Compose hosts. DEFAULT_REPO="${MINISHOP_INSTALL_REPO:-3252a8/remnawave-minishop}" DEFAULT_REF="${MINISHOP_INSTALL_REF:-main}" DEFAULT_IMAGE_TAG="${MINISHOP_IMAGE_TAG:-latest}" INSTALL_STATE_DIR=".installer" IMPORTER_CACHE_PATH="$INSTALL_STATE_DIR/import_legacy.py" -APP_UID=10001 -APP_GID=10001 OLD_TGSHOP_DB_VOLUME="remnawave-tg-shop-db-data" NEW_MINISHOP_DB_VOLUME="remnawave-minishop-db-data" OLD_TGSHOP_CADDY_DATA_VOLUME="remnawave-tg-shop-caddy-data" @@ -85,7 +82,7 @@ banner() { printf '\n' color "Remnawave MiniShop Install Wizard" "$BOLD$CYAN" printf '\n' - color "Install, configure, start, and migrate legacy bot data." "$DIM" + color "Install, configure, start, and migrate existing bot data." "$DIM" printf '\n\n' } @@ -132,8 +129,8 @@ Environment overrides: LEGACY_TGSHOP_SOURCE_DSN default remnawave-tg-shop source DSN for dump/restore The wizard is interactive by design. It never overwrites files without -confirmation. Remnashop imports always run dry-run first; legacy -remnawave-tg-shop can be migrated from Docker volumes or a PostgreSQL DSN. +confirmation. Remnashop imports always run dry-run first; remnawave-tg-shop +can be migrated from Docker volumes or a PostgreSQL DSN. EOF } @@ -638,21 +635,6 @@ write_env_file() { ok "Wrote $ENV_PATH" } -prepare_data_directory() { - section "Prepare data directory" - data_dir="$TARGET_DIR/data" - mkdir -p "$data_dir/themes" "$data_dir/webapp-logo" "$data_dir/webapp-emoji" "$data_dir/backups" - if [ ! -f "$data_dir/locales-overrides.json" ]; then - printf '{}\n' > "$data_dir/locales-overrides.json" - fi - if command -v chown >/dev/null 2>&1; then - if ! chown -R "$APP_UID:$APP_GID" "$data_dir" 2>/dev/null; then - warn "Could not chown data files. Run: sudo chown -R $APP_UID:$APP_GID data" - fi - fi - ok "Prepared $data_dir" -} - require_docker() { if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1; then COMPOSE_STYLE="docker" @@ -742,7 +724,7 @@ copy_volume_if_safe() { if [ "$required" = "1" ]; then warn "Target volume $target_volume is already not empty." warn "It may already be migrated, or the target stack may have been started with an empty database." - if confirm "Continue without copying the legacy database volume?" 0; then + if confirm "Continue without copying the old database volume?" 0; then return 0 fi return 1 @@ -762,7 +744,7 @@ copy_volume_if_safe() { } stop_known_legacy_containers() { - section "Stop legacy containers" + section "Stop old containers" stopped=0 for container in $KNOWN_LEGACY_CONTAINERS; do if docker inspect "$container" >/dev/null 2>&1; then @@ -775,7 +757,7 @@ stop_known_legacy_containers() { fi done if [ "$stopped" = "0" ]; then - info "No known legacy containers found." + info "No known old containers found." fi } @@ -847,7 +829,7 @@ run_import_command() { choose_legacy_source() { choose "Source bot" "1" "1|2|3" \ "1. Remnashop - import users, subscriptions, payments, referrals and promo codes." \ - "2. Legacy remnawave-tg-shop - upgrade an old compatible database/volume." \ + "2. Old remnawave-tg-shop - upgrade an old compatible database/volume." \ "3. Skip migration" case "$CHOICE_VALUE" in 1) LEGACY_SOURCE="remnashop" ;; @@ -941,7 +923,7 @@ prepare_compose_without_starting_apps() { } run_tgshop_volume_migration() { - section "Legacy remnawave-tg-shop volume migration" + section "Old remnawave-tg-shop volume migration" warn "This path copies the old PostgreSQL Docker volume into the new Minishop volume." warn "Old volumes are not deleted; keep them until you verify the new stack." @@ -964,7 +946,7 @@ run_tgshop_volume_migration() { } run_tgshop_dsn_migration() { - section "Legacy remnawave-tg-shop DSN migration" + section "Old remnawave-tg-shop DSN migration" warn "The old standalone helper did not support direct DSN import." warn "This wizard path dumps the old PostgreSQL database, restores it into target Compose PostgreSQL, then runs Minishop schema migrations." warn "The target database will be dropped and recreated before restore." @@ -992,7 +974,7 @@ run_tgshop_dsn_migration() { (cd "$TARGET_DIR" && run_compose exec -T postgres sh -c \ 'dropdb -U "$POSTGRES_USER" --if-exists "$POSTGRES_DB" && createdb -U "$POSTGRES_USER" "$POSTGRES_DB"') || return 1 - section "Dump and restore legacy database" + section "Dump and restore old database" (cd "$TARGET_DIR" && run_compose run --rm --no-deps \ -e "SOURCE_DSN=$SOURCE_DSN" \ -e "TARGET_DSN=$TARGET_DSN" \ @@ -1006,7 +988,7 @@ run_tgshop_dsn_migration() { } run_remnawave_tg_shop_migration() { - section "Legacy remnawave-tg-shop migration" + section "Old remnawave-tg-shop migration" ENV_PATH="$TARGET_DIR/.env" if [ ! -f "$ENV_PATH" ]; then fail ".env not found. Install or generate configuration first." @@ -1067,10 +1049,9 @@ install_flow() { download_profile_files || return 1 write_env_file || return 1 mkdir -p "$TARGET_DIR/$INSTALL_STATE_DIR" - prepare_data_directory || return 1 if [ "$with_migration" = "1" ]; then choose_legacy_source - elif confirm "Run a legacy bot migration now?" 0; then + elif confirm "Run a migration from another bot now?" 0; then choose_legacy_source fi diff --git a/tests/test_install_script.py b/tests/test_install_script.py index cec0b1e..f69a83b 100644 --- a/tests/test_install_script.py +++ b/tests/test_install_script.py @@ -43,7 +43,7 @@ def test_shell_installer_downloads_raw_files_and_runs_import_in_container(): def test_shell_installer_supports_legacy_tgshop_volume_and_dsn_paths(): script = INSTALL_SCRIPT.read_text(encoding="utf-8") - assert "Legacy remnawave-tg-shop" in script + assert "Old remnawave-tg-shop" in script assert "remnawave-tg-shop-db-data" in script assert "remnawave-minishop-db-data" in script assert "pg_dump --clean --if-exists" in script