Sign inSign up

dshap/wiki

By dshap

Updated 12 days ago

Docker image for wiki web server

Image
Web servers
Content management system
0

331

dshap/wiki repository overview

Wiki web server

Docker image for wiki web server.

Container runs as non-root user. This user owns wiki process and owns wiki files.

To run container next volumes should be mapped:

  • folder for SQL database
  • folder for wiki images
  • logs folder
  • backups folder

Installation

Installation from docker image
  1. Pull docker image
  2. Create user and group to own wiki files and to run docker container:
    sudo groupadd -g 1192 wiki
    
    useradd -u 1192 -g 1192 -M wiki
    
  3. Proceed to configuration
Installation from source
  1. Pull project sources from version control system
  2. Create user and group to own wiki files and to run docker container:
    sudo useradd -r wiki
    
    sudo groupmod -g 1192 wiki
    
    sudo usermod -u 1192 wiki
    
  3. Make build executable:
    sudo chmod u+x ./build
    
  4. Execute build:
    sudo ./build wiki
    
  5. Proceed to configuration
Configuration
  1. Obtain configuration files and scripts from the container:
    cd ~
    
    mkdir conf
    
    sudo chown wiki:wiki ~/conf
    
    sudo docker run \
        --rm \
        -v ~/conf:/export \
        dshap/wiki:1.43.9 export-assets
    
  2. Create folders for wiki files:
    sudo mkdir /wiki
    
    sudo mkdir /wiki/db
    
    sudo mkdir /wiki/images
    
    sudo chown -R wiki:wiki /wiki
    
  3. Create a folder for logs:
    sudo mkdir /var/log/wiki
    
    sudo chown -R wiki:wiki /var/log/wiki
    
  4. Create a folder for backups:
    sudo mkdir /var/backups/wiki
    
    sudo chown -R wiki:wiki /var/backups/wiki
    
  5. Copy service configuration file:
    sudo cp ~/conf/etc/init.d/wiki /etc/init.d
    
    sudo chmod a+x /etc/init.d/wiki
    
  6. Copy docker run script:
    sudo cp ~/conf/usr/sbin/wiki /usr/sbin
    
    sudo chmod a+x /usr/sbin/wiki
    
  7. Copy util script:
    sudo cp ~/conf/usr/bin/wkutil /usr/bin
    
    sudo chmod a+x /usr/bin/wkutil
    
  8. Remove temporary config folder:
    sudo rm -rf ~/conf
    
  9. Register service:
    sudo update-rc.d wiki defaults
    
  10. Specify database root password in /usr/sbin/wiki file:
    docker run ... -e DB_ROOT_PASSWORD="<some_password>" ...
    
  11. Specify wiki database user password in /usr/sbin/wiki file:
    docker run ... -e DB_USER_PASSWORD="<some_password>" ...
    
  12. Specify wiki server URL in /usr/sbin/wiki file:
    docker run ... -e SERVER="<some_server>" ...
    
  13. Specify wiki language code in /usr/sbin/wiki file:
    docker run ... -e LANGUAGE_CODE="<some_language_code>" ...
    
  14. Start wiki service:
    sudo service wiki start
    
  15. Initialize wiki database:
    sudo wkutil initialize
    
  16. Obtain the generated secret key and upgrade key from the output
  17. Specify wiki secret key in /usr/sbin/wiki file:
    docker run ... -e SECRET_KEY="<some_key>" ...
    
  18. Specify wiki upgrade key in /usr/sbin/wiki file:
    docker run ... -e UPGRADE_KEY="<some_key>" ...
    
  19. Restart wiki service:
    sudo service wiki restart
    
  20. Log in to the interface and change the admin password, default login/password is admin/password1%

Management

Service management
sudo service wiki (start|stop|status|restart)
Create backup
sudo wkutil backup <filename>

Backup file /var/backups/wiki/<filename>.tar.gz will be created.

Restore backup
sudo wkutil restore <filename>
Command line (bash)
sudo wkutil bash

Apache mod_proxy configuration

Wiki web server can be located with another web applications. For example, mercurial, bugzilla, wiki etc can be run as docker containers on the same host. In this case apache server can be used to redirect requests to different docker containers.

  1. Enable apache mod_proxy:
    sudo a2enmod deflate headers proxy proxy_ajp proxy_balancer proxy_connect proxy_html proxy_http rewrite
    
  2. Configure proxy:
    <VirtualHost *:80>
        ...
        ProxyPreserveHost On
        <Proxy *>
            Order allow,deny
            Allow from all
        </Proxy>
        ...
    </VirtualHost>
    
  3. Copy site configuration file:
    sudo cp ~/conf/etc/apache2/sites-available/wiki.conf /etc/apache2/sites-available
    
  4. Enable apache sites:
    sudo a2ensite wiki
    
  5. Restart apache service:
    sudo service apache2 restart
    

HOW TO

How to change database root password
  1. Stop wiki service:
    sudo service wiki stop
    
  2. Specify new database root password in /usr/sbin/wiki file:
    docker run ... -e DB_ROOT_PASSWORD="<new_password>" ...
    
  3. Start wiki service:
    sudo service wiki start
    
  4. Run the following command:
    sudo wkutil change-root-password "<old_password>"
    
How to change database user password
  1. Stop wiki service:
    sudo service wiki stop
    
  2. Specify new wiki database user password in /usr/sbin/wiki file:
    docker run ... -e DB_USER_PASSWORD="<new_password>" ...
    
  3. Start wiki service:
    sudo service wiki start
    
  4. Run the following command
    sudo wkutil change-user-password
    
How to specify special characters in password

Special characters should be escaped:

docker run ... -e DB_ROOT_PASSWORD="pa\$\$word" ...
docker run ... -e DB_USER_PASSWORD="pas\$11" ...
How to change skin
  1. Stop wiki service:
    sudo service wiki stop
    
  2. Specify skin name in /usr/sbin/wiki file:
    docker run ... -e DEFAULT_SKIN="<skin>" ...
    
  3. Start wiki service:
    sudo service wiki start
    
How to perform maintenance operations
  1. Connect to container:
    sudo wkutil bash
    
  2. Go to wiki root folder:
    cd /var/www/html/wiki
    
  3. Perform PHP scripts, for example:
    php maintenance/update.php
    
How to stop MariaDB correctly (in case of upgrades from an old version)
  1. In one terminal run MariaDB:
    sudo docker run --rm \
        --name mariadb104 \
        -v /wiki/db:/wiki/db \
        mariadb:10.4 mysqld --user=root --datadir=/bugzilla/db
    
  2. Wait until log appears that MariaDB is ready to accept connections
  3. In another terminal stop MariaDB:
    sudo docker stop mariadb104
    
How to create cron job for backups
sudo crontab -l | { cat; echo "minute hour * * * /usr/bin/wkutil backup <filename>"; echo ""; } | sudo crontab -

Tag summary

Content type

Image

Digest

Size

491.6 MB

Last updated

about 5 years ago

docker pull dshap/wiki