Yuanji's Wiki

人間は考える葦である

用户工具

站点工具


wiki:install

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
wiki:install [2019/11/16 23:33 JST]
gimo [Download docker-compose.yml]
wiki:install [2019/11/17 20:47 JST]
gimo language convert to zh
行 1: 行 1:
-====== Install DokuWiki ======+====== 安装 DokuWiki ======
  
-The following instruction is used by [[:start|Yuanji's Wiki]].+[[:start|Yuanji's Wiki]] 使用下面的步骤搭建。
  
-===== Use docker-compose =====+===== 使用 docker-compose =====
  
-==== Download docker-compose.yml ====+==== 下载 docker-compose.yml ====
  
-**noteyou should edit environment variables to meet your own needs. **+注意你可以需要修改 ''ports'' 和 ''environment'' 以满足自己的需要。
  
 <file yaml docker-compose.yml> <file yaml docker-compose.yml>
行 30: 行 30:
 </file> </file>
  
-==== Create & start containers ====+==== 创建并启动容器 ====
  
   docker-compose up -d   docker-compose up -d
  
-===== Backup DokuWiki =====+===== 备份 DokuWiki =====
  
-==== Download backup script ====+  docker-compose stop
  
-<file bash docker_volume_backup.sh> +  docker run --rm -v dokuwiki_dokuwiki_data:/data -v /opt/dokuwiki/dokuwiki_backup:/backup ubuntu tar -zcvf /backup/dokuwiki_dokuwiki_data.tar /data
-#!/bin/bash+
  
-compose_file_path=$1 +===== 恢复 DokuWiki =====
-project_name=$2 +
-backup_path=$3+
  
-function backup_volume { +  docker volume create dokuwiki_dokuwiki_data 
-  volume_name=$1 +   
-  backup_destination=$2+  docker run -v dokuwiki_dokuwiki_data:/bitnami --name dummy_dokuwiki ubuntu /bin/bash
  
-  docker run --rm -v $volume_name:/data -v $backup_destination:/backup ubuntu tar -zcvf /backup/$volume_name.tar /data +  docker run --rm --volumes-from dummy_dokuwiki -v $(pwd):/backup ubuntu bash -c "cd /bitnami && tar xvf /backup/dokuwiki_dokuwiki_data.tar --strip 1"
-}+
  
-echo "Stopping running containers" 
-docker-compose -f $compose_file_path stop 
  
-echo "Mounting volumes and performing backup..." +===== 参考资料 =====
-volumes=($(docker volume ls -f name=$project_name | awk '{if (NR > 1) print $2}')) +
-for v in "${volumes[@]}" +
-do +
-  backup_volume $v $backup_path +
-done +
- +
-echo "Restarting containers" +
-docker-compose -f $compose_file_path start +
-</file> +
- +
-==== Backup DokuWiki's volume ==== +
- +
-  ./docker_volume_backup.sh $compose_file_path dokuwiki $backup_path +
- +
-==== Restore DokuWiki's volume ==== +
- +
-  docker run --rm --volumes-from dokuwiki_dokuwiki_1 -v $(pwd):/backup ubuntu bash -c "cd /bitnami && tar xvf /backup/dokuwiki_dokuwiki_data.tar --strip 1" +
- +
- +
-===== See also =====+
   * [[https://hub.docker.com/r/bitnami/dokuwiki|bitnami/dokuwiki - Docker Hub]]   * [[https://hub.docker.com/r/bitnami/dokuwiki|bitnami/dokuwiki - Docker Hub]]
   * [[https://gist.github.com/kiview/5ff58ed69366e2d591d19ac34d8f8616/|Docker-Compose volume backup]]   * [[https://gist.github.com/kiview/5ff58ed69366e2d591d19ac34d8f8616/|Docker-Compose volume backup]]
   * [[https://docs.docker.com/storage/volumes/#backup-restore-or-migrate-data-volumesUse|volumes | Docker Documentation ]]   * [[https://docs.docker.com/storage/volumes/#backup-restore-or-migrate-data-volumesUse|volumes | Docker Documentation ]]
  
wiki/install.txt · 最后更改: 2019/11/17 20:47 JST 由 gimo