> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-pro.ayaka.space/on-premises/vi/bao-tri/docker-compose.yml-to-toolkit-migration.md).

# Di chuyển từ docker-compose.yml sang Toolkit

Nếu hiện tại bạn đang sử dụng Docker Compose thông qua một `docker-compose.yml` tệp, việc chuyển sang Toolkit có thể giúp việc triển khai, nâng cấp và bảo trì một phiên bản Overleaf tại chỗ trở nên dễ dàng hơn.

Để chuyển đổi, bạn sẽ cần chuyển cấu hình Docker Compose hiện có của mình sang định dạng mà Toolkit sử dụng. Quá trình này bao gồm việc sao chép cấu hình hiện có vào Toolkit.

Hướng dẫn này sẽ dẫn bạn qua từng bước của quá trình này, đảm bảo việc chuyển đổi từ Docker Compose sang Toolkit diễn ra suôn sẻ.

{% hint style="info" %}
Các hướng dẫn này dành cho v4.x và các phiên bản cũ hơn. Vì vậy, tất cả các biến đều sử dụng `SHARELATEX_` tiền tố thay vì `OVERLEAF_`.
{% endhint %}

{% stepper %}
{% step %}

### Sao chép kho lưu trữ Toolkit

Trước tiên, hãy sao chép kho lưu trữ Toolkit vào máy chủ:

```bash
git clone https://github.com/overleaf/toolkit.git ./overleaf-toolkit
```

Tiếp theo, chạy `bin/init` lệnh để khởi tạo Toolkit với cấu hình mặc định của nó.
{% endstep %}

{% step %}

### Thiết lập image và phiên bản

Trong một `docker-compose.yml` điển hình, image và phiên bản được định nghĩa trong phần mô tả thành phần, ví dụ:

```yaml
version: '2.2'
services:
    sharelatex:
        restart: always
        # Người dùng Server Pro:
        # image: quay.io/sharelatex/sharelatex-pro
        image: sharelatex/sharelatex:3.5.13
```

Khi sử dụng Toolkit, tên image sẽ được tự động xác định; yêu cầu duy nhất là thiết lập `SERVER_PRO=true` trong **config/overleaf.rc** để chọn image Server Pro hoặc `SERVER_PRO=false` để dùng Community Edition.

Số phiên bản Server Pro/Community Edition mong muốn được đặt trong tệp **config/version** Toolkit yêu cầu một số phiên bản cụ thể như `4.2.3`. Nếu bạn đang sử dụng `latest`, bạn có thể dùng `bin/images` để tìm image id của phiên bản `latest` cục bộ của bạn, sau đó dùng ghi chú phát hành cho 2.x.x, 3.x.x, 4.x.x hoặc 5.x.x để ánh xạ image id sang phiên bản.

Nếu bạn lấy image từ registry nội bộ của riêng mình, bạn có thể ghi đè image mà Toolkit sử dụng bằng cách đặt `OVERLEAF_IMAGE_NAME`. Bạn không cần chỉ định thẻ vì Toolkit sẽ tự động thêm nó dựa trên **config/version** trong tệp.
{% endstep %}

{% step %}

### Cấu hình truy cập bên ngoài

Theo mặc định, Overleaf sẽ lắng nghe trên `127.0.0.1:80`, chỉ cho phép lưu lượng từ máy chủ Docker.

Để cho phép truy cập bên ngoài, hãy đặt `OVERLEAF_LISTEN_IP` và `OVERLEAF_PORT` trong [**config/overleaf.rc**](/on-premises/vi/cau-hinh/overleaf-toolkit/environment-variables.md) trong tệp.
{% endstep %}

{% step %}

### Di chuyển biến môi trường

Có lẽ bạn sẽ có một tập các biến môi trường được định nghĩa trong `sharelatex` dịch vụ trong `docker-compose.yml`, ví dụ:

```yaml
environment:
    OVERLEAF_APP_NAME: Phiên bản Cộng đồng Overleaf
    OVERLEAF_PROXY_LEARN: 'true'
    …
```

Sao chép các biến này vào tệp [**config/variables.env**](broken://pages/556eaeb4dddcb30f8e61eab36f50573c660f1752) của Toolkit, đảm bảo theo dạng sau (dùng `=` thay vì `:`):

```env
OVERLEAF_APP_NAME=Phiên bản Cộng đồng Overleaf
OVERLEAF_PROXY_LEARN=true
```

Các ngoại lệ / khác biệt khi sử dụng Toolkit:

* Các biến bắt đầu bằng `SANDBOXED_COMPILES_` và `DOCKER_RUNNER` không còn cần nữa. Để bật Sandboxed Compiles, hãy đặt `SIBLING_CONTAINERS_ENABLED=true` trong **config/overleaf.rc** trong tệp.
* Các biến bắt đầu bằng `OVERLEAF_MONGO_`, `OVERLEAF_REDIS_` và `REDIS_HOST` biến không còn cần nữa. MongoDB và Redis giờ được cấu hình trong **config/overleaf.rc** tệp bằng cách sử dụng `MONGO_URL`, `REDIS_HOST` và `REDIS_PORT`.

Để biết các tùy chọn cấu hình nâng cao, hãy tham khảo [config/overleaf.rc](/on-premises/vi/cau-hinh/overleaf-toolkit/environment-variables.md) tài liệu.
{% endstep %}

{% step %}

### NGINX Proxy

Đối với hướng dẫn cách di chuyển `nginx`, xem [tài liệu TLS Proxy](/on-premises/vi/cau-hinh/overleaf-toolkit/tls-proxy.md):
{% endstep %}

{% step %}

### Các volume

Đặt vị trí của các volume dữ liệu trong **config/overleaf.rc**:

#### ShareLaTeX

Đặt `OVERLEAF_DATA_PATH` thành vị trí của volume dữ liệu được sử dụng bởi `sharelatex` container.

#### MongoDB

Đặt `MONGO_DATA_PATH` thành vị trí của volume dữ liệu được sử dụng bởi `mongo` container.

#### Redis

Đặt `REDIS_DATA_PATH` thành vị trí của volume dữ liệu được sử dụng bởi `redis` container.
{% endstep %}
{% endstepper %}

Để biết thêm chi tiết và cấu hình nâng cao, hãy tham khảo các tài liệu cấu hình Toolkit liên quan được liên kết ở trên.


---

# 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://overleaf-pro.ayaka.space/on-premises/vi/bao-tri/docker-compose.yml-to-toolkit-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.
