How to Deploy Wiki.js on Web Hosting

This tutorial will show you how to deploy wiki.js on a Node.js Web Hosting web hosting.

What is Wiki.js ?

Wiki.js is an open source Wiki-like CMS written in javascript running with nodeJs.

You can find more information on their official website and in their documentation.

Prerequisites

You will need the following to complete this tutorial.

  • A web hosting using Node.js and PostgreSQL

  • A domain name where you will host your web hosting

  • A command-line terminal with git and ssh installed

  • The wiki.js source files

Create a NodeJS / PostgreSQL Web Hosting

First, create a web hosting that uses NodeJS and PostgreSQL.

  1. After logging in, click “Web Hosting” in the left navigation menu.

  2. Click “Create”.

  3. Choose “Custom Language & DB” for the top option.

  4. Under “Language”, choose “Node.js”.

  5. Under “Database”, choose “PostgreSQL”.

  6. The rest of the options can be anything you choose.

  7. At the bottom of the screen, click “Add to Shopping Cart” the complete the checkout process.

You can find a more detailed description of how to create a web hosting on our page How to Create a New Gandi Web Hosting.

Create a Website on Your Web Hosting

This mandatory step will set up the web server and the reverse proxy.

  1. Go to your Web Hosting menu.

  2. Click on the name of the web hosting you plan to use. This would be the web hosting you created in the previous step, or one you already created with the necessary configuration.

  3. Click on the “Sites” tab then click on “Start” or “Create a Site”.

  4. Write the URL of the website you want to create. For example, you could use something like “wiki.mydomain.com”.

Attention

Be sure to write this address correctly, a typo will make your site unreachable

You can find a more detailed description of how to create a web hosting on our page How to Link Your Domain to Your Web Hosting.

Create a Database

Next you will create a database on your site.

Open the phpPgAdmin interface by following these steps:

  1. Go to your Web Hosting menu.

  2. Click on the name of the web hosting you plan to use then click on the “Adiminstration” tab.

  3. Click “Go to phpPgAdmin” near the bottom of the page.

  4. Enter the username and password for the web hosting.

The phpPgAdmin interface URL will follow the pattern https://xxxx.admin.yy.gpaas.net, where xxxx is your hosting user and yy its location.

After entering the phpPgAdmin interface, click on “PostgreSQL” on the left panel. When prompted, use the username hosting-db and leave the password space blank. These are the default root username and database password values used when creating a web hosting. If you have changed your root username or database password you can find it in the “Administration” tab of your web hosting.

Next, create a new user.

  1. Click on the “Roles” tab, then click “Create role”.

  2. Write the username, and the wanted password.

  3. Check the option “can login?”, then click on the “Create” button below.

Now, create a new database.

  1. Click on the “Databases” tab, then click “Create database”.

  2. Give your database a name, leaving the other options empty, then click “Create”.

  3. Find your new database and click the corresponding “Privileges” button.

  4. Click “Grant”.

  5. Select your user in the top menu, then check “ALL PRIVILEGES” in the “Privileges” section.

  6. Click “Grant” at the bottom of the form.

Retrieve the WikiJS Source Files

Firt connect to your SSH console.

Then, enter the following commands.

$ cd /srv/data/web/vhosts/default
$ wget wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz
$ tar xvf wiki-js.tar.gz
$ rm wiki-js.tar.gz
$ mv config.sample.yml config.yml

The commands will do the following:

  • Go to your website default folder.

  • Download the lastest release of wiki.js.

  • Extract the archive

  • Rename the sample configuration file from config.sample.yml to config.yml.

Adapt your Configuration File

Next, open the config.yml file, and change the following lines. Replace “USER”, “PASSWORD”, and “DATABASE” with the username, password, and database you just created.

# ---------------------------------------------------------------------
# Port the server should listen to
# ---------------------------------------------------------------------

port: 8080

# ---------------------------------------------------------------------
# Database
# ---------------------------------------------------------------------

db:
 type: postgres

 # PostgreSQL / MySQL / MariaDB / MS SQL Server only:
 host: localhost
 port: 5432
 user: USER
 pass: PASSWORD
 db: DATABASE
 ssl: false

Then, save your changes.

Finalize the Install

Restart Node:

Open the control panel for your web hosting. The link to your control panel can be found on the “Administration” tab of your web hosting.

In the “Node.js” section, click “Reload application”.

Run the Web Installer :

Open your website in a browser and follow the installation process, filling in the information asked for.

Note

If the page displays a 500 error, relaunch node from your admin panel again, as described in the previous step, then connect again to your website’s URL.

Congratulations, your brand new wiki is online! You can find instructions on where to go from here in the official Wiki.js documentation.

Update your Version

When it’s time to upgrade your Wiki.js to the next version, you can start by connecting to your :ref:`SSH console <emergency_console>`_.

Next, use the following commands. Make sure to replace “MYSITE” with the name of your site.

cd /srv/data/web/vhosts/MYSITE/default
cp config.yml ~/config.yml.back
wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz
tar xvf wiki-js.tar.gz
rm wiki-js.tar.gz
cp ~/config.yml.back config.yml

These commands will do the following:

  • Go to your website root folder.

  • Save your config file.

  • Retrieve the latest version of wiki.js.

  • Extract the files.

  • Restore your config file.