Wiki.js not running as a Windows Service

1.4k Views Asked by At

Windows Server 2019 Standard (1809) Installed Wiki.js with PostgreSQL. Works great when starting the server manually

node server

Installed node-windows and registered to run Wiki.js as a service. The service fails to start. wiki.out.log in the daemon folder shows the following:

2020-09-03T21:32:20.503Z [MASTER] [32minfo[39m: =======================================
2020-09-03T21:32:20.503Z [MASTER] [32minfo[39m: = Wiki.js 2.4.107 =====================
2020-09-03T21:32:20.503Z [MASTER] [32minfo[39m: =======================================
2020-09-03T21:32:20.503Z [MASTER] [32minfo[39m: Initializing...
2020-09-03T21:32:21.159Z [MASTER] [32minfo[39m: Using database driver pg for postgres [ OK ]
2020-09-03T21:32:21.159Z [MASTER] [32minfo[39m: Connecting to database...
2020-09-03T21:32:21.222Z [MASTER] [32minfo[39m: Database Connection Successful [ OK ]
2020-09-03T21:32:21.253Z [MASTER] [31merror[39m: Database Initialization Error: no database connection available for a query. You need to bind the model class or the query to a knex instance.

Tried exactly the same on non-server Windows 10 machine and it works as expected. Any ideas on what can be the reason of it not working on the server?

1

There are 1 best solutions below

0
On

Have you created a Postgres database to be used by wiki.js ? Although you may have postgres installed perfectly, The database which wiki.js is trying to connect to may not have been initialised from your end.

If that's the case, Please open the following file inside a text editor: /wiki/config.yml

You may find the following lines:

# ---------------------------------------------------------------------
# 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: postgres

  # PostgreSQL / MySQL / MariaDB / MS SQL Server only:
  host: localhost
  port: 5432
  user: wikijs
  pass: wikijsrocks
  db: wiki
  ssl: false

Depending on the database you're using, make changes (if required) to the above lines namely field host,port,user,pass,db.

now, create a database with the exact same config that you have defined in the file above

then try running node server and once initialised, try accessing the URL localhost:3000 in your browser to check if the wiki.js is running