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

Aperta Adatta ai principianti
#92 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
62/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bash, docker
Ambito
devops

Direzione di ricerca

La modifica va nello script di init s6 in root/etc/s6-overlay/s6-rc.d/init-dokuwiki-config/run, dove il ciclo su USER_DIRECTORY attualmente copia le cartelle predefinite solo se /config/dokuwiki/<dir> non esiste. Leggi prima questo ciclo, poi decidi come copiare a ogni avvio senza sovrascrivere i file creati dall'utente, e verifica lo snippet proposto rispetto ai due commenti esistenti. Il lavoro è completo quando le cartelle utente predefinite dell'immagine vengono aggiornate all'avvio del container e i dati utente restano intatti, verificato eseguendo il container con un'immagine base aggiornata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Dockerfile
Stelle
125
Fork
24
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Issue simili

Altre issue su DevOps

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.