ProleWiki:Maintenance/Adding languages: Difference between revisions

From ProleWiki, the proletarian encyclopedia
(added apache and ssl cert info)
(Changing order of steps)
Line 5: Line 5:
*Go to our Namecheap account and add new A Record for the site, using the same configuration as the others, changing only the language code.
*Go to our Namecheap account and add new A Record for the site, using the same configuration as the others, changing only the language code.


===Step 2: Create new database for the site===
===Step 2: Add site domain to Apache vHost directive & reissue certificate===
The new language subdomain must be explicitly added to Apache for Let's Encrypt to detect it and issue the certificate with the correct SANs.
* Open <code>/etc/apache2/sites-enabled/prolewiki.conf</code> for editing. There are 3 places to add the new subdomain:
** The 1st and 2nd <code>ServerAlias</code> lines in the <code>VirtualHost</code> blocks for port :80 and :443.
** The <code>RewriteCond</code> lines in approximately the middle of the file.
* Add entries for the new subdomain so that the placemet, formatting, etc, match the existing entries.
* Run <code>apache -t</code> and look for anything worse than a <code>warn</code>, or anything likely to cause problems
* Run <code>certbot</code>
 
===Step 3: Create new database for the site===
<ul>
<ul>
<li> Open command <syntaxhighlight inline lang="bash">mysql</syntaxhighlight>
<li> Open command <syntaxhighlight inline lang="bash">mysql</syntaxhighlight>
Line 12: Line 21:
<li> Exit mysql by typing <syntaxhighlight inline lang="mysql">exit</syntaxhighlight>
<li> Exit mysql by typing <syntaxhighlight inline lang="mysql">exit</syntaxhighlight>
</ul>
</ul>
===Step 3: Add basic schema to database===
===Step 4: Add basic schema to database===


*Go to maintenance folder (<syntaxhighlight inline lang="bash">cd /var/www/prole/maintenance</syntaxhighlight>)
*Go to maintenance folder (<syntaxhighlight inline lang="bash">cd /var/www/prole/maintenance</syntaxhighlight>)
*Input the command <code>mysql prole_aa < /var/www/prole/maintenance/tables-generated.sql</code>
*Input the command <code>mysql prole_aa < /var/www/prole/maintenance/tables-generated.sql</code>


===Step 4: Add new site to site configuration===
===Step 5: Add new site to site configuration===


*Edit <code>/var/www/prole/LocalSettings.php</code>
*Edit <code>/var/www/prole/LocalSettings.php</code>
Line 56: Line 65:
</syntaxhighlight>
</syntaxhighlight>
*Save the file
*Save the file
===Step 5: Add site to sites table in database and update it===
===Step 6: Add site to sites table in database and update it===
*Go to <code>/var/www/prole/maintenance/</code>
*Go to <code>/var/www/prole/maintenance/</code>
*Input the following:
*Input the following:
Line 74: Line 83:
php update.php --wiki <wiki-id> --quick
php update.php --wiki <wiki-id> --quick
</syntaxhighlight>
</syntaxhighlight>
===Step 6: Add site domain to Apache vHost directive & reissue certificate===
The new language subdomain must be explicitly added to Apache for Let's Encrypt to detect it and issue the certificate with the correct SANs.
* Open <code>/etc/apache2/sites-enabled/prolewiki.conf</code> for editing. There are 3 places to add the new subdomain:
** The 1st and 2nd <code>ServerAlias</code> lines in the <code>VirtualHost</code> blocks for port :80 and :443.
** The <code>RewriteCond</code> lines in approximately the middle of the file.
* Add entries for the new subdomain so that the placemet, formatting, etc, match the existing entries.
* Run <code>apache -t</code> and look for anything worse than a <code>warn</code>, or anything likely to cause problems
* Run <code>certbot</code>
** To do: add more detailed certbot notes ''Comrade [[Comrade:KakumeiAshley|KakumeiAshley]]'' <sup>([[Comradeship:KakumeiAshley|talk]])</sup> 02:06, 9 August 2022 (UTC)

Revision as of 18:14, 28 March 2024

Here we will be following a step-by-step tutorial on how to add new languages to ProleWiki. We will use a non-existent "aa" language code as an example, but it should be changed to the language that is being included (e.g.: en for English, fr for French, ru for Russian, etc.). We can check the existing language on Wikipedia as a reference for its language code.

Step 1: Create new A Record for the site

  • Go to our Namecheap account and add new A Record for the site, using the same configuration as the others, changing only the language code.

Step 2: Add site domain to Apache vHost directive & reissue certificate

The new language subdomain must be explicitly added to Apache for Let's Encrypt to detect it and issue the certificate with the correct SANs.

  • Open /etc/apache2/sites-enabled/prolewiki.conf for editing. There are 3 places to add the new subdomain:
    • The 1st and 2nd ServerAlias lines in the VirtualHost blocks for port :80 and :443.
    • The RewriteCond lines in approximately the middle of the file.
  • Add entries for the new subdomain so that the placemet, formatting, etc, match the existing entries.
  • Run apache -t and look for anything worse than a warn, or anything likely to cause problems
  • Run certbot

Step 3: Create new database for the site

  • Open command mysql
  • Type in CREATE DATABASE prole_aa;
  • Give permission to database user by typing GRANT ALL PRIVILEGES ON prole_aa.* TO 'proledbuser'@'localhost';
  • Exit mysql by typing exit

Step 4: Add basic schema to database

  • Go to maintenance folder (cd /var/www/prole/maintenance)
  • Input the command mysql prole_aa < /var/www/prole/maintenance/tables-generated.sql

Step 5: Add new site to site configuration

  • Edit /var/www/prole/LocalSettings.php
  • Add the following lines where there are similar ones, and before the "language selector":
elseif (isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] == 'aa.prolewiki.org') {
    $wikiId = 'aa';
}
  • Add this code block where there are similar ones like it, changing the options to the target language:
elseif ($wikiId == 'aa') {
	$wgServer = "https://aa.prolewiki.org";
	$wgDBname = "prole_aa";
	$wgLanguageCode = 'aa';
	$wgLogo = "/resources/assets/prolewiki_logo_aa.png";
	$wgExtraNamespaces = [
		NS_LBRY => 'Library',
		NS_LBRY_TALK => 'Library_talk',
		NS_ESY => 'Essay',
		NS_ESY_TALK => 'Essay_talk',
		NS_USER => 'Comrade',
		NS_USER_TALK => 'Comradeship',
		NS_QUOTE => 'Quotes',
		NS_QUOTE_TALK => 'Quotes_talk'
	];
	$wgMatomoIDSite = "X";					// Change to Matomo site
	$wgMetaNamespace = "ProleWiki";					// Only necessary for wikis which use a different alphabet
	$wgSitename = "ProleWiki";						// Same as above
	$wgNamespaceAliases['ProleWiki'] = NS_PROJECT;	// Same as above, leaving this as it is as a Latin alphabet fallback for the ProleWiki: namespace
	$wgWikiSeoDefaultImage = '/resources/assets/seo/seo_aa.png';
	$wgPageImagesOpenGraphFallbackImage = "/resources/assets/seo/seo_aa.png";
	// Wikibase
	wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
	require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";
	$wgWBClientSettings['siteGlobalID'] = 'aa';
}
  • Save the file

Step 6: Add site to sites table in database and update it

  • Go to /var/www/prole/maintenance/
  • Input the following:
php addSite.php aa prolewiki --wiki shared --pagepath=https://aa.prolewiki.org/wiki/\$1  --filepath=https://aa.prolewiki.org/\$1 --language aa --interwiki-id aa
  • This should be done for all wikis. To do that, you should use:
php exportSites.php --wiki shared sites.xml
  • Then you import it for every wiki using (where wiki-id is de, en, es, fr, pt, ru, aa, etc.):
php importSites.php --wiki <wiki-id> sites.xml
  • Update all databases (where wiki-id includes shared as well:
php update.php --wiki <wiki-id> --quick