Volume 2 Server Setup

From OuroDev
Revision as of 20:26, 2 July 2019 by Red Nile (talk | contribs) (Added troubleshooting for the mapserver.exe -productionmode -templates command.)

Required software

Download all of the following files:

  1. SQL Server 2017 Express Edition
  2. SQL Server Management(SSMS) 2017
  3. The latest stable release of the CoX/Source files from http://build.ourodev.com/archives/Source.master.7z. These are the compiled files from the OuroDev build machine. Extract the contents of the zip file into C:\Ouroboros. (or if you want to compile the source files yourself, follow the Volume 2 Build instructions, then copy the contents of the Source\bin directory to C:\Ouroboros)
  4. Database schema definitions. For now, get them from https://git.ourodev.com/CoX/Source/src/tag/v2-i1.0.0/Assets/DBSchemas
  5. Sample server config files. For now, get them from https://git.ourodev.com/CoX/Source/src/tag/v2-i1.0.0/Assets/ConfigFiles
  6. the Issue 24 client and data files - this is not the SCORE client/data.
  7. CoHDev_Source_Files_Current(Updated).zip.
  8. ServerData.7z.

Install SQL Server 2017 Express

You can install SQL Server pretty much on the default settings.
Select Basic under installation type:
Agree to the EULA if you want to use SQL Server.
Tell the server where to install files. I changed this for ease on my system.
It should begin installing and eventually you should see "Install has completed successfully". Click close.

Install SQL Server Management(SSMS)

You can install SQL Server Management on default settings.
Select the location you'd like to install SSMS to. The default is fine.
It will take awhile to install and you'll see a little progress bar letting you know whats going on
Eventually it will ask you to reboot the system. Might as well as do that now.

Setup server files

  1. At this point, you should have c:\Ouroboros containing exes and dlls
  2. Create a directory in C:\Ouroboros called data.
  3. Open ServerData.7z and extract all files into C:\Ouroboros\data (the newly created directory).
  4. Open CoHDev_Source_Files_Current(Updated).zip.
    1. Extract "i24 Server and Client Piggs (extracted with CoHTools)" into C:\Ouroboros\data.
    2. Copy maps.db from "map.db (modified, working on current VS2010 build)" and place it in C:\Ouroboros\data\server\db, overwriting the old maps.db
  5. Copy the piggs folder from your i24 client directory and place them in C:\Ouroboros\. You should end up with C:\Ouroboros\piggs\ populated.
  6. If installing v2i1, create a directory in your C: drive called "CoH_Data" and another directory inside that, called "attributes" (C:\CoH_Data\attributes). In later versions, this isn't necessary.
  7. Run the following in a command prompt. If it gives you an error message, check the Troubleshooting section. It is essential to run this after all the above steps, because it will overwrite some of the files.
    cd c:\Ouroboros
    .\mapserver.exe -productionmode -templates
  8. If installing v2i1, copy all files from C:\CoH_Data\attributes and place them into C:\Ouroboros\data\server\db\templates. If installing a later version, the files should be placed there automatically.
  9. If you didn't get them from a downloaded release, copy all sample config files from Source/Assets/ConfigFiles into c:\Ouroboros (for example: Source/Assets/ConfigFiles/data/server/db will become C:/Ouroboros/data/server/db)

Database setup

  1. You will need to choose a password for the database user. In these examples it will be "YOURL33TPASS!".
  2. Launch SQL Server Management Studio from the start menu
  3. Hit "Connect" on the screen that pops up, with default settings:
  4. We need to enable the sa login so that server can login to the database.
    1. If you look to the left panel you will see the object explorer and your connection. Right click it and select properties.
    2. When this window comes up hit Security to the left and enable "sql server and windows authentication". Then click ok.
    3. In the same panel you used before navigate to Security -> Logins then right click and enter properties the sa user.
    4. In this window set the password to the same password you set back at step 4
    5. Choose Status from the left panel in this same window and set login to enabled and hit ok.
    6. Right click the connection in the object explorer again and click Restart.
  5. Next we need to apply the schema for the databases which require this to be done manually (account, auction, auth, and chat)
    1. Click File -> Open -> File, navigate to the dbschemas that you downloaded at the start, and select cohauc.sql
    2. You will see a create database statement near the top of the file, with two lines that include a filename parameter.
    3. Delete these lines, so that the statement is just:
      CREATE DATABASE [cohauc]
      
    4. Click the Execute button
    5. Repeat these steps for cohacc.sql, cohauth.sql and cohchat.sql. Do not use cohdb.sql

Initial database entries

Each dbserver instance is a "shard". This needs to be manually added to authserver. In SQL Server Management Studio, expand "Databases", then right click on cohauth and select "New Query" from the menu. Several pieces of data are needed for this.

  • The IP address which clients will use to connect to your server. In this example, we will use 1.2.3.4
  • The source IP from which dbserver will connect to authserver. In this example, we will use 127.0.0.1
  • The shard name that you will use for dbserver. This should match the table in I25_FAQ#How_come_my_server_says_.22Paragon.22_and_how_do_I_change_it.3F and the shard ID configured in the config files. In this example we will use Paragon.
  • The auth shard number that you are using in turnstile_server.cfg. By default this is 1.

In the file that it creates, enter:

INSERT INTO cohauth.dbo.server (id, name, ip, inner_ip, ageLimit, pk_flag, server_group_id) VALUES (1, 'Paragon', '1.2.3.4', '127.0.0.1', 0, 0, 1);
INSERT INTO cohauth.dbo.worldstatus (idx, status) VALUES (1, 0);

Then press 'Execute'.

You will also want to create an account so that you can test connecting to the database. For now, use the instructions in I25_FAQ#How_do_I_create_an_account.3F

Server database connection configuration

Navigate to C:\Ouroboros\data\server\db. In each of the following files, look for an SqlLogin line, and change the Pwd= value to your password. Using our example YOURL33TPASS!:

SqlLogin "DRIVER={SQL Server Native Client 11.0};Server=localhost\SQLEXPRESS;Uid=sa;Pwd=YOURL33TPASS!;"
  • account_server.cfg
  • auction_server.cfg
  • chat_server.cfg
  • servers.cfg

In servers.cfg, also fix SqlInit to be:

SqlInit "create database cohdb;"

For authserver, we have to configure the connection via ODBC data sources.

  1. Launch "ODBC Data Sources (32-bit)" from the start menu, or run directly from C:\Windows\SysWOW64\odbcad32.exe. (Do not use the 64-bit version)
  2. Click File DSN then click add to the right.
  3. Choose ODBC Driver 17 for SQL Server.
  4. Click Next.
  5. Enter AuthDB into the box
  6. Click Next, then Finish.
  7. One of the boxes on the next page will say "Which SQL Server do you want to connect to?". Type localhost\SQLEXPRESS
  8. Click Next
  9. Choose "With SQL Server authentication using a login ID and password entered by the user". Enter "sa" for the username, and the password that you chose:
  10. Click Next
  11. Enable "Change the default database to" and select "cohauth".
  12. Click Next
  13. Default settings are fine on the last page
  14. Click Finish
  15. A box will appear with the settings you have selected. Click "Test Data Source"
  16. You should see "TESTS COMPLETED SUCCESSFULLY!" in the output. If not, go back and check your settings.
  17. Click OK, then OK again.

Then we have to enter the username and password again into authserver itself. Start authserver.exe, and the first time that you run it, this window will appear. Enter "sa" and the password that you chose:

This username and password is saved in the registry key HKEY_CURRENT_USER\Software\NCSoft\GLOBALAUTH

Launch server

The following servers need to be manually started, in this order:

  1. authserver.exe
  2. dbserver.exe
  3. launcher.exe

The rest of the servers are started by loadBalanceShardSpecific.cfg.

Connecting a client

Launch the client with:

Ouroboros -auth 127.0.0.1

Filling in the IP address where you will connect to authserver.

Troubleshooting

  • ERROR: Failed to open attribute file vars.attribute for writing. You may get this error when running mapserver -productionmode -templates. If you are installing v2i1, this means you didn't create the C:\CoH_Data\attributes folder before running the command. If you are installing a later version than v2i1, it is likely trying to access C:\Ouroboros\data\server\db\templates instead. It is supposed to create that folder automatically if it doesn't exist. If you are getting this error message anyways, try manually creating the C:\Ouroboros\data\server\db\templates folder and then rerun mapserver -productionmode -templates.
  • ERROR: 'gzip' is not recognized as an internal or external command, operable program or batch file. If you get this message, it is usually accompanying a different error message. This happens because the server is trying to compress the dump files that it creates when some errors are found. You can safely ignore any messages about a missing gzip.exe, but if you would like to make these errors not happen any more you can place a gzip.exe and a zip.exe in any folder which is in your Path windows system environment variable. Look for a standard windows gzip.exe download, and you can also download info-zip and use the zip.exe which comes with it.
  • ERROR: Loading templates... If you get errors when you launch dbserver.exe when it tries to load templates, something went wrong with the steps involving running mapserver.exe -productionmode -templates in Setup server files, and it can't find the template files in C:\Ouroboros\data\server\db\templates.
  • ERROR: Version difference between client/server. This is a mismatch between the client version and the Version parameter in the C:\Ouroboros\version.ini file