Public Repository

Last pushed: 5 months ago
Short Description
Wiki.js image based from requarks/wiki
Full Description

Tags

References

Example Use

1. Create a New Network

$ docker network create wikijs

2. Create a MongoDB

$ docker run -d --name wikijs-mongo --network=wikijs \
  -v wikijs-configdb:/data/configdb \
  -v wikijs-datadb:/data/db \
  mongo

3. Create SSH key

ssh-keygen -t rsa -b 4096 -C “your_comment_or_email”

Print and copy the public key.

cat ~/.ssh/id_rsa.pub

4. Create a Git repository

4.1 Go to GitHub and create a new repository.
4.2 Add public key to the repository (Settings --> Deploy keys --> Add deploy key)

5. Create a Wikijs

$ docker run -d --name wikijs --network=wikijs \
  -e TITLE='Wiki' \
  -e HOST='http://localhost' \
  -e PORT=3000 \
  -e MONGO_HOST=wikijs-mongo \
  -e GIT_URL=git@github.com:yourid/yourrepo.git \
  -e WIKI_ADMIN_EMAIL=youremail@domain.com \
  -v ~/.ssh:/var/wiki/keys \
  -p 3000:3000
  pacroy/wikijs

6. Configure Nginx (Optional)

In case, you want to put Wikijs behind Nginx reverse proxy or want HTTPS.

6.1 Create Nginx container: docker container run -d -p 80:80 -p 443:443 --name nginx nginx
6.2 Add Nginx to the same network: docker network connect wikijs nginx
6.3 Create file default.conf: vim default.conf and input the following

HTTP

server {
    listen 80;
    listen [::]:80;
    server_name  wiki.example.com;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://wikijs:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_next_upstream error timeout http_502 http_503 http_504;
    }
}

HTTPS

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name  wiki.example.com;

    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_session_tickets off;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
    ssl_prefer_server_ciphers on;

    ssl_certificate /etc/nginx/ssl/fullchain.pem;
    ssl_certificate_key /etc/nginx/ssl/privkey.pem;
    ssl_trusted_certificate /etc/nginx/ssl/chain.pem;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://wikijs:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_next_upstream error timeout http_502 http_503 http_504;
    }
}

In case HTTPS, copy SSL files to the folder /etc/nginx/ssl.

Self-signed certificate can be generated with:

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 30000 -nodes

Reference: https://docs.requarks.io/wiki/admin-guide/setup-nginx

Docker Pull Command
Owner
pacroy