Wiki.js on DirectAdmin: A Smooth Setup Guide

      No Comments on Wiki.js on DirectAdmin: A Smooth Setup Guide

Wiki.js on DirectAdmin: A Smooth Setup Guide

Setting up Wiki.js on DirectAdmin (DA) is a straightforward process. Here’s a step-by-step guide to help you through it.

Requirements for Hosting

  • SSH Enabled: Ensure SSH access is enabled on your host.
  • Node.js Selector: Make sure you have a compatible version of Node.js installed.
  • Database: Any database from hosting provider (MySQL, PostgreSQL, or MariaDB).

Limitations

  • Backup/Sync: Due to restrictions on exec(), you won’t be able to use Git/SFTP for backup/sync.
  • System Info: Access to System Info is also restricted for the same reason.

Setup

  1. DNS and SSL: Configure DNS and SSL for your desired domain through DirectAdmin.
  2. Database Creation: Create a database and note down the username and password.
  3. SSH Access: Ensure you have SSH access for Node.js setup. Add your SSH public key to DirectAdmin.

Installation

Create a Node.js Application

  1. Navigate to DA Panel:

    • Version: Choose the latest version.
    • Application Mode: Set to production.
    • Application Root: /home/xxx/domains/{domain}/public_html
    • Startup File: server/index.js
    • Save the configuration.
  2. Enter the Virtual Environment:

    • You’ll be prompted with a command to enter the virtual environment. Run:
      source /home/xxx/nodevenv/domains/xxx/public_html/20/bin/activate && cd /home/xxx/domains/xxx/public_html

Configure Codebase and Config

  1. SSH into the Machine:

    • Navigate to public_html: cd public_html
    • Download and extract Wiki.js:
      wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz && tar zxvf wiki-js.tar.gz
    • Rename the config file: mv config.sample.yml config.yml
    • Edit the config file: nano config.yml
  2. Sample Configuration:

    #######################################################################
    # Wiki.js - CONFIGURATION                                             #
    #######################################################################
    # Full documentation + examples:
    # https://docs.requarks.io/install
    
    # ---------------------------------------------------------------------
    # Port the server should listen to
    # ---------------------------------------------------------------------
    
    port: 8080   # <----- should not matter
    
    # ---------------------------------------------------------------------
    # Database
    # ---------------------------------------------------------------------
    # Supported Database Engines:
    # - postgres = PostgreSQL 9.5 or later
    # - mysql = MySQL 8.0 or later (5.7.8 partially supported, refer to docs)
    # - mariadb = MariaDB 10.2.7 or later
    # - mssql = MS SQL Server 2012 or later
    # - sqlite = SQLite 3.9 or later
    
    db:
     type: mysql  # <------ according to your host. Most likely mysql
    
     # PostgreSQL / MySQL / MariaDB / MS SQL Server only:
     host: 127.0.0.1   # <-------- change according to your hosting provider
     port: 3306   # <--------- 5432 for Postgres
     user: dbuser # <------- change according to your DB setup
     pass: pass  # <------- change according to your DB setup
     db: db_name  # <------- change according to your DB setup
     ssl: false  # <------- change according to your DB setup
    
     # Optional - PostgreSQL / MySQL / MariaDB only:
     # -> Uncomment lines you need below and set auto to false
     # -> Full list of accepted options: https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options
     sslOptions:
       auto: true
       # rejectUnauthorized: false
       # ca: path/to/ca.crt
       # cert: path/to/cert.crt
       # key: path/to/key.pem
       # pfx: path/to/cert.pfx
       # passphrase: xyz123
    
     # Optional - PostgreSQL only:
     schema: public
    
     # SQLite only:
     storage: path/to/database.sqlite
    
    #######################################################################
    # ADVANCED OPTIONS                                                    #
    #######################################################################
    # Do not change unless you know what you are doing!
    
    # ---------------------------------------------------------------------
    # SSL/TLS Settings
    # ---------------------------------------------------------------------
    # Consider using a reverse proxy (e.g. nginx) if you require more
    # advanced options than those provided below.
    
    ssl:
     enabled: false # <------- DO NOT CHANGE THIS for SSL: Let your host handle it in panel
     port: 3443
    
     # Provider to use, possible values: custom, letsencrypt
     provider: custom
    
     # ++++++ For custom only ++++++
     # Certificate format, either 'pem' or 'pfx':
     format: pem
     # Using PEM format:
     key: path/to/key.pem
     cert: path/to/cert.pem
     # Using PFX format:
     pfx: path/to/cert.pfx
     # Passphrase when using encrypted PEM / PFX keys (default: null):
     passphrase: null
     # Diffie Hellman parameters, with key length being greater or equal
     # to 1024 bits (default: null):
     dhparam: null
    
     # ++++++ For letsencrypt only ++++++
     domain: wiki.yourdomain.com
     subscriberEmail: admin@example.com
    
    # ---------------------------------------------------------------------
    # Database Pool Options
    # ---------------------------------------------------------------------
    # Refer to https://github.com/vincit/tarn.js for all possible options
    
    pool:
     # min: 2
     # max: 10
    
    # ---------------------------------------------------------------------
    # IP address the server should listen to
    # ---------------------------------------------------------------------
    # Leave 0.0.0.0 for all interfaces
    
    bindIP: 0.0.0.0
    
    # ---------------------------------------------------------------------
    # Log Level
    # ---------------------------------------------------------------------
    # Possible values: error, warn, info (default), verbose, debug, silly
    
    logLevel: info
    
    # ---------------------------------------------------------------------
    # Log Format
    # ---------------------------------------------------------------------
    # Output format for logging, possible values: default, json
    
    logFormat: default
    
    # ---------------------------------------------------------------------
    # Offline Mode
    # ---------------------------------------------------------------------
    # If your server cannot access the internet. Set to true and manually
    # download the offline files for sideloading.
    
    offline: false
    
    # ---------------------------------------------------------------------
    # High-Availability
    # ---------------------------------------------------------------------
    # Set to true if you have multiple concurrent instances running off the
    # same DB (e.g. Kubernetes pods / load balanced instances). Leave false
    # otherwise. You MUST be using PostgreSQL to use this feature.
    
    ha: false
    
    # ---------------------------------------------------------------------
    # Data Path
    # ---------------------------------------------------------------------
    # Writeable data path used for cache and temporary user uploads.
    dataPath: ./data
    
    # ---------------------------------------------------------------------
    # Body Parser Limit
    # ---------------------------------------------------------------------
    # Maximum size of API requests body that can be parsed. Does not affect
    # file uploads.
    
    bodyParserLimit: 5mb
  3. Save the File: After editing, save the file.

  4. Test the Installation: Visit your URL to complete the installation. If you encounter any issues, run node server/index.js and observe the output.

Further Configurations After Installation

Email

  • Create an Email User: Set up an email user in the DirectAdmin panel to enable email functionality.

Upload Size

  • Edit Body Size: Adjust the body size in the DirectAdmin panel before updating settings in Wiki.js.

Backup

  • Use Host Backup: Prefer your host’s backup solution over Wiki.js’s built-in backup.

Search Engine

  • Algolia: Register for Algolia, which offers a high free usage limit. Use the write API key to allow Wiki.js to update the remote index with new content.

Comments

  • Akismet API Key: Don’t forget to add an Akismet API key for anti-spamming.

By following these steps, you should have a smooth setup of Wiki.js on DirectAdmin. Enjoy your new wiki!

Leave a Reply

Your email address will not be published. Required fields are marked *