# Setup: master config file

Updated 2024-03-06

The master configuration file, which the Rule Gane server reads upon startup, can be created to override the default values of some parameters. Normally, you should create it, because the password you use for the MySQL server is likely not the "default" one!

If you want to have a master configuration file, you need to place it to the location `/opt/w2020/w2020.conf`. You will need to use the `sudo` command to create the directory for that file.

The content of that file may look as follows:

    #--- This is the master configuration file for the Rule Game Server.
    #--- It is located in /opt/w2020/w2020.conf

    #--- The Rule Game server input data directory. The Game Server will read
    #--- experiment control files from it
    FILES_GAME_DATA = "/opt/w2020/game-data";

    #----The Rule Game server saved data directory.
    #--- The Game Server will write transcript files etc to it.
    FILES_SAVED =  "/opt/w2020/saved";

    #---- The name of the database on you MySQL server that your Rule Game Server uses
    JDBC_DATABASE = "game";
    #---- The user name for the MySQL server
    JDBC_USER = "game";
    #---- The password for the MySQL server. Change this is needed. Typically, this is the only field you need to change
    JDBC_PASSWORD = "meerkat";

    #---- The URL for the Rule Game GUI Client (prod and dev versions)
    GUI_PROD = "/rule-game/prod/";
    GUI_DEV = "/rule-game/dev/";

#### Data file locations

As you can see, you can use this file to modify the locations of the Game Server data directories. In the above example, we use the recommended locations, under `/opt/w2020`. In the past, on some servers we put those directories under `/opt/tomcat` instead, but that's probably not a very good choice.

Whatever location you have chosen for the data directories, you need to create them:

        cd /opt/w2020
        mkdir saved
        mkdir game-data

When creating those two directories, make sure that the Linux user `tomcat` (which runs the Tomcat server) can read fromboth of these directories, and to write to the `saved` directory. You can do this e.g. by transferring their ownership to that user:

    sudo mkdir /opt/w2020/game-data /opt/w2020/saved
    sudo chown tomcat.tomcat  /opt/w2020/game-data /opt/w2020/saved

#### MySQL server info

You also use this config file to specify the user name and password for the MySQL server account used by the Game Server. Normally, you'll keep the account name (`game`), but will modify the password value, based on whatever you have set for that user name.

#### Relative locations of the server app and the client app

The parameters `GUI_PROD` and `GUI_DEV` specify the URLs for the GUI client, i.e. the URLs to which your server will link from its launch pages, such as main launch page, or the MLC launch page. If you follow the standard setup process we describe (either Setup Option A or Setup Option B), keep the values of these parameters as shown above; these are relative URLs, because your players will load the GUI client from the same host where your game server runs.

However, it is also possible to run a non-standard setup, with the client app sitting at a different location from the server. In this case, an absolute URL is needed:

    GUI_PROD = "http://myHostName/rule-game/prod/";
    GUI_DEV = "http://myHostName/rule-game/dev/";

### Config file ownership

For a bit of security, consider changing the ownership of this file to the user that runs (or will run) Tomcat on your machine (on Linux, typically, that's user `tomcat`), and making it only readable by that user.

You can later edit this file with e.g.

        sudo -u tomcat emacs w2020.conf

[Back to the main setup page] [Main documentation page]