نقل التحميلات والنسخ الاحتياطية إلى تخزين الكتل في DigitalOcean

So you want to move all uploads and backups to DigitalOcean Block Storage?

Before you do this, though, you might instead consider Configure an S3 compatible object storage provider for uploads. It is no more complicated to set up and provides some other advantages.

Setup a Discourse instance on DigitalOcean

Setup a Discourse instance on DigitalOcean using our official guide.

Add a Volume to your droplet

Add a block storage volume to your droplet. Note down the name of the volume. In my case the name of the volume was volume-nyc1-05.

Make sure the volume is formatted and mounted at /mnt/volume_nyc1_05.

Move /var/discourse/shared to the volume

For best performance we will keep postgres_data on our main drive and will move rest of the data to the newly attached volume.

Logged in as root, run these commands from your server:

mv /var/discourse/shared/standalone/postgres_data /var/postgres_data_discourse
mv /var/discourse/shared /mnt/volume_nyc1_05

Make sure to replace volume_nyc1_05 with the name of your volume.

Edit app.yml to reflect the changes

Open the /var/discourse/containers/app.yml file in your preferred editor and look for this block:

## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

Replace the above block with:

## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
      host: /mnt/volume_nyc1_05/shared/standalone
      guest: /shared
  - volume:
      host: /mnt/volume_nyc1_05/shared/standalone/log/var-log
      guest: /var/log
  - volume:
      host: /var/postgres_data_discourse
      guest: /shared/postgres_data

Make sure to replace volume_nyc1_05 with the name of your volume.

Save the app.yml file and rebuild the container.

/var/discourse/launcher rebuild app

:tada: Voila!

That’s it all your uploads and backups are now moved to DigitalOcean Block Storage.


Credits

This guide is inspired from @sam’s suggestion here.

37 إعجابًا

أحاول اتباع هذا النهج في Hetzner الذي لديه تخزين مشابه ولكني أتساءل عما إذا كان ذلك قد يضر بأدائنا العام.

قرأت أنه سيقدم ثلث سرعة SSD ولكني أتحدث عن فرق ملحوظ في الاستخدام اليومي لتحميل وعرض الملفات في مثيل Discourse الخاص بنا لأنني لست متأكدًا مما إذا كان هذا الثلث يؤثر حقًا أو ما إذا كان جيدًا لتحميل الملفات.

بالطبع، تعتمد النتيجة النهائية على وحدة المعالجة المركزية (CPU) والذاكرة العشوائية (RAM) ونظام الملفات وحجم الكتلة التي نستخدمها.

هل يرغب شخص ما في مشاركة تجربته؟ :slight_smile:

شكراً على الدليل!

هل يجب إيقاف تشغيل القطرة قبل القيام بذلك؟ عادةً ما أفترض نعم ولكن نظرًا لأنه مجرد تبديل التحميلات؟

لا. فقط قم بإنشاء المساحة واتبع التعليمات لتركيبها.

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

هل هناك أي طريقة يمكنني من خلالها تشغيل تشخيص على ذلك والقيام ببعض الإصلاحات التلقائية؟

هل قمت بإصلاح المشكلة في النهاية؟

إعجاب واحد (1)

لا :frowning: لم أتمكن من إصلاحه.

إعجاب واحد (1)