[FEAT] Update user directories properly after an upgrade of base image

Đang mở Phù hợp với người mới
#92 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
62/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash, docker
Lĩnh vực
devops

Hướng nghiên cứu

Thay đổi nằm trong script init s6 tại root/etc/s6-overlay/s6-rc.d/init-dokuwiki-config/run, nơi vòng lặp trên USER_DIRECTORY hiện chỉ sao chép các thư mục mặc định khi /config/dokuwiki/<dir> chưa tồn tại. Hãy đọc vòng lặp này trước, sau đó quyết định cách sao chép mỗi lần khởi động mà không ghi đè các tệp do người dùng tạo, và kiểm tra đoạn mã đề xuất so với hai chú thích hiện có. Hoàn thành khi các thư mục người dùng mặc định của image được làm mới khi container khởi động và dữ liệu người dùng được giữ nguyên, được xác minh bằng cách chạy container với image gốc đã nâng cấp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement
Is this a new feature request?
  • I have searched the existing issues
Wanted change

As mentioned by @splitbrain in #90, newer files from the base image are not updated in the user folders:

... it does not update DokuWiki's default files when updating the image and people will run into this problem again in the future.

As background... Although the image moves the user folders from inside the container (/app/www/public) to outside (/config/dokuwiki): https://github.com/linuxserver/docker-dokuwiki/blob/b9a777eafc944052bab4d87c3abeb6a640811b9c/root/etc/s6-overlay/s6-rc.d/init-dokuwiki-config/run#L33-L38

This is however only done when the folder not already exists (! -d /config/dokuwiki/"${i}"). That makes sense: after a user starts using the wiki the user folder will probably contain user files and we do not want to overwrite those. The problem however: when the container is updated the newer version will never reach the user folder.

To fix this we should ALWAYS copy files from the container to the user folders (where applicable). This should be safe because a DokuWiki upgrade is (https://www.dokuwiki.org/install:upgrade) "...Step 4: Unpack the distribution tarball and upload/copy the files over your previous installation...". In other words: the container should not contain files that are modified by the user.

Reason for change

Updates to the image are not properly propagated leading to (potential) errors after a newer version of DokuWiki is released. See #90 for an example of such a case.

Proposed code change

Replace this: https://github.com/linuxserver/docker-dokuwiki/blob/b9a777eafc944052bab4d87c3abeb6a640811b9c/root/etc/s6-overlay/s6-rc.d/init-dokuwiki-config/run#L33-L38

With:

## Sync user folders to persistent storage
for i in "${USER_DIRECTORY[@]}"; do
    if [[ -d /app/www/public/"${i}" ]]; then
        mkdir -p /config/dokuwiki/"${i}"
        cp -a /app/www/public/"${i}" /config/dokuwiki/
    fi
done
Ngôn ngữ chính
Dockerfile
Star
125
Fork
24
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue tương tự

Thêm issue về DevOps

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.