Skip to content

InstallationServer

Max S edited this page Aug 5, 2015 · 2 revisions

Server Installation

Overview

After unpacking the archive with the latest version of Snipe server you will see the directories containing source code and various utilities. This article is designed to show you how to compile the server in uniserver mode using test project as an example, how to initialize the database and how to run the server.

Compiling the project

The test project is located in "examples/testProject/" directory. We can use it as an example of an actual project. The game server source code is located in "game/" directory, the cache server source code in "cache/" directory. The uniserver class is in the top-level directory of the project. You don't have to it that way but compiling the uniserver will require classes from both the slave and cache servers of the project.

haxe uniserver.hxml

This command will compile the project uniserver. Take a look inside the "uniserver.hxml" to check if the paths are right. If everything is fine, the "uniserver.n" file will be produced. Before running the server you will need to initialize the database.

Initializing database

Creating the database is done with internal Postgresql command "createdb". If your database user has sufficient permissions, you can create the database with this command:

createdb test

After the database is created you will need to populate it with core database tables and data. All SQL queries for that are located in "sql/" directory. There is also a bash script provided that will populate the database. It's name is "initdb.sh" and it accepts a single parameter - database name. Usage example:

initdb.sh test

After the database was populated everything is ready to run the server.

Running the server

Starting the server is done with this command:

neko unisever.n

The database has to be initialized and configuration files for all components should be in the same directory with the Neko script file. These are "cacheserver.cfg", "hserver.game.cfg" and "uniserver.cfg" files. By default, the cache server uses localhost port 2000 and the game server port 2010.

There are two Neko libraries that have to be in the path accessible by the Neko interpreter ("/usr/lib/neko" or same directory with the server are the safest choices). The first library is "threadname.ndll". This is a small library for giving custom names to threads visible in the Linux process list. The source code and the 64-bit Linux binary are included with the Snipe server package in "tools/threadname/" directory.

The second library is called "npostgres.ndll" and is a Postgresql database binding for Haxe/Neko. For simplicity, parts of it are distributed with Snipe server package and are located in "external-libs/postgres/" directory. The 64-bit Linux binary of the library is also located there.

After you start the server you will see a lot of log messages given by the server initialization. By default the log messages are both written to logfiles and printed to stdout. You can change this in the configuration files.

Clone this wiki locally