Configuring Ryzom API

Configuring the Ryzom API

You will need to configure the Ryzom API before you configure the Ryzom App, as the App is dependent upon the API.

Configuring the Web Server

First you will need to create a new virtual host for the web server. It is important to note that the Ryzom API and App make the assumption that you will have a fully qualified sub-domain associated with each of them. It is not tested on a local installation at this point.

First create your new vitrual host configuration in Apache.

Example Ryzom API Site
######################
# Ryzom API Site #
######################
<VirtualHost *:80>
<Directory "/home/username/ryzom/code/web/">
Options -Indexes FollowSymLinks MultiViews
IndexOptions FancyIndexing FoldersFirst NameWidth=*
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerAdmin admin@localhost
 
  DocumentRoot /home/username/ryzom/code/web/api
  ServerName api.domain.org
</VirtualHost>

Configuring the API

Next you will need to copy the default configuration files for use:

cd $RYZOM_PATH/../web/api
cp ./server/config.php.default ./server/config.php
cp ./client/config.php.default ./client/config.php
cp ./common/config.php.default ./common/config.php

Modify the Server Config

You will need to modify the following variables in the server/config.php file:

  • RYAPI_SHARDID - this should be set to your shard ID - the default is 301.
  • RYAPI_NELDB_PASS - set this to blank if you're using the default shard privilege script.
  • RYZOM_WEBDB_LOGIN - set this to webdb or if you're an advanced user set it to a user of your choice.
  • RYZOM_WEBDB_PASS - set this to blank or if you're an advanced user set it to a password of your choice.

You will need to modify the following code in the common/config.php file so that the URL matches where your API and App will be hosted:

# Make sure you change this from client to server
define('RYAPI_MODE', 'server');
 
// Url where the api is
define('RYAPI_URL', 'http://api.domain.org/');
/* ... skip some code ... */
// used by "home" link
if (!defined('RYAPP_URL'))
        define('RYAPP_URL', 'http://app.domain.org/');

We still need documentation regarding:

  • RYAPI_COOKIE_KEY
  • RYAPI_EGS_SALT

 

Configuring the Ryzom App

Configuring the Web Server

First you will need to create a new virtual host for the web server. It is important to note that the Ryzom API and App make the assumption that you will have a fully qualified sub-domain associated with each of them. It is not tested on a local installation at this point.

First create your new vitrual host configuration in Apache.

Example Ryzom API Site
######################
# Ryzom App Site #
######################
<VirtualHost *:80>
<Directory "/home/username/ryzom/code/web/">
Options -Indexes FollowSymLinks MultiViews
IndexOptions FancyIndexing FoldersFirst NameWidth=*
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerAdmin admin@localhost
 
  DocumentRoot /home/username/ryzom/code/web/app
 
  # The client hard codes /start/ into the WebIG launch URL.
  Alias /start/ /home/username/ryzom/code/web/app/
 
  ServerName app.domain.org
</VirtualHost>

Configuring the App

Next you will need to copy the default configuration file for use:

cd $RYZOM_PATH/../web/app
cp ./config.php.default ./config.php

Once copied you will want to edit it and define the RYAPP_URL variable.

define('RYAPP_URL', 'http://app.domain.org/');

 

Build the Database

You will need to execute two scripts to build the basic API database and the test application database. 

mysql -u root -p < $RYZOM_PATH/../web/create_webig.sql
mysql -u root -p < $RYZOM_PATH/../web/app/app_test/create.sql

Next execute the following to grant the webdb user access, using the values you set earlier in the setup. First open MySQL up and then execute the following:

GRANT ALL ON webig.* TO webdb@localhost;
GRANT ALL ON app_test.* TO webdb@localhost;

Client Configuration

For the client you will need to add or change the following configuration variables:

WebIgMainDomain = "app.domain.org";
// The list of domains the client will trust and execute Lua scripts from.
WebIgTrustedDomains = { "app.domain.org", "api.domain.org", "shard.domain.org" };

 

Troubleshooting

Table players not found

Problem: If you receive the following error:

PHP Notice:  Use of undefined constant RYAPI_WEBDB_PASS - assumed 'RYAPI_WEBDB_PASS' in /home/username/ryzomcore/web/api/common/db_lib.php on line 136

Solution: You need to ensure that the RYAPI_MODE is set to server. The client mode is intended for remote third-party API use.

Broken images at login screen

Problem: When you go to the login screen you see the input boxes with a black background but no images.

Solution: In your api/common/config.php and your app/config.php ensure that the URL fields have a trailing slash, e.g. http://api.domain.org/