Skip to content

Setting Up a Development Server

shnibble edited this page Nov 24, 2014 · 4 revisions

At a certain point you may find yourself wanting to test out new patches being worked on by developers. This is a necessary contribution to the project as it takes a lot of time and effort to effectively test fixes and new mechanisms to iron out any bugs or issues they may have before deploying to the master repositories.

The most effective way to test patches is to set up a separate "development" server where you can make modifications and rebuild the source code at will without worrying about interrupting gameplay and losing player data (as you risk doing by testing on a live server).

Here is a quick breakdown of the topics covered in the following steps:

  • Configure multiple servers.
  • Setup a test environment.
  • Configure Git for your test environment.
  • Pull in updates from github to test.
  • Test updates and provide feedback.

Multiple Servers

To have a proper test environment you need a "development" server. And to have a proper player-friendly environment you need a "live" server.

Development Server: is updated frequently with untested code. Players should not expect their characters to be saved (hence why most test servers start their players at max level with decent gear). Backups are not necessary.

Live Server: is updated infrequently with stable, tested code. Players do not have to worry about losing their characters or items. Databases are backed up regularly.

To accommodate running multiple servers from one machine, you will need to have doubles of almost everything: databases, binaries, resource files, etc. You will also need to configure each server to connect to the proper databases to keep the two seperate from each other. If you've built a server then you have done the majority of the work already; now you just have to build a second one!

Compile & Organize Both Servers

So let's say that you are going to build two classic servers, one for development and another for live. You already have a classic core built and running so let's make that one your "live" server. First let's talk about directory structure: how your server files are organized. Say you followed the installation instructions exactly and so your existing server is located at C:/mangos/run. Since you are building two classic servers, let's create the two following folder setups:

C:/mangos/classic/live/run
C:/mangos/classic/development/run

So instead of cloning the github repositories directly to "C:/mangos" you would clone the live server files to "C:/mangos/classic/live" and the development server files to "C:/mangos/classic/development." Go ahead and build your second server now to use for development and place it into the applicable run folder. Then move your existing server files over to their applicable run folder. To save time you can just copy the resource files (DBC, maps, mmaps, and vmaps) from your current run folder instead of extracting them over again (as long as your live and development servers are using the same core version).

By now you should have two identical "run" folders. This is everything you need to do for compiling code, now we just have to get the databases set up correctly and make sure they are pointing to the correct server.

Duplicate Databases

When you follow the installation instructions scripts to install the databases you will see that they are designed for a blank slate; so running them again as they are will cause issues. There are a few ways to get around this, and the most simple method is to just copy your existing databases into new ones with different names. In this guide we will copy the below existing databases into their counterparts as follows:
characters -> characters-dev
mangos -> mangos-dev
scriptdev2 -> scriptdev2-dev

  • Before proceeding, make sure that your current databases are completely updated and stable (no customizations or alterations).
  • You may have noticed that the realmd database is not mentioned: this database houses account information and we are going to keep that universal. That way players can use the same credentials to login to the development server as the live server.
  • The below commands will be executed in a "Git Bash" window just as the commands in the Installation Instructions were.

1.) Open a Git Bash window anywhere in your directory (the below was just opened in C:/). 2.) Enter the following command and input your MySQL root password when prompted:
mysql -uroot -p

3.) Use the "create database" command to add the three "dev" databases:

create database `characters-dev`;  
create database `mangos-dev`;  
create database `scriptdev2-dev`;  

Your result should look like this:

4.) Execute the following commands (in order) to "dump" the data from each database into a .sql file and then import each one into their new databases:

mysqldump -uroot -p mangos > mangos_dump.sql
mysqldump -uroot -p characters > characters_dump.sql
mysqldump -uroot -p scriptdev2 > scriptdev2_dump.sql

Your result should look like this:

mysql -uroot -p mangos-dev < mangos_dump.sql
mysql -uroot -p characters-dev < characters_dump.sql
mysql -uroot -p scriptdev2-dev < scriptdev2_dump.sql

And the final result should look like this:

Test Environment

Configuring Git

Pulling Updates

Testing & Feedback