Skip to content

Update migration document: new installation and mariadb guide#5

Merged
M03ED merged 2 commits intoPasarGuard:mainfrom
mdjvd:update-migration
Oct 21, 2025
Merged

Update migration document: new installation and mariadb guide#5
M03ED merged 2 commits intoPasarGuard:mainfrom
mdjvd:update-migration

Conversation

@mdjvd
Copy link
Copy Markdown
Contributor

@mdjvd mdjvd commented Oct 21, 2025

Major changes:

  • added a migration method with a fresh pasarguard installation
  • added MariaDB commands and docker-compose examples for all database types

Minor changes:

  • updated sqlite url example to reduce user confusion
  • added a MySQL database import verification guide
  • other small changes and fixes

About the docker compose examples:
I didn't use the provided examples in the scripts repo, which have MySQL environment variable in them, because it introduces some problems like many users not having the needed variables in their .env and the extra step to change the variables for those who have them.
These examples should work with both docker compose configs that many users use (with or without MySQL environment variables)
However, if you think adding some optimizations (such as --character_set_server=utf8mb4 command or similar) is necessary, I can include them.

Summary by CodeRabbit

  • Documentation
    • Added dual migration methods: current installation and fresh installation flows
    • Expanded per-database guidance for SQLite, MySQL, and MariaDB with before/after examples
    • Updated migration steps, post-migration verification, rollback and troubleshooting guidance
    • Reworked examples, environment/path references, and Docker Compose comparisons for clarity
    • Reorganized and localized content across English, Persian, Russian, and Chinese guides

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 21, 2025

Walkthrough

Documentation for Marzban → PasarGuard migration was rewritten in English, Persian, Russian, and Chinese to add two distinct migration flows (current installation vs. new installation), expand SQLite/MySQL/MariaDB-specific steps, rename Marzban references to PasarGuard, and add detailed Docker, SSL, rollback, and post-migration verification guidance.

Changes

Cohort / File(s) Summary
Migration Documentation (Multi-language)
content/docs/en/migration/marzban.mdx, content/docs/fa/migration/marzban.mdx, content/docs/ru/migration/marzban.mdx, content/docs/zh/migration/marzban.mdx
Reworked migration guide into two paths (current vs. new installation). Expanded DB-specific instructions for SQLite, MySQL, MariaDB with before/after Docker Compose examples and accordion/tabbed snippets. Renamed Marzban → PasarGuard across env vars, file paths, cert/Xray template refs, service names, and DB names. Added SSL/import/export commands, rollback and troubleshooting procedures, and post-migration verification notes.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Admin as Admin
    participant Docs as Migration Guide
    participant Src as Old Marzban Install
    participant Dest as New PasarGuard Install
    participant DB as Database (SQLite/MySQL/MariaDB)
    Note right of Docs #DFF2E6: Dual migration paths\n(Current vs New)
    Admin->>Docs: Read guide & choose path
    alt Current installation
        Admin->>Src: Stop services, rename dirs, update .env
        Src->>DB: Export / move DB files
        Admin->>Src: Start PasarGuard in-place
        DB-->>Admin: DB migrated (SQLite/MySQL/MariaDB steps)
    else New installation
        Admin->>Dest: Install PasarGuard fresh
        Admin->>DB: Export from Marzban
        Admin->>Dest: Import DB, configure SSL, update .env
        Dest->>Admin: Start services, verify panel
    end
    Admin->>Docs: Follow rollback/troubleshoot if needed
    Note over Admin,Docs #FFF4D9: Verification, backups, and rollback steps highlighted
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Poem

🐰 From burrow old to garden new I chart,
Two trails I teach — pick the one for your heart.
With SQLite, MySQL, MariaDB in tow,
I nibble backups, then help migrations go.
Rollback ready — hop safe, steady, smart! 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Update migration document: new installation and mariadb guide" directly aligns with the major changes in the changeset. The raw summary confirms that across all four migration documentation files (English, Persian, Russian, and Chinese), the primary modifications involve introducing dual migration methods (one for existing installations and one for fresh installations) and adding comprehensive MariaDB support alongside MySQL and SQLite. The title succinctly captures both of these key changes and is specific enough that a reviewer scanning the history would understand the main purpose of the update without being vague or generic.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
content/docs/zh/migration/marzban.mdx (1)

114-146: Database driver update examples need clarification in SQLite tab

While the old and new SQLite URLs are provided, the Chinese text could better emphasize why the driver change is necessary (moving from synchronous to async SQLite driver for performance). The examples are correct, but the educational context is minimal.

content/docs/en/migration/marzban.mdx (1)

653-653: Acknowledged: Minor style variation on "need to edit"

LanguageTool flags repetition of "You need to..." pattern in nearby sentences (lines 651-653). While the content is clear, varying the phrasing slightly could improve readability. However, this is a very minor point and current wording is acceptable for instructional clarity.

content/docs/ru/migration/marzban.mdx (1)

166-200: Tab headers mix English and Russian inconsistently

Lines 166 and 179 use English tab titles ("XRAY_SUBSCRIPTION_TEMPLATE", "Xray-Config Certificate Directories") while the content headers (lines 167, 180) are translated to Russian. For consistency, tab values should remain in English for code references, but the section headers below them should use Russian text. Current approach is acceptable but could be clearer.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc85ede and a176c0d.

⛔ Files ignored due to path filters (3)
  • public/images/migration/drop-mysql-tables.png is excluded by !**/*.png
  • public/images/migration/edit-mysql-database-1.png is excluded by !**/*.png
  • public/images/migration/edit-mysql-database-2.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • content/docs/en/migration/marzban.mdx (11 hunks)
  • content/docs/fa/migration/marzban.mdx (10 hunks)
  • content/docs/ru/migration/marzban.mdx (9 hunks)
  • content/docs/zh/migration/marzban.mdx (13 hunks)
🧰 Additional context used
🪛 LanguageTool
content/docs/en/migration/marzban.mdx

[grammar] ~157-~157: Ensure spelling is correct
Context: ...certificate directories from marzban to pasarguard in your xray_config.json file: ```ba...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[style] ~653-~653: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...efully: - Edit the database file: You need to edit your MySQL or MariaDB database fil...

(REP_NEED_TO_VB)

content/docs/zh/migration/marzban.mdx

[uncategorized] ~10-~10: 您的意思是“"账"户”?
Context: ...beta-3 及以下版本。 本指南将帮助您将数据、设置和用户帐户从 Marzban 迁移到 PasarGuard,且不会丢失任何内容。 解释...

(ZHANG7_ZHANG8)

content/docs/fa/migration/marzban.mdx

[misspelling] ~16-~16: اشتباه محتمل املائی پیداشده: دستورها.
Context: ...به سرور جدید نیست، ولی کمی پیچیده‌تره و دستورات بیشتری داره. - [PasarGuard مهاجرت با ن...

(FA_SIMPLE_REPLACE)


[misspelling] ~20-~20: اشتباه محتمل املائی پیداشده: دستورها.
Context: ...ب-جدید) این روش راحت‌تر و سریع‌تره، با دستورات کمتر. ولی به سرور جدید نیاز داره و بعضی...

(FA_SIMPLE_REPLACE)


[misspelling] ~450-~450: اشتباه محتمل املائی پیداشده: دستورها.
Context: ...اسارگارد وارد بشه. > ⚠️ توجه: تمام دستورات زیر برای مهاجرت دیتابیس باید در حالی اج...

(FA_SIMPLE_REPLACE)


[misspelling] ~727-~727: اشتباه محتمل املائی پیداشده: دستورها.
Context: ...رید (Permission Denied)**: مطمئن شید که دستورات رو با دسترسی‌های مناسب (sudo در صورت نی...

(FA_SIMPLE_REPLACE)

🔇 Additional comments (15)
content/docs/zh/migration/marzban.mdx (4)

14-20: Dual migration paths clearly structured

The introduction of two migration methods is well-organized with clear descriptions of complexity tradeoffs (existing installation: more commands but no new server; new installation: fewer commands but requires new server). This provides users with a good decision framework.


215-392: Docker Compose before/after structure with three databases is comprehensive

The accordion-based presentation for SQLite, MySQL, and MariaDB provides clear, side-by-side comparisons of configuration changes. All service names, image references, volume paths, and database names are consistently updated from "marzban" to "pasarguard." This structure effectively communicates the migration scope.


461-502: Database export/import process uses both mysqldump and mariadb-dump correctly

The migration steps properly distinguish between MySQL (mysqldump, mysql) and MariaDB (mariadb-dump, mariadb) commands. The fallback instruction at line 479 (using "marzban" user with MYSQL_PASSWORD) adds helpful error recovery guidance.


7-7: Fix spelling: "帐户" should be "账户"

The static analysis tool flagged this as a standard Chinese spelling issue. "账户" is the preferred modern term for "account."

-本指南适用于 Marzban beta-3 及以下版本。
+本指南适用于 Marzban beta-3 及以下版本。

Likely an incorrect or invalid review comment.

content/docs/en/migration/marzban.mdx (4)

157-157: Minor style inconsistency: Consider consistency with MySQL examples

The phrasing "Update the certificate directories from marzban to pasarguard in your xray_config.json file" is clear and grammatically correct. The LanguageTool flag appears to be a false positive on spelling/orthography. No change needed.


12-20: Two migration methods explanation is clear and actionable

The dual-path introduction effectively communicates pros/cons: existing installation preserves settings but is more complex; new installation is simpler but requires manual reconfiguration. Users can make an informed choice. This aligns with PR objectives.


437-447: SQLite database migration step is appropriately brief

For SQLite migrations, the new installation path correctly instructs users to simply copy the db.sqlite3 file to /var/lib/pasarguard/. This is accurate and sufficient.


506-520: Database import process correctly specifies MySQL ROOT PASSWORD replacement

The instructions clearly indicate that MYSQL_ROOT_PASSWORD must be replaced with the actual value from the .env file. Both MySQL and MariaDB variants are provided with appropriate commands (mysql vs mariadb).

content/docs/ru/migration/marzban.mdx (2)

12-20: Dual migration paths clearly described in Russian

The explanation of two migration methods is well-translated and provides the same decision framework as English/Chinese versions. The tradeoffs are clear: current installation is complex but preserves settings; new installation is simple but requires manual reconfiguration.


447-459: MySQL/MariaDB startup commands properly distinguished with tabs

The distinction between MySQL and MariaDB services is correctly made with separate Docker Compose commands. The tab structure clearly shows the service name differences.

content/docs/fa/migration/marzban.mdx (5)

116-127: SQLite section properly uses RTL wrapper

The SQLite database section is correctly wrapped in <div dir="rtl"> to ensure proper right-to-left text rendering. The old/new examples are clearly presented in Persian with code blocks properly formatted.


12-20: Dual migration paths explanation is well-structured in Persian

The description of two migration methods is clear and provides the same decision framework as English/Chinese/Russian versions. Users understand the tradeoff between complexity (current installation) vs. simplicity (new installation).


16-16: LanguageTool flags for "دستورات" appear to be alternative spelling suggestions

LanguageTool flags multiple instances of "دستورات" (commands) suggesting these are "misspellings," but this appears to be a false positive or alternative form detection. "دستورات" is the standard Persian plural for "commands." If LanguageTool is suggesting "دستورات" → "دستورات" (same form), these are false positives. Unless there's a specific style guide requiring an alternative form, no change is needed.

Also applies to: 20-20, 450-450, 727-727


225-401: Docker Compose accordions properly handle RTL formatting for Persian

The three-accordion structure for SQLite, MySQL, and MariaDB is implemented without explicit RTL wrappers on the YAML code blocks themselves, which is appropriate since code is typically left-to-right. The surrounding Persian text and before/after labels are clearly formatted. This structure effectively communicates all necessary configuration changes across database backends.


444-583: Database migration section properly separates MySQL and MariaDB procedures

The export/import process is clearly distinguished between MySQL (mysqldump, mysql commands) and MariaDB (mariadb-dump, mariadb commands). Tab structure makes it easy to switch between database types. The critical step of editing database names in SQL file (line 507-511) is clearly explained with both the sed command and manual editing options.

Comment thread content/docs/ru/migration/marzban.mdx Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
content/docs/ru/migration/marzban.mdx (1)

612-620: Enhance emphasis on manual post-migration configuration.

The callout at lines 612-620 correctly notes that settings won't be auto-migrated when using the new installation path. However, this is critical information that directly affects users' experience. Consider adding explicit examples (e.g., Telegram bot, URL prefix) of the manual steps they'll encounter, or cross-reference the panel configuration documentation more prominently to reduce confusion.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a176c0d and 108c535.

📒 Files selected for processing (1)
  • content/docs/ru/migration/marzban.mdx (9 hunks)
🔇 Additional comments (2)
content/docs/ru/migration/marzban.mdx (2)

752-752: Clarify Xray-Core reference in post-migration section.

Line 752 states "Сам PasarGuard не использует Xray-Core," but the document extensively references Xray configuration (xray_config.json, Xray templates, certificate directories) in the migration steps. This could confuse users about whether they need to manage Xray settings during migration.

Please clarify what role Xray-Core plays in PasarGuard or rephrase this sentence to better explain the relationship between PasarGuard and Xray-Core infrastructure.


643-645: Verify SQLite migration simplicity.

Line 645 suggests simply copying the SQLite database file (db.sqlite3) from Marzban to PasarGuard. This may oversimplify the migration—schema or initialization differences between versions could cause the database to be unusable or cause runtime errors.

Consider adding a verification step to validate the database after import, or clarifying any schema compatibility assumptions.

@M03ED M03ED merged commit 4348bf8 into PasarGuard:main Oct 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants