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

未关闭 适合新手
#92 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
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> 不存在时才复制默认文件夹。请先阅读该循环,然后决定如何在每次启动时复制,同时不覆盖用户创建的文件,并对照现有的两条注释检查建议的代码片段。完成标准是:容器启动时刷新镜像中的默认用户文件夹,同时保持用户数据完好,并通过使用已升级的基础镜像运行容器来验证。

由索引模型根据 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. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 DevOps Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。