Difference between revisions of "Setting up the Database"

From Paradise Station Wiki
Jump to navigation Jump to search
m
(Change database instructions over to MariaDB instead of XAMPP)
Line 1: Line 1:
* Download and install XAMPP ([http://www.apachefriends.org/en/xampp-windows.html Windows], [http://www.apachefriends.org/en/xampp-linux.html Linux]). Make sure you have both apache and mysql selected when you install it.
* Download and install [https://mariadb.com/downloads/mariadb-tx MariaDB] for your operating system.
* Run XAMPP Control Panel (Open start menu, type 'xampp' in the search field and run it)
** (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)
* Click 'Start' next to Apache and MySQL in the control panel. (Apache often conflicts with skype, so make sure you have skype off: Right click it's icon in the tray and click quit. Hiding it is not enough.)
*** 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
* Go to the following address in your browser: [http://localhost/phpmyadmin http://localhost/phpmyadmin] (will only work once you start up both Apache and MySQL in the XAMPP Control Panel)
* Open HeidiSQL (comes with Mariadb) and connect it to the database
* Click on the button titled SQL in the row of buttons at the top.
** Click on new to create a new session, check prompt for credentials and leave the rest as default.
* Open the file 'SQL/paradise_schema.sql' in notepad and copy its content. 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.
** Click save, then click open and enter in root for the username and the password you setup during the installation.
* Paste the file's content into the input field for sql in phpmyadmin and hit 'Execute' in the bottom right
* Right click on the server entry in the left side plane (the area with information_schema, mysql, etc) (the server entry will be the first one) and go to create new -> database
* Once you execute this, a new database should be added to the list on the left, called 'feedback'. If not, refresh the page. If you click on the database, it should show you all the tables it includes. At this point, you have created the database 'infrastructure'. You now have to create a user for it.
** You can name it anything at this step, parastation13, ss13.
* Click on 'SQL' in the top again, and execute the following statement: GRANT ALL on feedback.* TO 'username'@'localhost' IDENTIFIED BY 'password'; Replace username and password with your preferred credentials. Be careful to copy all the apostrophes. This will create a new user and grant him all privileges for the feedback database.
*** (Don't name it 'test' unless you like security issues)
* Please keep phpmyadmin open for a while longer.
* 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.
* If you still haven't copy all the files from the folder Paradise/config/example to Paradise/config
* 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
* Open the file Paradise/config/dbconfig.txt in notepad
** Refresh the panel on the left by right clicking it and ensure there's a new database called "feedback" created
* Make sure to set it so that:
* 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.
** 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.
** 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.
* Make sure to set it so that
** SQL_ENABLED does not have a # in front of it
** SQL_ENABLED does not have a # in front of it
** ADDRESS localhost
** ADDRESS 127.0.0.1 (Replace with the database server's ip if not hosted locally)
** PORT 3306
** PORT 3306
** FEEDBACK_DATABASE feedback
** FEEDBACK_DATABASE feedback(replace with the database you created)
** FEEDBACK_LOGIN myuser (where myuser is the username you set in the CREATE USER statement)
** FEEDBACK_LOGIN myuser (replace with the user you created)
** FEEDBACK_PASSWORD mypass (where mypass is the password you set in the CREATE USER statement)
** FEEDBACK_PASSWORD mypass (replace with the user you created)
* The database is now set up for death logging, population logging, 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 ([[Working with the database#Adding a new poll|Tutorial]]), 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 ===

Revision as of 22:37, 26 September 2019

  • 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.
  • Right click on the server entry in the left side plane (the area with information_schema, mysql, etc) (the server entry will be the first one) and go to create new -> database
    • You can name it anything at this step, parastation13, ss13.
      • (Don't name it 'test' unless you like security issues)
  • 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 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
    • hostname 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.
    • 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/dbconfig.txt in notepad, notepad++ or your favourite text editor. You should've copied it over to config folder beforehand.
  • Make sure to set it so that
    • SQL_ENABLED does not have a # in front of it
    • ADDRESS 127.0.0.1 (Replace with the database server's ip if not hosted locally)
    • PORT 3306
    • FEEDBACK_DATABASE feedback(replace with the database you created)
    • FEEDBACK_LOGIN myuser (replace with the user you created)
    • FEEDBACK_PASSWORD mypass (replace with the user you created)
  • The database is now set up for death logging, population logging, polls (Tutorial), 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 Paradise/config/config.txt
  • Add a # in front of BAN_LEGACY_SYSTEM, so the line looks like "#BAN_LEGACY_SYSTEM"
  • 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.txt
  • Add a # in front of ADMIN_LEGACY_SYSTEM, so the line looks like "#ADMIN_LEGACY_SYSTEM"
  • Add a database entry for the first administrator (likely yourself).
  • Done. Note that anyone in admins.txt lost admin status, including you!
  • 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.
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