Difference between revisions of "Help:How to add new wiki to the farm"
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Let's see how to add a wiki number 4 for the game ''Among Us''. | + | == Initial setup == |
+ | Initially, there were four wikis configured on the farm: | ||
+ | {| class="smwtable-clean w-100" | ||
+ | !Number | ||
+ | !Request URI (Path) | ||
+ | !Sitename | ||
+ | !Interwiki | ||
+ | !Database | ||
+ | !Suffix | ||
+ | |- | ||
+ | |0 | ||
+ | |/w | ||
+ | |VGD Wiki Farm | ||
+ | |databank | ||
+ | |gamewiki_0 | ||
+ | |_gamewiki0 | ||
+ | |||
+ | |- | ||
+ | |1 | ||
+ | |/cyberpunk2077 | ||
+ | |Cyberpunk 2077 Wiki | ||
+ | |cyberpunk2077 | ||
+ | |gamewiki_1 | ||
+ | |_gamewiki1 | ||
+ | |||
+ | |- | ||
+ | |2 | ||
+ | |/minecraft | ||
+ | |Minecraft Wiki | ||
+ | |minecraft | ||
+ | |gamewiki_2 | ||
+ | |_gamewiki2 | ||
+ | |||
+ | |- | ||
+ | |3 | ||
+ | |/farcry6 | ||
+ | |Far Cry 6 Wiki | ||
+ | |farcry6 | ||
+ | |gamewiki_3 | ||
+ | |_gamewiki3 | ||
+ | |} | ||
+ | |||
+ | All wikis are powered by the single deployment of mediawiki located at <code>/var/www/videogamedatabank.com/mediawiki</code>. | ||
+ | |||
+ | ;Let's see how to add a wiki number 4 for the game ''Among Us''. | ||
== Login to the server == | == Login to the server == | ||
− | + | On Linux or Mac open a SSH session: | |
ssh databank@videogamedatabank.com | ssh databank@videogamedatabank.com | ||
+ | On windows use [https://www.putty.org/ '''putty'''] with the same username / server (port 22). | ||
== Create a database == | == Create a database == | ||
Login to MySQL: | Login to MySQL: | ||
− | |||
sudo mysql | sudo mysql | ||
− | |||
Please follow the pattern ''gamewiki_N'' where ''N'' is the next number in the family. | Please follow the pattern ''gamewiki_N'' where ''N'' is the next number in the family. | ||
<syntaxhighlight lang="mysql"> | <syntaxhighlight lang="mysql"> | ||
Line 66: | Line 109: | ||
Adjust custom config the similar way: | Adjust custom config the similar way: | ||
sudo nano /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/Special_gamewiki4.php | sudo nano /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/Special_gamewiki4.php | ||
+ | |||
+ | == Populate the database == | ||
+ | <div class="alert alert-warning"> | ||
+ | '''Attention!''' This procedure will make wiki family unaccessible for a couple of minutes. | ||
+ | </div> | ||
+ | Disable normal processing: | ||
+ | sudo mv /var/www/videogamedatabank.com/mediawiki/LocalSettings.php{,.off} | ||
+ | Navigate to: | ||
+ | https://videogamedatabank.com/amongus | ||
+ | and complete the install. | ||
+ | |||
+ | Please, use the name of database, name of wiki, and mysql user and password you specified earlier in <code>LocalSettings_gamewiki4.php</code>. | ||
+ | |||
+ | Download the auto-generated <code>LocalSettings.php</code> and save it somewhere for reference or for learning purposes. | ||
+ | |||
+ | Re-enable normal processing: | ||
+ | sudo mv /var/www/videogamedatabank.com/mediawiki/LocalSettings.php{.off,} | ||
+ | Update database: | ||
+ | sudo php /var/www/videogamedatabank.com/mediawiki/maintenance/update.php --conf /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/LocalSettings_gamewiki4.php | ||
+ | This will create / update tables based on the current set of extensions. | ||
== Automate mediawiki job queue processing == | == Automate mediawiki job queue processing == | ||
Line 124: | Line 187: | ||
Follow the service log: | Follow the service log: | ||
sudo journalctl -f -u mw-jobqueue_gamewiki4.service | sudo journalctl -f -u mw-jobqueue_gamewiki4.service | ||
+ | |||
+ | == Create Interwiki == | ||
+ | Pages of all wikis may be easily linked from the newly created ''Among Us Wiki'' by prefixes, for example, <code><nowiki>[[minecraft:Main Page|Minecraft]]</nowiki></code> will produce the link to the ''Minecraft Wiki'' main page: [[minecraft:Main Page|Minecraft]]. | ||
+ | |||
+ | To make it possible, navigate to [[Special:Interwiki]] as admin and add records for all wikis within the farm <ref>Of course, you may want to create an interwiki to absolutely '''any''' mediawiki deployment.</ref> | ||
+ | |||
+ | Click on ''Add an interwiki or language prefix'' and set a prefix, URL and forward rule. | ||
+ | |||
+ | {| class="smwtable-clean w-100" | ||
+ | !Prefix | ||
+ | !URL | ||
+ | !Forward | ||
+ | |- | ||
+ | |cyberpunk2077 ||https://videogamedatabank.com/cyberpunk2077 ||yes | ||
+ | |- | ||
+ | |minecraft ||https://videogamedatabank.com/minecraft ||yes | ||
+ | |- | ||
+ | |farcry6 ||https://videogamedatabank.com/farcry6 ||yes | ||
+ | |- | ||
+ | |databank ||https://videogamedatabank.com/w ||yes | ||
+ | |} | ||
+ | |||
+ | Then navigate to the respective ''Special:Interwiki'' of other wikis and add the ''Among Us'' prefix to all of them. | ||
+ | |||
+ | {| class="smwtable-clean w-100" | ||
+ | !Prefix | ||
+ | !URL | ||
+ | !Forward | ||
+ | |- | ||
+ | |amongus ||https://videogamedatabank.com/amongus ||yes | ||
+ | |} | ||
+ | |||
+ | == Include uploaded images into backup == | ||
+ | Open crontab schedule: | ||
+ | sudo crontab -e | ||
+ | Copy 16 lines related to any of sister wikis and paste '''before''' this line: | ||
+ | 50 6 * * * cd /root/gdrive && drive push -no-prompt -fix-clashes | ||
+ | Change suffixes as appropriates and adjust time as needed. | ||
+ | |||
+ | == References == | ||
+ | <references /> |
Latest revision as of 01:37, 5 January 2021
Initial setup
Initially, there were four wikis configured on the farm:
Number | Request URI (Path) | Sitename | Interwiki | Database | Suffix |
---|---|---|---|---|---|
0 | /w | VGD Wiki Farm | databank | gamewiki_0 | _gamewiki0 |
1 | /cyberpunk2077 | Cyberpunk 2077 Wiki | cyberpunk2077 | gamewiki_1 | _gamewiki1 |
2 | /minecraft | Minecraft Wiki | minecraft | gamewiki_2 | _gamewiki2 |
3 | /farcry6 | Far Cry 6 Wiki | farcry6 | gamewiki_3 | _gamewiki3 |
All wikis are powered by the single deployment of mediawiki located at /var/www/videogamedatabank.com/mediawiki
.
- Let's see how to add a wiki number 4 for the game Among Us.
Login to the server
On Linux or Mac open a SSH session:
ssh databank@videogamedatabank.com
On windows use putty with the same username / server (port 22).
Create a database
Login to MySQL:
sudo mysql
Please 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 and adjust 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
Open file in editor:
sudo nano /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/LocalSettings_gamewiki4.php
and adjust these guys:
$wgSitename = "Among Us Wiki";
$wgScriptPath = "/amongus";
$wgUploadDirectory = "$IP/images_gamewiki4";
$wgUploadPath = "$wgScriptPath/images_gamewiki4";
$wgDBname = "gamewiki_4";
enableSemantics( 'amongus' );
require_once( 'Special_gamewiki4.php' );
Adjust custom config the similar way:
sudo nano /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/Special_gamewiki4.php
Populate the database
Attention! This procedure will make wiki family unaccessible for a couple of minutes.
Disable normal processing:
sudo mv /var/www/videogamedatabank.com/mediawiki/LocalSettings.php{,.off}
Navigate to:
https://videogamedatabank.com/amongus
and complete the install.
Please, use the name of database, name of wiki, and mysql user and password you specified earlier in LocalSettings_gamewiki4.php
.
Download the auto-generated LocalSettings.php
and save it somewhere for reference or for learning purposes.
Re-enable normal processing:
sudo mv /var/www/videogamedatabank.com/mediawiki/LocalSettings.php{.off,}
Update database:
sudo php /var/www/videogamedatabank.com/mediawiki/maintenance/update.php --conf /var/www/videogamedatabank.com/mediawiki/extensions/wikivisor/LocalSettings_gamewiki4.php
This will create / update tables based on the current set of extensions.
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
Create Interwiki
Pages of all wikis may be easily linked from the newly created Among Us Wiki by prefixes, for example, [[minecraft:Main Page|Minecraft]]
will produce the link to the Minecraft Wiki main page: Minecraft.
To make it possible, navigate to Special:Interwiki as admin and add records for all wikis within the farm [1]
Click on Add an interwiki or language prefix and set a prefix, URL and forward rule.
Prefix | URL | Forward |
---|---|---|
cyberpunk2077 | https://videogamedatabank.com/cyberpunk2077 | yes |
minecraft | https://videogamedatabank.com/minecraft | yes |
farcry6 | https://videogamedatabank.com/farcry6 | yes |
databank | https://videogamedatabank.com/w | yes |
Then navigate to the respective Special:Interwiki of other wikis and add the Among Us prefix to all of them.
Prefix | URL | Forward |
---|---|---|
amongus | https://videogamedatabank.com/amongus | yes |
Include uploaded images into backup
Open crontab schedule:
sudo crontab -e
Copy 16 lines related to any of sister wikis and paste before this line:
50 6 * * * cd /root/gdrive && drive push -no-prompt -fix-clashes
Change suffixes as appropriates and adjust time as needed.
References
- ↑ Of course, you may want to create an interwiki to absolutely any mediawiki deployment.