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

オープン 初心者向け
#92 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
62/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
bash, docker
領域
devops

調査の方向性

変更は s6 初期化スクリプト root/etc/s6-overlay/s6-rc.d/init-dokuwiki-config/run に加えます。このファイルでは USER_DIRECTORY に対するループが、/config/dokuwiki/<dir> が存在しない場合にのみデフォルトのフォルダをコピーしています。まずこのループを読み、ユーザーが作成したファイルを上書きせずに、起動のたびにコピーする方法を決めてください。提案するスニペットは、既存の2つのコメントと照らし合わせて確認してください。完了条件は、コンテナ起動時にイメージのデフォルトのユーザーフォルダが更新され、ユーザーデータが保持されることです。更新したベースイメージでコンテナを実行して検証してください。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
Dockerfile
スター
125
フォーク
24
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

似ている issue

DevOps の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。