Yuanji's Wiki

人間は考える葦である

用户工具

站点工具


侧边栏

本页面的其他翻译:
zh

Return Home

Contact

wiki:install

这是本文档旧的修订版!


Install DokuWiki

The following instruction is used by Yuanji's Wiki.

Use docker-compose

Download docker-compose.yml

note: you should edit environment variables to meet your own needs.

docker-compose.yml
version: '2'
services:
  dokuwiki:
    image: 'bitnami/dokuwiki:0'
    restart: always
    ports:
      - '27721:80'
    environment:
      DOKUWIKI_USERNAME: 'gimo'
      DOKUWIKI_FULL_NAME: 'Yuanji Jiang'
      DOKUWIKI_PASSWORD: 'wiki'
      DOKUWIKI_EMAIL: 'self@gimo.me'
      DOKUWIKI_WIKI_NAME: "Yuanji's Wiki"
    volumes:
      - 'dokuwiki_data:/bitnami'
volumes:
  dokuwiki_data:
    driver: local

Create & start containers

docker-compose up -d

Backup DokuWiki

Download backup script

docker_volume_backup.sh
#!/bin/bash
 
compose_file_path=$1
project_name=$2
backup_path=$3
 
function backup_volume {
  volume_name=$1
  backup_destination=$2
 
  docker run --rm -v $volume_name:/data -v $backup_destination:/backup ubuntu tar -zcvf /backup/$volume_name.tar /data
}
 
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

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

wiki/install.1573914799.txt.gz · 最后更改: 2019/11/16 23:33 JST 由 gimo