Difference between revisions of "How To Create a BOARD18 WEB Site"

From BOARD18 Project WIKI
Jump to navigation Jump to search
(→‎Some comments about the BOARD18 MySQL Database: added GRANT DELETE ON board18.game_link)
 
(24 intermediate revisions by the same user not shown)
Line 14: Line 14:
Before starting this procedure, you will have to create a new (empty) MYSQL database on your DB server. <br>How to do this varies and is beyond the scope of this how to document.  
Before starting this procedure, you will have to create a new (empty) MYSQL database on your DB server. <br>How to do this varies and is beyond the scope of this how to document.  
   
   
But I do suggest that you create '''two''' usernames for access to this database. The first or "root user" should have complete access to the database and should be used to create and load it. This is the username that you will put in the config.php file in the utility sub directory [see below]. The second should be limited to select, insert and update access. This is the username that you will put in the config.php file in the php directory of the web root directory. The board18 web application will use this second username. It is called "board18" in the supplied php/config.php file. The following commands can be used to create this username if the database resides on the web server:
But I do suggest that you create '''two''' usernames for access to this database. The first or "root user" should have complete access to the database and should be used to create and load it. This is the username that you will put in the config.php file in the '''utility''' sub directory [see below]. The second or "board18 user" should be limited to select, insert and update access. This is the username that you will put in the config.php file in the '''php''' sub directory of the web root directory. The board18 web application will use this second username. It is called "board18" in the supplied php/config.php file. The following commands can be used to create this username '''if the database resides on the web server''':


<pre>  
<pre>  
CREATE USER 'board18'@'localhost' IDENTIFIED BY 'board18';
CREATE USER 'board18'@'localhost' IDENTIFIED BY 'board18';
GRANT SELECT, INSERT, UPDATE ON board18.* TO 'board18'@'localhost'
GRANT SELECT, INSERT, UPDATE ON board18.* TO 'board18'@'localhost';
GRANT DELETE ON board18.auth_tokens TO 'board18'@'localhost';
GRANT DELETE ON board18.game_player TO 'board18'@'localhost';
GRANT DELETE ON board18.game_link TO 'board18'@'localhost';
</pre>
</pre>
<span style="color: Fuchsia">As a somewhat less secure alternative one can modify the second line to include DELETE and eliminate the third, fourth and fifth lines.</span>
<span style="color: Green">Many web hosting providers [such as DreamHost] provide control panels that have all the capabilities needed to create a database and its associated usernames.</span>


===Perform these steps on your local PC===
===Perform these steps on your local PC===
* Browse to the [[Download BOARD18|download]] page and download the zip file: board18-''version''.zip where ''version'' is the version that you wish to have.
* Browse to the [[Download BOARD18|download]] page and download the zip file for the BOARD18 version that you wish to have.
* Using FTP or SCP, move this zip file to your web server.
* Using FTP or SCP, move this zip file to your web server.
* Create an empty folder (directory) for game boxes.
* For each game box that you wish to install in board18, browse to the [[Download_Game_Boxes|game box download]] page and download the zip file for that game box into this folder.
* Using FTP or SCP, move this folder to your web server.


===Perform these steps on your Linux web server===
===Perform these steps on your Linux web server===
* Extract board18-''version''.zip into your shell root directory.  
* Create the MySQL database. See above.
* Move the '''contents of''' the webroot sub directory to your web root directory.
* Extract uploaded .zip file [see above] into your shell root directory.  
* Move the '''contents of''' the webroot sub directory of the extracted directory to your web root directory.
* Create a utility directory in your shell root directory.
* Create a utility directory in your shell root directory.
* Move the '''contents of''' the utility sub directory to this new directory.
* Move the '''contents of''' the utility sub directory of the extracted directory to this new utility directory.
* Edit the ''webroot''/php/config.php file.
* Edit the ''webroot''/php/config.php file.
*# Change DB_HOST only if your DB server is different from your web server.
** Change DB_HOST only if your DB server is different from your web server.
*# Change DB_DATABASE to the name you gave to your BOARD18 database.
** Change DB_DATABASE to the name you gave to your BOARD18 database.
*# You can also change the database user ID and password if you want.
** Change the database user ID and password to the "board18 user" [see above].
*# Save the edited file.
** Save the edited file.
* Create the ''webroot''/php/configMail.php file.
** Copy the ''webroot''/utility/configMailTemplate.php file to the ''webroot''/php/ directory.
** Rename this copied file to ''webroot''/php/configMail.php.
* Edit the ''webroot''/php/configMail.php file.
* Edit the ''webroot''/php/configMail.php file.
*# Change MAIL_HOST to point to your SMTP server.
** Change MAIL_HOST to point to your SMTP server.
*# Change MAIL_USER to your mail user name on this SMTP server.
** Change MAIL_USER to your mail user name on this SMTP server.
*# Change MAIL_PASS to your mail user password on this SMTP server.
** Change MAIL_PASS to your mail user password on this SMTP server.
*# Save the edited file.
** Change MAIL_SENDER to the email address to which you wish replies to be sent.<ref>The installer of BOARD18 should create an Email address such as '''admin@my.site.org''' <br>and then use it to forward replies to an admin level player or to a group of admin level players.</ref>
** Change MAIL_TLS to 'tls'  if your SMTP server requires TLS. <ref>Note: Changing MAIL_TLS to 'tls' may cause some older SMTP servers to reject your email.</ref>
** Save the edited file.
* Edit the utility/config.php file.
* Edit the utility/config.php file.
*# Change DB_HOST only if your DB server is different from your web server.
** Change DB_HOST only if your DB server is different from your web server.
*# Change DB_DATABASE to the name you gave to your BOARD18 database.
** Change DB_DATABASE to the name you gave to your BOARD18 database.
*# Change the database user ID and password to the "root user" [see above].
** Change the database user ID and password to the "root user" [see above].
*# Save the edited file.
** Save the edited file.
 
<references/>


===Load the BOARD18 DataBase===
===Load the BOARD18 DataBase===
* Start a command line window on the server.
* Start a command line window on the server.
* cd to the utility directory.
* Enter on the command line:  
* Enter on the command line:  
<pre>  
<pre>cd ~/utility
mysql -u username -ppassword -h hostname databasename < board18db.txt
mysql -u username -p -h hostname databasename < board18db.txt
</pre>
</pre>
* The hostname (DB_HOST), databasename (DB_DATABASE), username and password should be those specified in the utility/config.php file.  
* Note: The cd command above may have to be modified. The intent is to go to the utility directory.
* The hostname (DB_HOST), databasename (DB_DATABASE) and username should be those specified in the utility/config.php file.
* When prompted for a password, enter the password specified in the utility/config.php file.  


You should now have an empty BOARD18 database. All the tables are defined but they are all empty.<br>
You should now have an empty BOARD18 database. All the tables are defined but they are all empty.<br>
The only table that should be preloaded with data is the game box table. <br>
The only table that must be preloaded with data is the game box table.


To preload the game box table, repeat the following steps for every ''boxname''.json file in the utility/control directory:
===Create the initial BOARD18 admin player===
* Enter on the command line:
* Browse to your new board18 web site. You will see a Login form on the welcome page.
<pre>
* Press the '''REGISTER''' button. You will then see a Register form on the welcome page.  
php loadGameBox.php control/boxname.json
* The first player that is registered in a new BOARD18 web site is automatically made an admin player.
</pre>
 
* For each game box you should see an output that looks something like this:
===Load the BOARD18 Game Boxes===
<pre>
 
Successfully created game box table row 1.
This process is described in detail [[How_To_Load_Board18_Game_Boxes#How_to_mass_load_BOARD18_game_boxes_using_Linux|here]].
The box name is 1826.
The version is REP01.
The author is Rich Price.
The date is 2013-07-15 09:26:48.
</pre>


==How to create a BOARD18 web site using Windows==
==How to create a BOARD18 web site using Windows==

Latest revision as of 12:11, 26 August 2020

How to create a BOARD18 web site using Linux

These instructions assume that you already have shell access to a server environment that is running Apache with PHP version 5.3 or later and MySQL version 5.5 or later. You first have to decide whether to create a new domain for the application or to put it on a sub directory of an existing domain. In the following instructions, the directory that you choose to use will be referred to as the "web root directory" regardless of whether it is "really" a root or not.

The work of setting up a domain is well documented and quite beyond the scope of this how to. So it will be assumed that this work has been done.

Some comments about the BOARD18 MySQL Database

Before starting this procedure, you will have to create a new (empty) MYSQL database on your DB server.
How to do this varies and is beyond the scope of this how to document.

But I do suggest that you create two usernames for access to this database. The first or "root user" should have complete access to the database and should be used to create and load it. This is the username that you will put in the config.php file in the utility sub directory [see below]. The second or "board18 user" should be limited to select, insert and update access. This is the username that you will put in the config.php file in the php sub directory of the web root directory. The board18 web application will use this second username. It is called "board18" in the supplied php/config.php file. The following commands can be used to create this username if the database resides on the web server:

 
CREATE USER 'board18'@'localhost' IDENTIFIED BY 'board18';
GRANT SELECT, INSERT, UPDATE ON board18.* TO 'board18'@'localhost';
GRANT DELETE ON board18.auth_tokens TO 'board18'@'localhost';
GRANT DELETE ON board18.game_player TO 'board18'@'localhost';
GRANT DELETE ON board18.game_link TO 'board18'@'localhost';

As a somewhat less secure alternative one can modify the second line to include DELETE and eliminate the third, fourth and fifth lines.

Many web hosting providers [such as DreamHost] provide control panels that have all the capabilities needed to create a database and its associated usernames.

Perform these steps on your local PC

  • Browse to the download page and download the zip file for the BOARD18 version that you wish to have.
  • Using FTP or SCP, move this zip file to your web server.
  • Create an empty folder (directory) for game boxes.
  • For each game box that you wish to install in board18, browse to the game box download page and download the zip file for that game box into this folder.
  • Using FTP or SCP, move this folder to your web server.

Perform these steps on your Linux web server

  • Create the MySQL database. See above.
  • Extract uploaded .zip file [see above] into your shell root directory.
  • Move the contents of the webroot sub directory of the extracted directory to your web root directory.
  • Create a utility directory in your shell root directory.
  • Move the contents of the utility sub directory of the extracted directory to this new utility directory.
  • Edit the webroot/php/config.php file.
    • Change DB_HOST only if your DB server is different from your web server.
    • Change DB_DATABASE to the name you gave to your BOARD18 database.
    • Change the database user ID and password to the "board18 user" [see above].
    • Save the edited file.
  • Create the webroot/php/configMail.php file.
    • Copy the webroot/utility/configMailTemplate.php file to the webroot/php/ directory.
    • Rename this copied file to webroot/php/configMail.php.
  • Edit the webroot/php/configMail.php file.
    • Change MAIL_HOST to point to your SMTP server.
    • Change MAIL_USER to your mail user name on this SMTP server.
    • Change MAIL_PASS to your mail user password on this SMTP server.
    • Change MAIL_SENDER to the email address to which you wish replies to be sent.[1]
    • Change MAIL_TLS to 'tls' if your SMTP server requires TLS. [2]
    • Save the edited file.
  • Edit the utility/config.php file.
    • Change DB_HOST only if your DB server is different from your web server.
    • Change DB_DATABASE to the name you gave to your BOARD18 database.
    • Change the database user ID and password to the "root user" [see above].
    • Save the edited file.
  1. The installer of BOARD18 should create an Email address such as admin@my.site.org
    and then use it to forward replies to an admin level player or to a group of admin level players.
  2. Note: Changing MAIL_TLS to 'tls' may cause some older SMTP servers to reject your email.

Load the BOARD18 DataBase

  • Start a command line window on the server.
  • Enter on the command line:
cd ~/utility
mysql -u username -p -h hostname databasename < board18db.txt
  • Note: The cd command above may have to be modified. The intent is to go to the utility directory.
  • The hostname (DB_HOST), databasename (DB_DATABASE) and username should be those specified in the utility/config.php file.
  • When prompted for a password, enter the password specified in the utility/config.php file.

You should now have an empty BOARD18 database. All the tables are defined but they are all empty.
The only table that must be preloaded with data is the game box table.

Create the initial BOARD18 admin player

  • Browse to your new board18 web site. You will see a Login form on the welcome page.
  • Press the REGISTER button. You will then see a Register form on the welcome page.
  • The first player that is registered in a new BOARD18 web site is automatically made an admin player.

Load the BOARD18 Game Boxes

This process is described in detail here.

How to create a BOARD18 web site using Windows

If you have a Windows environment please modify the above Linux instructions, test them and then enter them here.

How to create a BOARD18 web site using a MAC

If you have a MAC environment please modify the above Linux instructions, test them and then enter them here.