[Edit][History] last modified May 6

Table of Contents

Checking in changes into Mercurial

Mercurial repository is setup at /1/pharos/repo on wiki-beta. For checking in changes:

$ hg push ssh://demo.openlibrary.org//1/pharos/repo

Some times it fails with some permission problems. Do the following on wiki-beta to correct it.

$ cd /1/pharos/repo
$ sudo chown -R anand:pharos .
$ sudo chmod -R g+w .

Push changes to staging

The code for staging server is at /1/pharos/code/staging. To update the staging server, new code has to be pulled from the repository.

$ cd /1/pharos/code/staging
$ hg pull
$ hg update

Do the following if you want to update the Infogami code.

$ cd /1/pharos/code/staging/pharos/infogami
$ hg pull
$ hg update

After that the server has to be restarted.

$ sudo svc -t /service/staging-service

Push changes to production

The code for production server is at /1/pharos/code/production.

$ cd /1/pharos/code/production
$ hg pull
$ hg update

Do the following if you want to update the infogami code. Make sure that the infogami changes are tested on the staging server before doing this.

$ cd /1/pharos/code/production/pharos/infogami
$ hg pull
$ hg update

After updating the production code, production fastcgi process needs to be restarted.

$ sudo svc -t /service/pharos-production-fastcgi

In case you want to restart production lighttpd:

$ sudo svc -t /service/lighttpd-service

If you screwed up and the site doesn't come back up, Python errors are in:

$ tail -f /service/pharos-production-fastcgi/log/main/current

and lighttpd errors are in:

$ tail -f /1/pharos/code/production/pharos/error.log

If things go really bad, errors will appear in readproctitle:

$ ps ax | grep readproc

Moving templates and macros from staging to production

Some times you may want to move all templates and macros from staging to production. There is a sync plugin to compare changes between staging and production. Go to http://demo.openlibrary.org:8080/sync. It shows the list of modified pages between staging and production. Look at diff and make sure the it the expected changes and push the changes to production. You can pull changes from production, if there is some change on production and not there on staging.

If there are any css and graphic changes, they must be copied manually.

$ cd /1/pharos/code/staging/pharos
$ cp -r static/css/* ../../production/pharos/static/css/*
$ cp -r static/images/* ../../production/pharos/static/images/*
$ cp -r static/logos/* ../../production/pharos/static/logos/*

Checking in templates, macros and graphics to repository

Regularly we keep moving the templates, macros and graphics to the repository. This is generally done from staging.

$ cd /1/pharos/staging/pharos

# move tempplates, macros, i18n strings to plugins/openlibrary
$ python run.py pull-templates

# move css and graphics
$ cp static/css/* plugins/openlibrary/files/css
$ cp static/logos/* plugins/openlibrary/files/logos

# checkin
$ cd plugins/openlibrary
$ hg status .
$ # preview modificatiions (hg status, hg diff)
$ # add new files if there are any
$ hg ci .
$ hg push

Mercurial Server

Mercurial server is run on port 9021. To restart mercurial server:

$ sudo svc -k /service/hg-service

PD Registry server

The code for PD Registry server is at /1/pharos/code/pdregistry.ca on wiki-beta.

If you want to update the code:

$ cd /1/pharos/code/pdregistry.ca
$ hg pull
$ hg update

The PD registry server runs at 127.0.0.0:8888 on wiki-beta and Lighttpd server rediercts all the requests coming to pdregistry.ca to that server.

If you want to restart pdregistry server:

$ sudo svc -k /service/pdregistry-service

Further doc on restarting servers

Some further help on restarting the servers are on the IA twiki at: twiki page. The info partially overlaps what is here. It is there partly for historical reasons and partly because it the twiki should still be available if the openlibrary site is down (which is when the restart instructions would be needed the most).