Difference between revisions of "Help:How to add new wiki to the farm"
(Created page with " Under development ...") |
|||
| Line 1: | Line 1: | ||
| − | + | Let's see how to add a wiki number 4 for the game ''Among Us''. | |
| + | |||
| + | == Login to the server == | ||
| + | Open a SSH session: | ||
| + | ssh databank@videogamedatabank.com | ||
| + | |||
| + | == Create a database == | ||
| + | Login to MySQL: | ||
| + | <syntaxhighlight lang=""> | ||
| + | sudo mysql | ||
| + | </syntaxhighlight> | ||
| + | Please follow the pattern ''gamewiki_N'' where ''N'' is the next number in the family. | ||
| + | <syntaxhighlight lang="mysql"> | ||
| + | CREATE DATABASE gamewiki_4; | ||
| + | </syntaxhighlight> | ||
| + | Allow access to the database for the central database user: | ||
| + | <syntaxhighlight lang="mysql"> | ||
| + | GRANT ALL PRIVILEGES ON gamewiki_4.* TO 'gamewiki_0user'@'localhost' WITH GRANT OPTION; | ||
| + | </syntaxhighlight> | ||
| + | Done! | ||
| + | <syntaxhighlight lang="mysql"> | ||
| + | exit | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | == Prepare the environment == | ||
| + | === Create a symlink === | ||
| + | Please use a simplified, URL friendly game name, eg. <code>amongus</code> for ''Among Us'': | ||
| + | sudo ln -s /var/www/videogamedatabank.com/mediawiki /var/www/videogamedatabank.com/amongus | ||
| + | |||
| + | === Add a rule for a Giant switch === | ||
| + | sudo nano /var/www/videogamedatabank.com/mediawiki/LocalSettings.php | ||
| + | Find this line: | ||
| + | <syntaxhighlight lang="php"> | ||
| + | } else { | ||
| + | </syntaxhighlight> | ||
| + | Insert this piece of code right before it: | ||
| + | <syntaxhighlight lang="php"> | ||
| + | } elseif ( strpos( $callingurl, '/amongus' ) === 0 ) { | ||
| + | require_once $customizationdir . '/LocalSettings_gamewiki4.php'; | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === Create a separate directory for uploads === | ||
| + | sudo mkdir /var/www/videogamedatabank.com/mediawiki/images_gamewiki4 | ||
| + | |||
| + | sudo cp /var/www/videogamedatabank.com/mediawiki/images_gamewiki0/.htaccess /var/www/videogamedatabank.com/mediawiki/images_gamewiki4/.htaccess | ||
| + | |||
| + | sudo chown -R www-data: /var/www/videogamedatabank.com/mediawiki/images_gamewiki4 | ||
| + | |||
| + | === Copy configuration === | ||
| + | Copy a standard per wiki config: | ||
| + | sudo cp /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/LocalSettings_{gamewiki0,gamewiki4}.php | ||
| + | Copy a custom per wiki config: | ||
| + | sudo cp /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/Special_{gamewiki0,gamewiki4}.php | ||
| + | Adjust: | ||
| + | $wgSitename = "Among Us Wiki"; | ||
| + | $wgScriptPath = "/amongus"; | ||
| + | $wgUploadDirectory = "$IP/images_gamewiki4"; | ||
| + | $wgUploadPath = "$wgScriptPath/images_gamewiki4"; | ||
| + | $wgDBname = "gamewiki_4"; | ||
| + | enableSemantics( 'amongus' ); | ||
| + | require_once( 'Special_gamewiki4.php' ); | ||
| + | |||
| + | == Automate mediawiki job queue processing == | ||
| + | === Create a job runner === | ||
| + | Copy the job runner script: | ||
| + | sudo cp /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mwjobrunner_{gamewiki0,gamewiki4} | ||
| + | Adjust it accordingly: | ||
| + | sudo nano /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mwjobrunner_gamewiki4 | ||
| + | Example (adjusted lines are highlighted): | ||
| + | <syntaxhighlight lang="php" highlight="4,9"> | ||
| + | #!/bin/bash | ||
| + | MW_INSTALL_PATH=/var/www/videogamedatabank.com/mediawiki | ||
| + | RUNJOBS=$MW_INSTALL_PATH/maintenance/runJobs.php | ||
| + | CONFIG=$MW_INSTALL_PATH/extensions/wikivisor/LocalSettings_gamewiki4.php | ||
| + | echo Starting job service... | ||
| + | sleep 60 | ||
| + | echo Started. | ||
| + | while true; do | ||
| + | echo Processing Among Us Wiki ... | ||
| + | php $RUNJOBS --type="enotifNotify" --conf $CONFIG | ||
| + | php $RUNJOBS --wait --maxjobs=50 --conf $CONFIG | ||
| + | echo Waiting for 10 seconds... | ||
| + | sleep 10 | ||
| + | done | ||
| + | </syntaxhighlight> | ||
| + | Symlink it to the system path: | ||
| + | sudo ln -s /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mwjobrunner_gamewiki4 /usr/local/bin/ | ||
| + | |||
| + | === Create a system service === | ||
| + | Copy the system service definition: | ||
| + | sudo cp /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mw-jobqueue_{gamewiki0,gamewiki4}.service | ||
| + | Adjust it accordingly: | ||
| + | sudo nano /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mw-jobqueue_gamewiki4.service | ||
| + | Example (adjusted lines are highlighted): | ||
| + | <syntaxhighlight lang="php" highlight="2,5"> | ||
| + | [Unit] | ||
| + | Description=MediaWiki Job runner service - Among Us | ||
| + | |||
| + | [Service] | ||
| + | ExecStart=/usr/local/bin/mwjobrunner_gamewiki4 | ||
| + | Nice=10 | ||
| + | ProtectSystem=full | ||
| + | User=www-data | ||
| + | OOMScoreAdjust=200 | ||
| + | StandardOutput=journal | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | </syntaxhighlight> | ||
| + | Symlink it to the system path: | ||
| + | sudo ln -s /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mw-jobqueue_gamewiki4.service /etc/systemd/system | ||
| + | Enable the service: | ||
| + | sudo systemctl enable mw-jobqueue_gamewiki4.service | ||
| + | Start the service: | ||
| + | sudo systemctl start mw-jobqueue_gamewiki4.service | ||
| + | Check the service is running: | ||
| + | sudo systemctl status mw-jobqueue_gamewiki4.service | ||
| + | Follow the service log: | ||
| + | sudo journalctl -f -u mw-jobqueue_gamewiki4.service | ||
Revision as of 12:37, 4 January 2021
Let's see how to add a wiki number 4 for the game Among Us.
Login to the server
Open a SSH session:
ssh databank@videogamedatabank.com
Create a database
Login to MySQL:
sudo mysqlPlease follow the pattern gamewiki_N where N is the next number in the family.
CREATE DATABASE gamewiki_4;
Allow access to the database for the central database user:
GRANT ALL PRIVILEGES ON gamewiki_4.* TO 'gamewiki_0user'@'localhost' WITH GRANT OPTION;
Done!
exit
Prepare the environment
Create a symlink
Please use a simplified, URL friendly game name, eg. amongus for Among Us:
sudo ln -s /var/www/videogamedatabank.com/mediawiki /var/www/videogamedatabank.com/amongus
Add a rule for a Giant switch
sudo nano /var/www/videogamedatabank.com/mediawiki/LocalSettings.php
Find this line:
} else {
Insert this piece of code right before it:
} elseif ( strpos( $callingurl, '/amongus' ) === 0 ) {
require_once $customizationdir . '/LocalSettings_gamewiki4.php';
Create a separate directory for uploads
sudo mkdir /var/www/videogamedatabank.com/mediawiki/images_gamewiki4
sudo cp /var/www/videogamedatabank.com/mediawiki/images_gamewiki0/.htaccess /var/www/videogamedatabank.com/mediawiki/images_gamewiki4/.htaccess
sudo chown -R www-data: /var/www/videogamedatabank.com/mediawiki/images_gamewiki4
Copy configuration
Copy a standard per wiki config:
sudo cp /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/LocalSettings_{gamewiki0,gamewiki4}.php
Copy a custom per wiki config:
sudo cp /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/Special_{gamewiki0,gamewiki4}.php
Adjust: $wgSitename = "Among Us Wiki"; $wgScriptPath = "/amongus"; $wgUploadDirectory = "$IP/images_gamewiki4"; $wgUploadPath = "$wgScriptPath/images_gamewiki4"; $wgDBname = "gamewiki_4"; enableSemantics( 'amongus' ); require_once( 'Special_gamewiki4.php' );
Automate mediawiki job queue processing
Create a job runner
Copy the job runner script:
sudo cp /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mwjobrunner_{gamewiki0,gamewiki4}
Adjust it accordingly:
sudo nano /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mwjobrunner_gamewiki4
Example (adjusted lines are highlighted):
#!/bin/bash
MW_INSTALL_PATH=/var/www/videogamedatabank.com/mediawiki
RUNJOBS=$MW_INSTALL_PATH/maintenance/runJobs.php
CONFIG=$MW_INSTALL_PATH/extensions/wikivisor/LocalSettings_gamewiki4.php
echo Starting job service...
sleep 60
echo Started.
while true; do
echo Processing Among Us Wiki ...
php $RUNJOBS --type="enotifNotify" --conf $CONFIG
php $RUNJOBS --wait --maxjobs=50 --conf $CONFIG
echo Waiting for 10 seconds...
sleep 10
done
Symlink it to the system path:
sudo ln -s /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mwjobrunner_gamewiki4 /usr/local/bin/
Create a system service
Copy the system service definition:
sudo cp /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mw-jobqueue_{gamewiki0,gamewiki4}.service
Adjust it accordingly:
sudo nano /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mw-jobqueue_gamewiki4.service
Example (adjusted lines are highlighted):
[Unit]
Description=MediaWiki Job runner service - Among Us
[Service]
ExecStart=/usr/local/bin/mwjobrunner_gamewiki4
Nice=10
ProtectSystem=full
User=www-data
OOMScoreAdjust=200
StandardOutput=journal
[Install]
WantedBy=multi-user.target
Symlink it to the system path:
sudo ln -s /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/mw-jobqueue_gamewiki4.service /etc/systemd/system
Enable the service:
sudo systemctl enable mw-jobqueue_gamewiki4.service
Start the service:
sudo systemctl start mw-jobqueue_gamewiki4.service
Check the service is running:
sudo systemctl status mw-jobqueue_gamewiki4.service
Follow the service log:
sudo journalctl -f -u mw-jobqueue_gamewiki4.service
