Root-Server Tutorial

ROOT-SERVER TUTORIAL

Installing Wiki.js via Docker Compose

Author:

Patrick Meyhöfer

Last updated:

22/10/2023

Introduction

This tutorial will guide you through the process of installing Wiki.js using Docker Compose. By the end, you'll have a fully functional Wiki.js instance running in a Docker container.

The tutorial uses the example hostname v11111111.quicksrv.de. This hostname needs to be replaced by the name of your own server when you perform the workflow described in this tutorial.

Requirements

  • A Linux server
  • Basic understanding of shell commands.

The smallest netcup server meets these requirements.

Step 1 - Install Docker Compose

If you haven't installed Docker and Docker Compose on your server, use the following commands:

## Install Docker Compose
apt install docker-compose

Step 2 - Create a Docker Compose file for Wiki.js

Create a new directory for your Wiki.js setup and navigate into it:

mkdir wikijs && cd wikijs

Now, create a docker-compose.yml file using your favorite text editor (e.g., nano):

nano docker-compose.yml

Paste the following text into that file:

version: '3'
services:
  db:
    image: postgres:11-alpine
    environment:
      POSTGRES_DB: wiki
      POSTGRES_USER: wikijs
      POSTGRES_PASSWORD: wikijsrocks
    volumes:
      - db-data:/var/lib/postgresql/data
  wiki:
    image: requarks/wiki:2
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
    ports:
      - "80:3000"
volumes:
  db-data:

In this configuration, we have defined the following parameters:

  • We define the environmental variables to configure the PostgreSQL database.
  • We map port 3000 inside the wiki container to port 80 on the host, making our Wiki.js instance accessible at http://v11111111.quicksrv.de.
  • environment: List of environment variables set within the container.
  • POSTGRES_DB: Name of the database to be created.
  • POSTGRES_USER: Username for the database.
  • POSTGRES_PASSWORD: Password for the database user.
  • Note: You should replace the password wikijsrocks with a secure password of your choice.
  • DB_TYPE: Type of the database, here postgres.
  • DB_HOST: Hostname of the database. Since the database is within the same Docker network, we use the service name db.
  • DB_PORT: Port of the database, default is 5432 for PostgreSQL.
  • DB_USER and DB_PASS: Credentials to access the database. These should match the environment variables of the db service.
  • DB_NAME: Name of the database to be used.
  • ports: Determines which ports are forwarded from the host to the container.
    • 80:3000: Forwards port 80 of the host to port 3000 inside the container.

When using this Docker Compose file, you should as a minimum replace the database password with a secure password of your choice. All other configuration parameters can be adjusted according to your requirements and infrastructure.

Step 3 - Starting the Wiki.js containers

Now, run the following command to start the Wiki.js and its database containers:

docker-compose up -d

This command will download the necessary images and start the containers in detached mode.

Step 4 - Access the Wiki.js installation

Once the containers are up and running, open your web browser and navigate to your server's address, e.g., http://v11111111.quicksrv.de. You should see the Wiki.js setup wizard. Follow the on-screen instructions to complete the installation.

Conclusion

Congratulations! You've successfully installed Wiki.js using Docker Compose. You can now start to effortlessly create and organize your documentation or knowledge base. However, remember to perform regular backups of your data and to keep your software up to date for security reasons.

License

MIT

Copyright (c) 2021 netcup

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributor's Certificate of Origin

By making a contribution to this project, I certify that:

  1. The contribution was created in whole or in part by me and I have the right to submit it under the license indicated in the file; or

  2. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same license (unless I am permitted to submit under a different license), as indicated in the file; or

  3. The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

  4. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the license(s) involved.

Published 22/10/2023 by Patrick Meyhöfer

Submit your tutorial

Get 60€ netcup vouchers for every published tutorial.