User:Daveh/dev

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

Code Repositories[edit]

  • uesp.maps -- The source code of the various ES maps using the Google v3 map API.
  • uesp.wiki -- The slightly customized MediaWiki version the site uses including all standard extensions.
  • uesp.usereditcount -- A custom MediaWiki extension that displays the number of edits per user over a specific period.
  • uesp.metatemplate -- A custom MediaWiki extension that extends the Wiki template system.
  • uesp.uespcustomcode -- The site's MediaWiki extension that holds most of the site specific customization.
  • uesp.wikimap -- A MediaWiki extension for using the uesp.maps code inside the UESP wiki.
  • uesp.dailyedits -- A MediaWiki extension for displaying the number of edits per day on the wiki.
  • uesp.setup -- A variety of scripts and applications used for setting up a new server.
  • uesp.scripts -- A collection of various scripts used by the site.
  • uesp.searchlog -- A MediaWiki extension for logging the Wiki's search queries and displaying statistics on them.
  • uesp.cslist -- The CSList web front end to the game raw data.


Setting Up BitBucket[edit]

  • Create an account on BitBucket if you don't already have one
  • Create a ssh key on content3 if you haven't done so previously:
   ssh-keygen
  • Add your public key to BitBucket via their web interface.
  • Test that you can login to BB using the key:
   ssh -T hg@bitbucket.org
  • For troubleshooting ssh key access see here.


Setting Up Mercurial[edit]

Create a .hgrc file in your home directory that contains the following:

  [ui]
  username = Firstname Lastname <email.address@example.net>
  ssh = ssh -C

Ensure that this file is not readable to others (chmod o-r .hgrc).


Initialize a new repository from an existing source:

   cd /path/to/project/
   cp /somewhere/.hgignore ./
   hg init
   hg status
   hg add
   hg commit

Create a new local repository:

  hg init newrepo
  cp newrepo

Note that this only creates a new local repository. An admin will have to create the matching remote repository on BitBucket if you ever wish to push changes to it there.

To specific certain files to not automatically add to source control create the file .hgignore:

  syntax: glob
  *.obj
  debug/*
  syntax: regexp
  ^\.pc/

You can alternatively use a global ignore file by editing your ~/.hgrc file to include:

  [ui]
  ignore = ~/.hgignore

See the status of local files:

  hg status

Add a file to the local repository:

  hg add filename

Add all files from the current directory to the local repository:

  hg add

Commit changes to the local repository:

  hg commit -m 'message'

If you don't specify the -m or the message you will be prompted to enter one using your default editor (vim).

Push changes in your local repository to BitBucket:

  hg push ssh://hg@bitbucket.org/uesp/reponame

Change the reponame to the actual repository name. After you've pushed once you should be able to just do hg push.

To clone an existing repository from BitBucket:

  hg clone ssh://hg@bitbucket.org/uesp/reponame

This will create a new reponame sub-directory in the current directory containing the repository code.

To pull changes from BitBucket into your local repository:

  cp /path/to/localcode/
  hg pull -u 

If you receive an error message saying repository default not found! edit the file .hg/hgrc to include the following:

  [paths]
  default = ssh://hg@bitbucket.org/uesp/reponame/

If you clone from an existing remote repository this file and entry will be created for you.

To delete an existing file:

  hg remove filename
  hg commit -m 'deleted file'

Wiki Development and Deployment[edit]

This is a quick walk through of the current process one should take for making an edit to the wiki code. Note that this process is currently under development and is not entirely complete or accurate.

  • Retrieve the wiki source from Google Code (typically done on content3 but any uesp server can be used):
         cd ~
         hg clone https://code.google.com/p/uesp.wiki/ 
         cd uesp.wiki
Note that currently all extensions are included in the wiki code but eventually may be moved into their own repository.
  • Edit files in the cloned wiki source.
  • Deploy files to the dev server (currently content3):
        cd ~/uesp.wiki
        uespdeploy -S content3
  • Assuming a successful deployment, test the wiki on content3.uesp.net
  • Once your edits are working commit and push changes to the repository (push requires permission on Google Code to be set):
        cd ~/uesp.wiki
        hg commit -m "commit message"
        hg push
  • To deploy the wiki to all sites:
        cd ~/uesp.wiki
        uespdeploy
  • Test things to make sure nothing is broken on the live wiki
  • If you wish to edit the wiki source again make sure to check for updates from the remote repository from other developers:
        cd ~/uesp.wiki
        hg pull -u
  • Some other notes:
  • Never edit files directly in the wiki directory (/home/uesp/www/w/) as this leads to inconsistencies between servers.
  • All secrets (passwords, etc...) should be put into the appropriate file in /home/uesp/secrets/.
  • Most uesp related files and directories should have the group uespadmin and be group writable:
       sudo chown :uespadmin file
       sudo chmod g+rw file

Dev Wiki Deployment[edit]

Deploying to the dev wiki for testing is currently under development but the basic procedure is:

  • Deploy the wiki source to dev:
      cd ~/uesp.wiki
      uespdeploy -f devwiki.deploy

This will copy the current wiki source to the dev wiki and replace the default LocalSettings.php with the dev specific LocalSettings.php.devwiki. It will use the currently loaded dev-wiki database and images which are copies from the main wiki for testing purposes.

The process to update the dev-wiki with the current version of the wiki database and images is as follows:

  • Dump the existing wiki database (typically done on content3 so as to not interfere with the site):
     mysqldump --opt -u user -p uesp_net_wiki5 > wiki.sql
  • Copy the wiki database dump to the dev-wiki database on content3:
     mysql -u user -p uesp_net_wikidev < wiki.sql
  • Copy the wiki images to the dev-wiki:
     rsync -av /mnt/uesp/wikiimages/ /home/uespdev/www/w/images/