Installation

From RPGWNN
Jump to: navigation, search

Pre-requisites

A working installation of Perl, including the CPAN module.

MySQL (or another database supported by Dancer)

Perl modules

RPGWNN requires a few Perl modules to be installed in addition to the core modules that come with any modern Perl installation.

We've tried to keep it to a minimum by using the Dancer micro web application framework which itself has very few requirements. Unfortunately as more features were added, the list of dependencies became rather longer than hoped for.

PSGI is an interface between Perl web applications and web servers, and Plack is a Perl module and toolkit that contains PSGI middleware, helpers and adapters to web servers.

Information about Dancer can be found at perldancer.org

Information about Plack can be found at plackperl.org

Automatic installation of prerequisites

The "quick" method is to install the RPGWNN Bundle found in this distribution. The only downside is that it may unneccessarily upgrade modules that you may already have installed on your system.

$ cd lib && perl -MCPAN -e 'install Bundle::RPGWNN'

Manual installation

If you don't want to do the automated method, you can install the key modules manually. Specifically, these modules should provide any dependencies that are also required.

  • Dancer
  • Plack
  • Template (Template Toolkit)
  • YAML::Any (replacement for YAML)

Installation of these modules and their dependencies can be done (assuming you have CPAN installed) using the following command.

$ perl -MCPAN -e 'install Plack; install Dancer; install Template; install YAML::Any;'

Source installation

Clone the master repository from Github

$ git clone https://github.com/rpgwnn/framework.git 

Then change into the framework directory for the later commands.

$ cd framework

Database

As a MySQL administrator account, you need to create a database and grant permissions to the user.

By default, we use the database name "rpg_db", with a username of "rpg_user" and password of "rpg_pass" If you wish to change these defaults (and you should probably change at least the password) simply replace them in the instructions below.

mysql> CREATE DATABASE rpg_db;
mysql> GRANT ALL ON rpg_db.* TO 'rpg_user'@'localhost' IDENTIFIED BY 'rpg_pass';

If all is well, you should be able to run the following command at a shell prompt and connect to the database.

$ mysql -urpg_user -prpg_pass rpg_db

If you change the database details, also ensure that config.yml is updated with the new information.

Next, run the database schema deployment script to create the table structure.

******* WARNING *** WARNING *** WARNING *** WARNING *** WARNING ********

This step WILL destroy any tables that have already been created.

$ perl scripts/deploy_db_schema.pl

Next we need to create the basic map - due to database foreign key constraints, you can only create a new character if there is a map tile for them to start in (which makes sense really if you think about it).

$ perl scripts/create_map.pl 

Running it

If everything above has completed successfully, you should be able to run the following command

$ plackup -p 8003 bin/app.pl

and then access http://localhost:8003/ - from there, you can create an account, create a character and start playing as that character.