Installing and Running Wiki.js on the Raspberry Pi?

Hackbs

How to Install and Run Wiki.js on the Raspberry Pi?

Key Takeaways

  • Wiki.js offers a feature-rich private wiki platform using modern technologies
  • Raspberry Pi devices provide an affordable hosting environment for self-hosted web apps
  • Optimization techniques like database tuning, caching and adding a reverse proxy can improve performance
  • Carefully assess plugins to prevent overloading the limited client hardware
  • Overall, Wiki.js + Raspberry Pi make an easy-to-manage, low cost private wiki solution

Wiki.js is an open source wiki software that allows you to run your own private wiki on a server or device. The Raspberry Pi is a small, affordable device that can serve as a perfect platform for hosting Wiki.js. This guide will walk through installing and optimizing Wiki.js on a Raspberry Pi.

What is Wiki.js?

Wiki.js is an modern, lightweight wiki app built on Node.js. Some of the key features include:

  • Open source – Wiki.js is released under the AGPLv3 license and the source code is hosted on GitHub. This allows anyone to freely install, use and even modify Wiki.js to suit their needs.
  • Responsive design – The frontend UI is optimized for both desktop and mobile access. It adapts seamlessly on different devices.
  • Markdown support – Pages can be written using Markdown which allows for easier formatting.
  • Access control – Granular user permissions can be configured to limit access to pages and actions.
  • Revision history – Every change is tracked in the revision history allowing you to revert when needed.
  • ** Plugin extensions** – Plugins extend the core functionality with added features like charts, maps, data tables etc.

Overall, Wiki.js aims to provide an intuitive wiki platform that is easy to use and customizable. The open source nature makes it a compelling option for self-hosted wikis.

Why Run Wiki.js on a Raspberry Pi?

The Raspberry Pi is a tiny, affordable single-board computer developed by the Raspberry Pi Foundation. Some of the benefits of running Wiki.js on a Raspberry Pi include:

  • Low cost – Raspberry Pi devices start at just $35 which makes it very affordable.
  • Energy efficient – Consumes less than 10W power which saves on electricity costs.
  • Compact size – Fits in your palm which allows placing it anywhere. No noisy fans needed.
  • Always on – It can run 24/7 without needing reboots making it reliable for hosting services.
  • Customizable – As it runs Linux, you have full control to customize both hardware and software.

These capabilities make the Raspberry Pi an ideal platform for self-hosting a Wiki.js server accessible from your home network. It does not need complex infrastructure yet provides a capable web hosting environment.

Installation Guide

Follow this straight-forward guide to get Wiki.js installed on a Raspberry Pi.

Prerequisites

Before installing, make sure you have the following:

  • A Raspberry Pi device with Raspbian OS installed. Any model from Pi 2 and above should work.
  • The device is connected to the internet to allow installing packages
  • Git is installed to clone the Wiki.js repository
  • You have SSH access to connect to the Pi remotely

Download Wiki.js Files

  1. SSH into the Raspberry Pi
  2. Change directory to /var
cd /var

Clone the Wiki.js Git repository

sudo git clone https://github.com/Requarks/wiki.git wiki

Change owner to pi user

sudo chown -R pi:pi wiki

This will download all the necessary Wiki.js files into the wiki folder.

Install Dependencies

Wiki.js needs Node.js as the runtime for the application. We’ll install that plus MongoDB to manage the data.

Update apt packages

sudo apt update

Install Node.js

sudo apt install nodejs npm

Install MongoDB

sudo apt install mongodb

Start MongoDB service

sudo systemctl start mongodb

Enable it to start on reboot

sudo systemctl enable mongodb

Configure Wiki.js

Before starting Wiki.js, we need to configure a few parameters.

Install wiki dependencies

cd /var/wiki 

 sudo npm install

cp /var/wiki/config.example.yml /var/wiki/config.yml

Edit config.yml to customize parameters like ports, SSL usage etc.

Create data folders with write access

sudo mkdir data

 sudo chmod 777 data

This completes the configuration steps.

Run Wiki.js

We are now ready to start the Wiki.js server.

  1. Run Wiki.js in production mode
  2. NODE_ENV=production node server
  3. Access the web interface at http://<raspberrypi_ip>:3000. Follow the setup wizard.
  4. Celebrate your brand new homegrown Raspberry Pi wiki!

In case you face any errors, check the troubleshooting guide which covers common issues.

This covers the basics of getting started. Refer to the admin guide to further customize permissions, plug-ins, backups and more.

Optimizing the Wiki

Here are some tips to optimize your Wiki.js experience on the Raspberry Pi for better performance.

Tuning the Database

MongoDB requires some tuning to match the Raspberry Pi’s modest hardware. Here are some tweaks to try out:

  • Use a (non expanding) 2GB file instead of larger data files
  • Change the storage engine to RocksDB for efficient reads
  • Limit journaling overhead with small commit interval
  • Reduce data syncing overhead

Make these changes by editing /etc/mongod.conf and restarting the service. Refer the MongoDB Pi tuning guide for details.

Enabling Caching

Enabling caching mechanisms like Redis can speed up page loads significantly. Steps to configure:

  1. Install Redis
  2. sudo apt install redis-server
  3. Enable Redis in Wiki.js config
  4. Set cache expiry duration through config variables

Adding a Reverse Proxy

A reverse proxy server like Nginx can also help with performance. It handles requests more efficiently by caching assets and handling compression better. Typical improvements are:

  • 30-50% better response times
  • 40% reduction in CPU usage
  • 50-70% bandwidth savings

Setting this up takes a few configuration tweaks but worth investing. This blog covers the concept well.

Choosing Lean Plugins

Wiki.js provides many plugin extensions. Carefully evaluate each plugin to understand performance impact before installing:

  • Favor plugins that use client-side rendering over server-side
  • Check data source queries being used on page loads
  • Monitor overall memory usage with plugins enabled

Avoid plugins that tax the modest Raspberry Pi hardware. It takes some trial-and-error but pays off with snappier response.

Conclusion

The Raspberry Pi makes for a capable platform to self-host useful web applications and services. Wiki.js allows you to reap the benefits of running your own wiki without needing complex infrastructure. Together they enable an affordable, customizable private wiki solely on your home network.

With some smart optimizations to tune performance, the experience gets even smoother. While not for very high traffic wikis, for personal and small scale usage, this combination works great. The open source nature fosters constant improvements through an active developer community.

So empower your inner tinkerer to build your tailored applications on the tiny Raspberry Pi device! Wiki.js is one such excellent option for setting up your personal reference wiki full of your knowledge and documentation.

Frequently Asked Questions

  1. What Raspberry Pi models are compatible?
    Any Pi from the Pi 2 and above has enough resources to run Wiki.js smoothly. Avoid very old models.
  2. Can I access my wiki outside home?
    Yes, by enabling port forwarding on your router. But not advisable for security reasons.
  3. How do I manage authentication?
    Register users manually or integrate LDAP, OAuth and SAML providers. Manage groups and permissions levels.
  4. Is my wiki content portable to move?
    The backend database makes it easy to migrate data between instances.
  5. What plugins are resource friendly?
    Charts.js, MiniMap, and Paginated Tables are some good options. Avoid heavy server-side rendering plugins.
  6. Why is my wiki slow to load pages?
    Enable Redis caching and a reverse proxy server to significantly boost performance.
  7. How do I backup my Wiki data?
    Use built-in backup functionality or setup periodic MongoDB backups stored outside.
  8. Can I access Wiki.js through an app?
    Check out Wiki.js Wrappers available for Android, iOS and desktop platforms.
  9. Is there an offline mode available?
    Yes, web clipper apps like Hypothesis can save pages locally for offline access.
  10. How can I customize the interface?
    Modify CSS variables exposed by Wiki.js to change colors, spacing, etc without forking code.
  11. What measures prevent spam?
    CAPTCHAs, rate limiting, mandatory confirmation by admins help manage spam.
  12. How do I migrate away from Wiki.js?
    Export all pages to Markdown plain text files retaining your information.
  13. Is my usage data tracked?
    No tracking or analytics involved. Fully private as its self-hosted.
  14. Can non-technical people use this?
    Yes, the editor has an easy WYSIWYG interface requiring no Markdown expertise.
  15. What’s needed for high traffic scenarios?
    For large user bases, upgrade Pi hardware or port to a VPS with higher resources.
  16. How do I solve error “permission denied”?
    Fix folder permissions ensuring wiki user has access to data paths.
  17. Why am I facing a blank page?
    Check server logs for clues. Likely causes – db connection issues, resource constraints.
  18. What’s the recommended OS for Pi?
    Raspbian or Ubuntu Server has the best compatibility. Avoid Raspberry Pi OS Lite.
  19. How do I manage multiple wikis?
    Setup different MongoDB databases and Wiki.js instances or use multi-tenant plugin.
  20. Can I import my existing wiki data?
    Yes, use the importer plugin to bulk upload docs in Markdown format.

     


Leave a Comment