š³ DokuWiki Docker image on Alpine and Nginx with TrƦfik, Let's Encrypt and backup/restore to/from Git repo
docker-compose.yml
file is separated now to one for ādocuwikiā application container (docker-compose.yml
) and dedicated one for ātraefikā container (traefik/docker-compose.yml
)COMMON_NETWORK
variable, see belowdocker-compose.yml
file (traefik/docker-compose.yml
) can be used as an example, in case youād like to run ādokuwikiā application container on fresh docker system, as described below.env
file
DOKUWIKI_TRAEFIK_FE_RULE
traefik
frontend ruleHost:wiki.example.com
in docker-compose.yml
docker-compose.yml
, if not defined traffic will not be routed to dokuwiki
containerDOKUWIKI_TRAEFIK_FE_RULE=Host:wiki.example.com
PERSISTENT_DIR
/opt/docker/persistent
in pre-deploy.sh
/opt/docker/persistent
in docker-compose.yml
pre-deploy.sh
to create host persistent volumes directory structuredocker-compose.yml
and traefik/docker-compose.yml
to define persistent volumesPERSISTENT_DIR=/opt/docker/persistent
ACME_EMAIL
webmaster@example.com
in traefik/docker-compose.yml
traefik/docker-compose.yml
to define acme
email address, if not defined Letās Encrypt will not work correctlyACME_EMAIL=webmaster@example.com
DOCKER_DOMAIN
docker.localhost
in traefik/docker-compose.yml
traefik/docker-compose.yml
to define base domain name for frontend rules for hosts which are not full domain nameDOCKER_DOMAIN=docker.localhost
COMMON_NETWORK
traefik
and its served containerstraefik-public-network
in docker-compose.yml
traefik-public-network
in traefik/docker-compose.yml
docker-compose.yml
and traefik/docker-compose.yml
to define the name of the docker bridged network for connectivityCOMMON_NETWORK=traefik-public-network
BACKUP_USER_EMAIL
user.email
and derive user.name
(as the part of the email address before ā@ā sign) for Git commands used to commit backup data to Git backup repodocker-compose
to container ENTRYPOINTdokuwiki-backup@example.com
in docker-compose.yml
dokuwiki-backup@example.com
in container ENTRYPOINT if passed emptyBACKUP_USER_EMAIL=dokuwiki-backup@example.com
GIT_BACKUP_REPO_URL
origin
by default, and for which you can get the URL with the following command (run within your repo directory)
git remote get-url origin
pre-deploy.sh
script and in container ENTRYPOINTdocker-compose
to container ENTRYPOINTGIT_BACKUP_REPO_URL=git@bitbucket.org:username/reponame.git
TZ
Europe/Luxembourg
in docker-compose.yml
docker-compose
to container ENTRYPOINTUTC
in container ENTRYPOINT if passed emptyTZ=Europe/Oslo
.env
and they will be passed as is to container ENTRYPOINT by docker-compose
MEMORY_LIMIT
256M
MEMORY_LIMIT=256M
UPLOAD_MAX_SIZE
16M
UPLOAD_MAX_SIZE=16M
OPCACHE_MEM_SIZE
128
OPCACHE_MEM_SIZE=128
/data
- bind to host ${PERSISTENT_DIR}/dokuwiki/data
folder
/root/.ssh
- bind to host ${PERSISTENT_DIR}/dokuwiki/root/.ssh
folder
config
and known_hosts
filesid_rsa
/acme.json
- bind to host ${PERSISTENT_DIR}/acme.json
file
80
- HTTP port - redirects traffic to itself (Traefik) to HTTPS port (443)443
- HTTPS port - proxies traffic to DokuWiki to HTTP port (80)80
- HTTP port - serves DokuWiki wikicd
to it, and run the following commands from within this project directory.env
file with the following environment variables, see the description and examples above
DOKUWIKI_TRAEFIK_FE_RULE=Host:wiki.example.com
PERSISTENT_DIR=/opt/docker/persistent
ACME_EMAIL=webmaster@example.com
DOCKER_DOMAIN=docker.localhost
BACKUP_USER_EMAIL=dokuwiki-backup@example.com
GIT_BACKUP_REPO_URL=git@bitbucket.org:username/reponame.git
COMMON_NETWORK=traefik-public-network
TZ=Europe/Oslo
MEMORY_LIMIT=
UPLOAD_MAX_SIZE=
OPCACHE_MEM_SIZE=
pre-deploy.sh
), make it executable, and run it
curl -sSL https://raw.githubusercontent.com/mtilson/dokuwiki/master/pre-deploy.sh > pre-deploy.sh
chmod +x pre-deploy.sh
./pre-deploy.sh
${PERSISTENT_DIR}/dokuwiki/root/.ssh/id_rsa
read/write
only by root
:
sudo chmod 600 ${PERSISTENT_DIR}/dokuwiki/root/.ssh/id_rsa
GIT_BACKUP_REPO_URL
variable defined above specifies Git remote SSH URL address used to access your Git backup repogit@<gitserver>:<user>/<repo>.git
, which means that user account <user>
has access to repository <repo>
on Git server <gitserver>
<user>
account on the <gitserver>
server
config
) in the host persistent volume as ${PERSISTENT_DIR}/dokuwiki/root/.ssh/config
Host bitbucket.org
StrictHostKeyChecking no
Ctrl-C
to exit)
docker-compose -f docker-compose.yml -f traefik/docker-compose.yml pull
docker-compose -f docker-compose.yml -f traefik/docker-compose.yml up -d
docker-compose -f docker-compose.yml -f traefik/docker-compose.yml logs -f # to see the container logs in console; Ctrl-C to exit
${PERSISTENT_DIR}/dokuwiki/root/.ssh/id_rsa
), the container initialization script will generate a public/pravite key pair, store the generated keys in ${PERSISTENT_DIR}/dokuwiki/root/.ssh/
, and show the public key in the container log, waiting for the access to Git backup repo be provided - see the next pointPlease add the public key ...
messages in the container log in consolecommited
to the configured Git backup repo. On the next container run, DokuWiki data from the Git backup repo will be cloned/pulled
to the container /data
volumeSave
The configuration was finished successfully. You may delete the install.php file now. ...
Ctrl-C
in console to exit from docker-compose logs
, delete the install.php
file with the following command:
docker exec dokuwiki /bin/sh -c "rm -fr /var/www/install.php"
docker-compose -f docker-compose.yml -f traefik/docker-compose.yml pull
docker-compose -f docker-compose.yml -f traefik/docker-compose.yml up -d
docker-compose -f docker-compose.yml -f traefik/docker-compose.yml down
docker-compose -f docker-compose.yml -f traefik/docker-compose.yml pull
docker-compose -f docker-compose.yml -f traefik/docker-compose.yml up -d
/data
folder are periodically backed up to the provided Git backup repo/data
volume and hostās ${PERSISTENT_DIR}/dokuwiki/data
folder. Use pre-deploy.sh
script and the above Installation section to prepare hostLICENSE
for more details