Difference between revisions of "Setting up the Database"

From Paradise Station Wiki
Jump to navigation Jump to search
(Added NR tag)
(Update for PR #15980, and some better explanations.)
Line 1: Line 1:
{{Needsrevision|reason = New config stuff was merged this needs to be updated to account for that<br>https://github.com/ParadiseSS13/Paradise/pull/15980}}
== Initial setup and installation ==
* Download and install [https://mariadb.com/downloads/mariadb-tx MariaDB] for your operating system.
* Download and install [https://mariadb.com/downloads/mariadb-tx MariaDB] for your operating system.
** (Defaults should work, you need tcp enabled and to set a root password. if it offers do not set it up to use windows authentication)
** (Defaults should work, you need tcp enabled and to set a root password. if it offers do not set it up to use windows authentication)
Line 6: Line 6:
** Click on new to create a new session, check prompt for credentials and leave the rest as default.
** Click on new to create a new session, check prompt for credentials and leave the rest as default.
** Click save, then click open and enter in root for the username and the password you setup during the installation.
** Click save, then click open and enter in root for the username and the password you setup during the installation.
* Select the database you just created and then go to file -> open sql file and Open the file paradise_schema.sql file in the SQL directory of the game. You can also find it [https://github.com/ParadiseSS13/Paradise/blob/master/SQL/paradise_schema.sql here], but it may be newer than the version you are using.
* Select the database you just created and then go to File -> Load SQL File, and open the paradise_schema.sql file found in the \SQL directory of the game. You can also find it [https://github.com/ParadiseSS13/Paradise/blob/master/SQL/paradise_schema.sql here], but it may be newer than the version you are using.
* Press the blue play icon in the topic bar of icon hieroglyphs and pray. If the schema imported correctly you should have no errors in the message box on the bottom.   
* Press the blue play icon in the topic bar of icon hieroglyphs and pray. If the schema imported correctly you should have no errors in the message box on the bottom.   
** Refresh the panel on the left by right clicking it and ensure there's a new database called "feedback" created
** Refresh the panel on the left by right clicking it and ensure there's a new database called "feedback" created
* Create a new user account for the server by going to tools -> user manager
* Create a new user account for the server by going to tools -> user manager
** hostname should be 127.0.0.1, not localhost if hosted locally, otherwise use the ip of the game server.
** 'From host' should be 127.0.0.1, not localhost if hosted locally, otherwise use the IP of the game server.
** For permissions, do not give it any global permissions, instead click add object, and then select the database you created for the server, hit ok, then give it select, update, insert, and delete permissions on that database.
** For permissions, do not give it any global permissions, instead click 'Add object', and then select the database you created for the server, hit ok, then give it SELECT, DELETE, INSERT, and UPDATE permissions on that database.
** You can click the arrow on the password field to get a randomly generated password of certain lengths, copy the password before saving as it will be cleared the moment you hit save.
** You can click the arrow on the password field to get a randomly generated password of certain lengths, copy the password before saving as it will be cleared the moment you hit save.
* Open the file: [https://github.com/ParadiseSS13/Paradise/blob/master/config/example/dbconfig.txt config/dbconfig.txt] in notepad, notepad++ or your favourite text editor. You should've copied it over to config folder beforehand.  
* Open the file: [https://github.com/ParadiseSS13/Paradise/blob/master/config/example/config.toml \config\config.toml] in notepad, notepad++, VSCode, or your favourite text editor, and scroll down to the [database_configuration] section. You should've copied the file over from the \example folder beforehand.  
* Make sure to set it so that
* Make sure that these settings are changed:
** SQL_ENABLED does not have a # in front of it
** <code>sql_enabled</code> is set to <code>true</code>.
** ADDRESS 127.0.0.1 (Replace with the database server's ip if not hosted locally)
** <code>sql_address</code> is set to <code>"127.0.0.1"</code>. (Replace with the database server's IP if not hosted locally)
** PORT 3306
** <code>sql_port</code> is set to whatever port was selected during the MariaDB install, usually <code>3306</code>.
** FEEDBACK_DATABASE feedback
** <code>sql_database</code> is set to the name of your database, usually <code>"feedback"</code>.
** FEEDBACK_LOGIN myuser (replace with the user you created)
** <code>sql_username</code> is set to the 'User name' of the user you created above.
** FEEDBACK_PASSWORD mypass (replace with the user you created)
** <code>sql_password</code> is set to the randomly generated 'Password' of the user you created above.
* The database is now set up for death logging, population logging, polls, library, privacy poll, connection logging and player logging. There are two more features which you should consider. And it's best to do so now, since adopting them later can be a pain.
* The database is now set up for death logging, population logging, polls, library, privacy poll, connection logging and player logging. There are two more features which you should consider. And it's best to do so now, since adopting them later can be a pain.


 
== Database based banning ==
=== Database based banning ===


Offers temporary jobbans, admin bans, cross-server bans, keeps bans logged even after they've expired or were unbanned, and allows for the use of the off-server ban log.  
Offers temporary jobbans, admin bans, cross-server bans, keeps bans logged even after they've expired or were unbanned, and allows for the use of the off-server ban log.  
Line 30: Line 29:
To enable database based banning:
To enable database based banning:


* Open Paradise/config/config.txt
* Open \config\config.toml and scroll to the [general_configuration] section.
* Add a # in front of BAN_LEGACY_SYSTEM, so the line looks like "#BAN_LEGACY_SYSTEM"
* Set <code>use_database_bans</code> to <code>true</code>.
* Done. Note that any legacy bans are no longer enforced once this is done! So it's a good idea to do it when you're starting up.
* Done! Note that any legacy bans are no longer enforced once this is done! So it's a good idea to do it when you're starting up.
 
=== Database based administration ===


== Database based administration ==


Offers a changelog for changes done to admins, which increases accountability (adding/removing admins, adding/removing permissions, changing ranks); allows admins with +PERMISSIONS to edit other admins' permissions ingame, meaning they don't need remote desktop access to edit admins; Allows for custom ranks, with permissions not being tied to ranks, offering a better ability for the removal or addition of permissions to certain admins, if they need to be punished, or need extra permissions. Enabling this can be done any time, it's just a bit tedious the first time you do it, if you don't have direct access to the database.
Offers a changelog for changes done to admins, which increases accountability (adding/removing admins, adding/removing permissions, changing ranks); allows admins with +PERMISSIONS to edit other admins' permissions ingame, meaning they don't need remote desktop access to edit admins; Allows for custom ranks, with permissions not being tied to ranks, offering a better ability for the removal or addition of permissions to certain admins, if they need to be punished, or need extra permissions. Enabling this can be done any time, it's just a bit tedious the first time you do it, if you don't have direct access to the database.
Line 41: Line 39:
To enable database based administration:
To enable database based administration:


* Open config/config.txt
* Open \config\config.toml and scroll to the [admin_configuration] section.
* Add a # in front of ADMIN_LEGACY_SYSTEM, so the line looks like "#ADMIN_LEGACY_SYSTEM"
* Set <code>use_database_admins</code> to <code>true</code>.
* Add a database entry for the first administrator (likely yourself).
* Add a database entry for the first administrator (likely yourself).
* Done. Note that anyone in admins.txt lost admin status, including you!
* Done! Note that anyone set in the <code>admin_assignments</code> list will no longer be counted.
* If your database ever dies, your server will revert to the old admin system, so it is a good idea to have admins.txt and admin_ranks.txt set up with some admins too, just so the loss of the database doesn't completely destroy everything.
* If your database ever dies, your server will revert to the old admin system, so it is a good idea to have <code>admin_assignments</code> and <code>admin_ranks</code> set up with some admins too, just so that the loss of the database doesn't completely destroy everything.


{{Contribution Guides}}
{{Contribution Guides}}


[[Category:Guides]]
[[Category:Guides]]

Revision as of 09:56, 26 July 2021

Initial setup and installation

  • Download and install MariaDB for your operating system.
    • (Defaults should work, you need tcp enabled and to set a root password. if it offers do not set it up to use windows authentication)
      • If you've ticked Install as a Windows Service (should be ticked by default), it will run whenever you boot up your computer, so there's no need to worry about starting it manually
  • Open HeidiSQL (comes with Mariadb) and connect it to the database
    • Click on new to create a new session, check prompt for credentials and leave the rest as default.
    • Click save, then click open and enter in root for the username and the password you setup during the installation.
  • Select the database you just created and then go to File -> Load SQL File, and open the paradise_schema.sql file found in the \SQL directory of the game. You can also find it here, but it may be newer than the version you are using.
  • Press the blue play icon in the topic bar of icon hieroglyphs and pray. If the schema imported correctly you should have no errors in the message box on the bottom.
    • Refresh the panel on the left by right clicking it and ensure there's a new database called "feedback" created
  • Create a new user account for the server by going to tools -> user manager
    • 'From host' should be 127.0.0.1, not localhost if hosted locally, otherwise use the IP of the game server.
    • For permissions, do not give it any global permissions, instead click 'Add object', and then select the database you created for the server, hit ok, then give it SELECT, DELETE, INSERT, and UPDATE permissions on that database.
    • You can click the arrow on the password field to get a randomly generated password of certain lengths, copy the password before saving as it will be cleared the moment you hit save.
  • Open the file: \config\config.toml in notepad, notepad++, VSCode, or your favourite text editor, and scroll down to the [database_configuration] section. You should've copied the file over from the \example folder beforehand.
  • Make sure that these settings are changed:
    • sql_enabled is set to true.
    • sql_address is set to "127.0.0.1". (Replace with the database server's IP if not hosted locally)
    • sql_port is set to whatever port was selected during the MariaDB install, usually 3306.
    • sql_database is set to the name of your database, usually "feedback".
    • sql_username is set to the 'User name' of the user you created above.
    • sql_password is set to the randomly generated 'Password' of the user you created above.
  • The database is now set up for death logging, population logging, polls, library, privacy poll, connection logging and player logging. There are two more features which you should consider. And it's best to do so now, since adopting them later can be a pain.

Database based banning

Offers temporary jobbans, admin bans, cross-server bans, keeps bans logged even after they've expired or were unbanned, and allows for the use of the off-server ban log.

To enable database based banning:

  • Open \config\config.toml and scroll to the [general_configuration] section.
  • Set use_database_bans to true.
  • Done! Note that any legacy bans are no longer enforced once this is done! So it's a good idea to do it when you're starting up.

Database based administration

Offers a changelog for changes done to admins, which increases accountability (adding/removing admins, adding/removing permissions, changing ranks); allows admins with +PERMISSIONS to edit other admins' permissions ingame, meaning they don't need remote desktop access to edit admins; Allows for custom ranks, with permissions not being tied to ranks, offering a better ability for the removal or addition of permissions to certain admins, if they need to be punished, or need extra permissions. Enabling this can be done any time, it's just a bit tedious the first time you do it, if you don't have direct access to the database.

To enable database based administration:

  • Open \config\config.toml and scroll to the [admin_configuration] section.
  • Set use_database_admins to true.
  • Add a database entry for the first administrator (likely yourself).
  • Done! Note that anyone set in the admin_assignments list will no longer be counted.
  • If your database ever dies, your server will revert to the old admin system, so it is a good idea to have admin_assignments and admin_ranks set up with some admins too, just so that the loss of the database doesn't completely destroy everything.
Contribution Guides
General Guide to Contributing, Game Resources category, Github Glossary
Setting up a server Setting up the Database, Creating your own paracode server
Coding Understanding SS13 Code, SS13 for experienced programmers, Text Formatting
Mapping Guide to Mapping,
Spriting Guide to Spriting,
Wiki Guide to Editing the Wiki