// TinyPoker.org // Copyright (C) 2007, 2008, 2009, 2010 Thomas Cort // // Permission is granted to copy, distribute and/or modify this document // under the terms of the GNU Free Documentation License, Version 1.3 or // any later version published by the Free Software Foundation; with no // Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A // copy of the license is included in the section entitled "GNU Free // Documentation License". Server Setup ============ This document explains how to build, configure, and run the TinyPoker server, *tinypokerd*. Install the Dependencies ------------------------ TinyPoker makes use of several software libraries. Each one must be installed before building and running *tinypokerd*. A complete list can be found on the link:download.html[download] page. Obtain the Source Code ---------------------- The next step is to get a copy of the *libtinypoker* and *tinypokerd* source code. This can be done by checking out a fresh copy from the http://subversion.tigris.org/[subversion] link:subversion.html[repository] or by link:download.html[downloading] the latest release. Build and Install libtinypoker ------------------------------ .Configure, make, test, and install -------------------------------------- $ cmake -D CMAKE_INSTALL_PREFIX=/usr . $ make $ make test # make install -------------------------------------- Build and Install tinypokerd ---------------------------- .Configure, make, and install -------------------------------------- $ cmake -D CMAKE_INSTALL_PREFIX=/usr . $ make # make install -------------------------------------- Add a tinypokerd User and Group ------------------------------- *tinypokerd* needs root privileges to do some setup when it first starts up, and as soon as it's done, *tinypokerd* drops root privileges. A user must exist for *tinypokerd* to run as after it drops root privileges. In the example below we create that user and set the shell to 'nologin'. ------------------------------------------ # useradd tinypokerd # chsh tinypokerd Login Shell [/bin/sh]: /bin/nologin ------------------------------------------ You can pick a different username and group if you wish. Both are configurable via 'tinypokerd.conf'. Create a directory for configuration Data ----------------------------------------- The configuration file is stored in '/etc/tinypokerd' by default. You can use an alternate location by invoking *tinypokerd* with a command line argument (see the bottom of this document for details). ------------------------------------------ # mkdir /etc/tinypokerd # chown tinypokerd:tinypokerd /etc/tinypokerd # chmod 700 /etc/tinypokerd ------------------------------------------ Create a directory for protocol Logs (Optional) ----------------------------------------------- The server provides the option to log all protocol messages sent and received. This could be useful for statistics or research. The feature is disabled by default since it eats up disk space and may make the server slightly slower. It can be enabled via 'tinypokerd.conf'. If enabled, a directory is needed to store the log. ------------------------------------------ # mkdir /var/log/tinypokerd # chown tinypokerd:tinypokerd /var/log/tinypokerd # chmod 700 /var/log/tinypokerd ------------------------------------------ Note, regular log messages generally will not show up in this directory. They are sent directly to syslog. Create a run Directory ---------------------- *tinypokerd* creates a PID file when it starts up. The PID file keeps track of the running instance of *tinypokerd*. It can be used to tell if the daemon is running or not as well as stopping a running daemon. In the example below we create the directory and give the 'tinypokerd' user permission to it. ------------------------------------------ # mkdir /var/run/tinypokerd/ # chown tinypokerd:tinypokerd /var/run/tinypokerd/ ------------------------------------------ Configuration File ------------------ The *tinypokerd* configuration file provides the server with operating parameters. The defaults should work fine in most use cases. Below is a list of every possible configuration option. List of Configuration Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [frame="all", grid="all"] `--------------------`---------------`---------------------------------------------------`----------------------------------- *key* *value* *description* *default* setuid username Name of the user to run as tinypokerd setgid groupname Name of the group to run as tinypokerd protocol_log_enabled true/false Switch protocol logging on or off false protocol_log_file /path/to/file Log file containing protocol messages /var/log/tinypokerd/protocol.log game_type 1-3 Specify the type of game (holdem, draw or stud). 1 ----------------------------------------------------------------------------------------------------------------------------- Example Configuration File ~~~~~~~~~~~~~~~~~~~~~~~~~~ ./etc/tinypokerd/tinypokerd.conf -------------------------------------- # This is a comment setuid = tinypokerd setgid = tinypokerd protocol_log_enabled = true protocol_log_file = /var/log/tinypokerd/protocol.log # Texas Hold'em game_type = 1 -------------------------------------- Run tinypokerd -------------- List of Command Line Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [frame="all", grid="all"] `--------------`---------------`---------------`--------------------------- *short option* *long option* *argument* *description* -h --help no Show a help message -v --version no Show version information -k --kill no Kill the running instance -f --foreground no Run in the foreground -c [file] --config=file '/path/to/file' Use an alternate config --------------------------------------------------------------------------- Example Commands ~~~~~~~~~~~~~~~~ .Start the Tiny Poker Daemon -------------------------------------- # /usr/sbin/tinypokerd -------------------------------------- .Stop a running Tiny Poker Daemon -------------------------------------- # /usr/sbin/tinypokerd --kill -------------------------------------- .Run in the Foreground (i.e. do not daemonize) -------------------------------------- # /usr/sbin/tinypokerd --foreground --------------------------------------