> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/ar/alsyanh/s3-migration.md).

# ترحيل S3

## ترحيل S3

{% hint style="info" %}
هذه التعليمات مخصصة للإصدار v5.x وما بعده. إذا كنت تتبع هذا الدليل لإصدار أقدم، فيرجى استخدام `sharelatex` بدلاً من `overleaf` في أسماء المسارات و `SHARELATEX_` بادئة بدلاً من `OVERLEAF_` لمتغيرات البيئة.
{% endhint %}

{% hint style="warning" %}
عملاء Server Pro: يُرجى التواصل مع الدعم قبل ترحيل بياناتكم إلى S3.
{% endhint %}

{% hint style="success" %}
**نود أن نسمع منك!** إذا كنت ترغب في مشاركتنا عدد الملفات التي رحّلتها، وحجمها الإجمالي، والمدة التي استغرقها الترحيل، فأرسل بريدًا إلكترونيًا إلى [`support@overleaf.com`](mailto:support@overleaf.com) .
{% endhint %}

سيرشدك هذا الدليل خلال عملية الترحيل من التخزين على القرص إلى تخزين كائنات متوافق مع S3. وهو يشير إلى أقسام من وثيقة المقدمة على الـ [إعداد S3](/on-premises/ar/althyeh/overleaf-toolkit/s3.md).

### المتطلبات

* تخزين كائنات متوافق مع S3 للتواصل معه، انظر [S3](/on-premises/ar/althyeh/overleaf-toolkit/s3.md#s3-setup) للاطلاع على الخيارات
* مساحة قرص حرة لترحيل البيانات الموجودة، بحدود حجم القرص الحالي
* نافذة صيانة لإجراء الترحيل الفعلي
* نسخة احتياطية كاملة، بما في ذلك الإعدادات، لتمكين الاستعادة منها

### قدّر حجم القرص المطلوب للترحيل

يمكننا استخدام `du` لحساب استخدام القرص الحالي:

```shell
docker exec sharelatex \
  du --human-readable --max-depth=0 /var/lib/overleaf/data/user_files

docker exec sharelatex \
  du --human-readable --max-depth=0 /var/lib/overleaf/data/template_files
```

في حال لم تتوفر لديك مساحة قرص كافية على الخادم الحالي، حاول إرفاق قرص آخر بالخادم.

{% hint style="info" %}
تحتوي أدلة السجل بالفعل على البنية الصحيحة. يمكنك الرفع مباشرةً من مجلد المصدر المربوط، وهو لا يتطلب أي مساحة قرص إضافية.
{% endhint %}

### خطوات الترحيل

#### الخطوة 0: أوقف المثيل

نحتاج إلى التأكد من ترحيل جميع ملفات المستخدم/القوالب. من الأفضل إيقاف المثيل لتجنب فقدان الملفات التي تم رفعها حديثًا.

يرجى الاطلاع على دليلنا حول إجراء نسخة احتياطية متسقة لإجراء عملية الإيقاف.

#### الخطوة 1: إعادة كتابة بنية الأدلة

نحتاج إلى إعادة كتابة بنية أدلة ملفات المشروع لرفعها إلى S3. بنية الأدلة للتخزين المحلي في filestore هي `<project-id>_<file-id>` وبنية الأدلة في S3 هي `<project-id>/<file-id>`.

فيما يلي، `/srv/overleaf-s3-migration` يُستخدم لتخزين الملفات في بنية الأدلة الجديدة.

يمكننا الاستفادة من `tar` لإعادة كتابة البنية:

```shell
mkdir -p /srv/overleaf-s3-migration/user_files \
         /srv/overleaf-s3-migration/template_files
docker exec sharelatex \
  tar --create --directory /var/lib/overleaf/data/user_files . \
| tar --extract --directory /srv/overleaf-s3-migration/user_files \
  --transform=sx_x/x
docker exec sharelatex \
  tar --create --directory /var/lib/overleaf/data/template_files . \
| tar --extract --directory /srv/overleaf-s3-migration/template_files \
  --transform=sx_x/xg
```

#### الخطوة 2: رفع الملفات

بحسب تفضيلك، يمكنك استخدام عميل S3 minio mc أو aws cli لرفع الملفات إلى تخزين الكائنات المتوافق مع S3.

**aws cli**

{% hint style="info" %}

* هنا ينبغي أن تستبدل `overleaf-user-files`, `overleaf-template-files`, `overleaf-project-blobs` و `overleaf-chunks` بأسماء دلاء S3 الخاصة بك.
* وأيضًا استبدل `/srv/overleaf-bind-mount` بالمسار المحلي لـ `/var/lib/overleaf` الربط. افتراضيًا، هذا هو `~/overleaf_data` في نشر docker-compose.yml و `<toolkit-checkout>/data/overleaf` عند استخدام Toolkit.
  {% endhint %}

{% code overflow="wrap" %}

```shell
aws s3 sync /srv/overleaf-s3-migration/user_files s3://overleaf-user-files
aws s3 sync /srv/overleaf-s3-migration/template_files s3://overleaf-template-files

aws s3 sync /srv/overleaf-bind-mount/data/history/overleaf-project-blobs s3://overleaf-project-blobs
aws s3 sync /srv/overleaf-bind-mount/data/history/overleaf-chunks s3://overleaf-chunks
```

{% endcode %}

**minio mc**

نستخدم اسم الخادم المستعار "s3" هنا، وربما تكون قد اخترت اسمًا آخر.

{% code overflow="wrap" %}

```shell
mc mirror /srv/overleaf-s3-migration/user_files s3/overleaf-user-files
mc mirror /srv/overleaf-s3-migration/template_files s3/overleaf-template-files

mc mirror /srv/overleaf-bind-mount/data/history/overleaf-project-blobs s3/overleaf-project-blobs
mc mirror /srv/overleaf-bind-mount/data/history/overleaf-chunks s3/overleaf-chunks
```

{% endcode %}

#### الخطوة 3: شغّل المثيل موجّهًا إلى S3

أضف جميع المتغيرات المتعلقة بـ S3 إلى إعداداتك، كما هو موضح في [نظرة عامة على المتغيرات](/on-premises/ar/althyeh/overleaf-toolkit/s3.md#overview-of-variables) قسم [S3](https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/s3) دليل الإعداد.

في عمليات النشر عبر Docker Compose، يمكنك أيضًا إزالة الربط لمجلد البيانات من قسم volumes.

{% hint style="success" %}
يرجى الإبقاء على [ربط قرص عمل للملفات المؤقتة](/on-premises/ar/aldam/troubleshooting.md#running-overleaf-with-an-nfs-filesystem) في مكانه.
{% endhint %}

يمكنك الآن تشغيل المثيل والتحقق من صحة الترحيل:

* يمكنه معاينة الملفات الثنائية في المحرر
* يمكنه تجميع ملف PDF مع صور
* يمكنه رفع ملفات جديدة

### التراجع

يمكنك التراجع عن الترحيل بسلاسة عبر عكس الخطوات:

1. أوقف المثيل
2. اعكس الملفات مرة أخرى عبر تبديل ترتيب المصدر/الوجهة
3. أعد كتابة الملفات الجديدة إلى الدليل المحلي باستخدام معكوس `تحويل`
4. أعد تشغيل المثيل بالإعدادات القديمة

{% code overflow="wrap" %}

```shell
# عند استخدام aws cli
aws s3 sync s3://overleaf-user-files /srv/overleaf-s3-migration/user_files
aws s3 sync s3://overleaf-template-files /srv/overleaf-s3-migration/template_files
aws s3 sync s3://overleaf-project-blobs /srv/overleaf-bind-mount/data/history/overleaf-project-blobs
aws s3 sync s3://overleaf-chunks /srv/overleaf-bind-mount/data/history/overleaf-chunks

# عند استخدام minio mc
mc mirror s3/overleaf-user-files /srv/overleaf-s3-migration/user_files
mc mirror s3/overleaf-template-files /srv/overleaf-s3-migration/template_files
mc mirror s3/overleaf-project-blobs /srv/overleaf-bind-mount/data/history/overleaf-project-blobs
mc mirror s3/overleaf-chunks /srv/overleaf-bind-mount/data/history/overleaf-chunks
```

{% endcode %}

```shell
# اكتب الملفات إلى Server CE/Server Pro المحلي
tar --create --directory /srv/overleaf-s3-migration/user_files . \
| docker exec --interactive sharelatex \
    tar \
      --extract \
      --keep-old-files \
      --directory /var/lib/overleaf/data/user_files \
      --transform=sx./xx --transform=sx/x_x \
      --wildcards '*/*/*'

tar --create --directory /srv/overleaf-s3-migration/template_files . \
| docker exec --interactive sharelatex \
    tar \
      --extract \
      --keep-old-files \
      --directory /var/lib/overleaf/data/template_files \
      --transform=sx./xx --transform=sx/x_xg \
      --wildcards '*/*/*/*/pdf-converted-cache/*' \
      --wildcards '*/*/*/*/pdf' \
      --wildcards '*/*/*/*/zip'
```

{% hint style="info" %}
يؤدي التحويل الأول إلى إزالة المجلد ذي المستوى الأعلى. ويغيّر التحويل الثاني بنية الأدلة إلى بنية مسطحة. وتضمن أحرف البدل استخراج الملفات فقط، وليس المجلدات الأصلية (مجلدات المشروع).
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/on-premises/ar/alsyanh/s3-migration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
