استعادة نسخة احتياطية من سطر الأوامر

:bookmark: يشرح هذا الدليل كيفية استعادة نسخة احتياطية من Discourse من سطر الأوامر دون استخدام واجهة مستخدم الويب الخاصة بـ Discourse.
:person_raising_hand: مستوى المستخدم المطلوب: مسؤول
:wrench: يتطلب الوصول إلى وحدة التحكم

إليك كيفية استعادة نسخة احتياطية من Discourse من سطر الأوامر، دون تشغيل واجهة مستخدم الويب الخاصة بـ Discourse على الإطلاق. هذا مفيد عندما تقوم بنقل الخوادم.

المتطلبات الأساسية

قبل البدء، تأكد من إكمال الخطوات التالية:

  1. قم بتنزيل أحدث ملف نسخة احتياطية من مثيل Discourse المصدر.
  2. قم بتهيئة مثيل Discourse الوجهة عن طريق تشغيل ./discourse-setup أو نسخ app.yml الحالي لديك.
  3. تأكد من أن مثيل Discourse الوجهة هو أحدث إصدار. قم بتحديثه إذا لزم الأمر.

نقل النسخة الاحتياطية

  1. قم بتسجيل الدخول عبر SSH إلى الخادم الوجهة، أو قم بإنشاء مجلد النسخ الاحتياطي هناك بأي طريقة أخرى:

mkdir -p /var/discourse/shared/standalone/backups/default

  1. قم بتحميل ملف النسخة الاحتياطية الخاص بك إلى الخادم الوجهة.

scp /path/to/backup/backup.tar.gz root@192.168.1.1:/var/discourse/shared/standalone/backups/default

تأكد من استبدال المسارات وأسماء الملفات وأسماء الخوادم بتلك التي تستخدمها - ولكنك تريد أن ينتهي الأمر بملف النسخة الاحتياطية في:

/var/discourse/shared/standalone/backups/default

:mega: يمكنك أيضًا تحميل وتنزيل ملف النسخة الاحتياطية الخاص بـ Discourse الخاص بك من مواقع التخزين على الويب الشائعة مثل Google Drive أو Dropbox أو OneDrive، وما إلى ذلك - ستحتاج إلى البحث عن تعليمات سطر الأوامر المحددة بناءً على مزود التخزين على الويب المفضل لديك.

:warning: لا تقم بتغيير اسم ملف النسخة الاحتياطية! يعامل Discourse اسم ملف النسخة الاحتياطية كبيانات وصفية، لذا إذا قمت بتغيير اسم الملف، فلن يعمل الاستعادة. التزم باسم الملف الأصلي.

استبدل /path/to/backup/discourse-xyz.tar.gz بالمسار المحلي لملف النسخة الاحتياطية الخاص بك، واستبدل \u003cserver_ip_address\u003e بعنوان IP الخاص بالخادم الوجهة.

:bulb: إذا تم استخدام Nginx كـ وكيل عكسي، فتأكد من أن الحاوية يمكنها قراءة جميع المسارات إلى النسخة الاحتياطية ويمكن لـ Nginx قراءة ملف .sock.

استعادة النسخة الاحتياطية

  1. قم بالوصول إلى الخادم الوجهة وانتقل إلى مجلد Discourse:
cd /var/discourse
  1. ادخل إلى حاوية تطبيق Docker الخاصة بـ Discourse:
./launcher enter app
  1. تمكين وظيفة الاستعادة:
discourse enable_restore
  1. استعادة ملف النسخة الاحتياطية:
discourse restore sitename-2019-02-03-042252-v20190130013015.tar.gz

:bulb: نصيحة: إذا قمت بتشغيل discourse restore بدون اسم ملف، فسوف يسرد جميع ملفات النسخ الاحتياطي المتاحة.

:warning: إذا تم تكوين إعداد backup_location الخاص بموقعك لاستخدام S3، ولكنك قمت بتحميل ملف النسخة الاحتياطية يدويًا إلى نظام الملفات المحلي، فيجب عليك تحديد --location local:

discourse restore --location local sitename-2019-02-03-042252-v20190130013015.tar.gz

وبالمثل، استخدم --location s3 للاستعادة مباشرة من نسخة احتياطية على S3 دون تنزيلها أولاً.

  1. اخرج من حاوية تطبيق Docker الخاصة بـ Discourse:
exit

إعادة البناء

بعد استعادة النسخة الاحتياطية، قد تختار إعادة بناء المثيل الوجهة لضمان تطبيق جميع الإعدادات والتكوينات بشكل صحيح.

:mega: الآن هو الوقت المناسب لتحديث /var/discourse/containers/app.yml باستخدام HTTPS كامل أو إضافات إضافية أو تكوين CDN. قارن تكوين app.yml لكلا المثيلين للتأكد!

cd /var/discourse
./launcher rebuild app

تمكين البريد الإلكتروني

عند استعادة نسخة احتياطية، يتم تعطيل البريد الصادر للمستخدمين غير الموظفين. أنت لا تريد أن يبدأ خادم الاختبار الخاص بك، أو الخادم الجديد، أو الخادم الذي استعدت للتو نسخة احتياطية منه لسبب آخر، في إرسال بريد إلكتروني إلى المستخدمين! قم بتغيير إعداد الموقع disable_emails إلى “no” لإعادة تمكين البريد الإلكتروني.

:tada: هذا كل شيء. تم استعادة خادم Discourse الخاص بك بنجاح.

78 إعجابًا
Move your Discourse Instance to a Different Server
Any other way to take backup and restore?
How easy is it to move to another server?
HELP! My Discourse just deleted everything?
Restore backup is broken
How to migrate Discourse from one server to another with the same DNS name
Best Practices for Backups
Problem upgrading Discourse
Upgrading v2.2.0.beta4 forum with unknown local changes
Set up file and image uploads to S3
Quick question about site backups
My install broke after updating, how can I fix it?
Is there any way to restore your site from backup in the terminal?
Migrating Discourse from one DigitalOcean droplet to another without downtime
Restore backup right away after installing Discourse
Unable to migrate to S3, therefore unable to restore from backup
Restore Failure - S3 (compatible) backup
"EXCEPTION: psql failed: DETAIL: Key (post_id)=(36946) is duplicated."
Migrate from another forum to Discourse
My install is 16,359 commits behind! Advice?
Trying to recover an installation
Migration failed: relation "user_required_fields_versions" already exists
How can I manually verify via the CLI and bypass the Congratulations, you installed Discourse! screen?
Configuring automatic backups
Migrating to a new server that has a new DB and new S3 buckets for backup and uploads
Intended path to migrate S3 to local
Problem when updating Discourse Forum
Failed to restore from the backup
Steps involved to downgrade from 2GB to 1GB on DO?
Forum offline: Restore is not working through web
Forum offline: Restore is not working through web
Testing Restore - not working
Entire site is a blank page after upgrade
"discourse: command not found" when trying to restore a backup from the command line
Stuck with 500 error after weird bugs and a rebuild
Plesk server migration
"Key is stored in legacy trusted.gpg keyring" warning
"Key is stored in legacy trusted.gpg keyring" warning
Discourse broken after moving servers
Stuck and lost updating forum, problems with PG migration
How to manually migrate s3 files to local?
Index_users_on_username_lower error during database restore: import failed
How can I get the current version information from my backup?
Backup Prod -> Snap -> Build Test -> Change Address
How to properly package discourse as an image
2FA with OTP broken after restoring from Backup
I'm trying to migrate an old discourse by creating a new discourse, but I'm having trouble
Recover from filesystem backup: can't rebuild nor start
Error: Can't notify admin while restoring backup during a migration to a fresh install
MKJ's Opinionated Discourse Deployment Configuration
Migrate from AWS to Digital Ocean with 2 containers, spaces and 2 CDNs
Cannot restore database: sql key is duplicated
Finding UI generated backup and restoring site
Backup discourse from the command line
Migration to a Self-Hosted solution from Kubernetes
How to download the backup file without SMTP function?
Redis Problems? (Forum broken after upgrade)
Can't upload backup
Can't upload backup
Can't upload backup
Rate limiter issues when uploading a backup file / can't disable rate limiter
Help restoring - system hung at midnight
Help restoring - system hung at midnight
Uploads missing after restore
My install is 16,359 commits behind! Advice?
Issues Rebuilding After Upgrade to Ubuntu 22.04