Tech:Custom domains

This page is a how-to for setting up custom domains for wikis in nginx. This tutorial requires that you are able to edit the ansible-playbook (or able to edit your fork of it and push a pull request to master) and DNS access to the custom domain (the wiki owner should be able to do this, Orain won't manage custom domains). Please know that this is serious business, read this careful before doing any changes.

Process

 * 1) Identify the wiki which domain want to be changed. You only need it's DBname; look at Database list and find your dbname.
 * 2) Custom domains pointing to wikis can be set up in many ways. Like wiki.someproject.org/wiki, but also just someproject.org/wiki. This is very important ;
 * 3) The DNS records needs to be changed (Orain won't and can't buy a domain for you; you have to buy one yourself). A records or CNAME will be added/changed here. The value for the A/CNAME record will be "@" (root domain) or "[subdomain]" (like "wiki" for wiki.someproject.org), the CNAME should point to   (recommended, prod10 is the load balancer at the moment) or for A records,   (IP can be changed, be careful!);
 * 4) If the wiki owner wants the www-form to work as well, a CNAME record should point to the A/CNAME record;
 * 5) Okay, DNS is set up, but the domain doesn't work yet because MediaWiki still serves the wiki to [wikidb without wiki suffix].orain.org. Now we need to change the MediaWiki and nginx settings;
 * 6) You need a GitHub account to edit nginx/MediaWiki settings. In LocalSettings.php, the variables you need to change are $wgCentralAuthAutoLoginWikis, $wgServer and $wgUrlShortenerDomainsWhitelist - you can look at the already present entries in these variables so you know how to correctly add the domain name. Make sure to sort it in alphabetical order. When done, commit the file (on web, just save the file - GitHub will commit for you), and open the nginx sites-enabled file. Search for Line 15, and add the custom domain there (again, alphabetical order!) (if the DNS allows use of the www-form, add it here also, but be sure you create two separate (one with the www-suffix and one without) entries!) and commit the file;
 * 7) You are not done yet, though the biggest part is done now. Please check all your changes (you can use this pull request to verify the used syntax), and make a pull request including these changes to master. Are the edits now in the ansible-playbook? Verify the wiki works as expected. If not, revert your changes and look at any logs (or ask the sysadmins if you don't have access to such logs) what causes the problem;

Orain-hosted DNS
Since October 2014, Orain's DNS is hosted on self-hosted (instead of using CloudFlare) DNS servers, tech:prod6 and tech:prod7. As an unlimited amount of domains can be hosted with Orain's DNS servers, wiki founders may choose to host their domain's DNS with Orain. The process to do this is as follow:


 * 1) First of all, determine whether you want wiki.someproject.org or someproject.org. I (Southparkfan) will only tell you how to do this for "someproject.org".
 * 2) Add a file here with as filename "someproject.org" (replace this as appropriate), and copy the content of this file, and paste it in the other file. Replace "wikiconstitucion.org" with the actual domain name. Make sure the syntax of your file is correct. If you have commit access to the DNS repository, consider to make a pull request instead of directly committing your changes as ansible doesn't care about syntax errors when cloning new versions of the files; if the syntax of one file is incorrect, the DNS server will automatically shutdown itself and Orain will be down.
 * 3) Do steps 5-7 (you can find them above), and done.