Managing Development in GroupServer and E-Democracy
GroupServer is a mature open source project which uses a full set of tools for managing development.
- 1 Buildout
- 2 Code Repositories
- 3 Issue Tracking
- 4 Deployed Eggs Server
- 5 Editing Eggs
- 6 Dev Server
- 7 Production Deployment
GroupServer uses Buildout for building (both production and development), retrieving code, and managing development. If you have never used Buildout before, this 15 minute video provides an introduction. Documentation is at http://www.buildout.org/docs/index.html.
To use Buildout you will need setuptools. On Ubuntu, install setuptools via
sudo apt-get install python-setuptools
GroupServer and E-Democracy use a number of Buildout config files to manage building an instance and developing code.
The main config file for Buildout. This is what Buildout looks to for directions. In GroupServer, buildout.cfg indicates what core eggs should be installed from GroupServer and from third parties. It also indicates which configuration sections should run, and defines a few.
Refers to additional eggs developed for projects downstream from GroupServer. This which custom eggs should be installed, as well as which versions of those eggs. In general, anything written specifcally for E-Democracy will be referred to in this file.
Contains a list that tells Buildout how to retrieve the source for an egg. Every egg from GroupServer and E-Democracy should have an entry in here indicating the address to that egg's repository, and version control tool used on that repository.
Technically, this isn't a Buildout file. It is a file used by Mr. Developer, a Buildout extension.
This controls which version of a core egg Buildout will retrieve and build. Most core eggs will have an entry in this file that pins the egg to some version. Some 3rd party eggs will also have their versions pinned by this file.
Managing the Buildout Files
The above files need to be updated whenever a new egg is created or a new version of an egg is deployed. Because the above files are critical to building and developing GroupServer and E-Democracy, and they are updated pretty often, a repository has been created on Github to keep E-Democracy's developers' Buildout files up to date.
Assuming you've followed the instructions for Installing GroupServer and E-Democracy, you should already have a git repository setup for the Buildout files on your instance.
To update the Buildout files, simply run
git pull in the root folder of your E-Democracy instance.
If you make a change to any of the Buildout files, simply do a
git add .,
git commit, and
git push to publish those changes.
Building GroupServer/E-Democracy is one of the two things you will most often do with Buildout (checking out code for active development is the other, and is covered below.)
To build E-Democracy and Groupserver, simply run the following from the root folder of your instance of E-Democracy:
E-Democracy and GroupServer use a few repository locations and tools for storing code. The differences in location and tools roughly correspond to the division between E-Democracy specific code and GroupServer code.
source.iopen.net - Mercurial
Eggs that are part of GroupServer core almost always start with either 'gs' or 'Products'.
Github - Git
In general, any new eggs created by E-Democracy will have its repository stored on Github. These eggs will almost always start with 'edem'.
source.iopen.net - Mercurial
Some E-Democracy code is stored at https://source.iopen.net/ogn/edem and uses Mercurial for version control. Eggs with repositories here usually were created by OnlineGroups.Net (OGN) when E-Democracy would contract with OGN to write custom code.
Of the eggs which have repositories on source.iopen.net, the most important is gs.skin.ogn.edem (which is an E-Democracy egg despite starting with 'gs').
Registering for Repository Access
In order to commit code to either GroupServer's or E-Democracy's repositories on source.iopen.net, you will need to register an account on the site. Once you have registered, email techteam [at] e-democracy.org to confirm your registration (you will not be able to commit until confirming registration).
For E-Democracy's repositories on Github, you can either request permission to commit to the repository(ies) by emailing techteam [at] e-democracy.org, or you can fork the repository of interest and send us a pull request.
Setting up SSL for Mercurial Repositories
Because iopen.net's SSL certificate is not signed by a certificate authority, Mercurial will default to displaying an error when trying to send or receive code from the repositories on source.iopen.net. This can be prevented by adding the following to ~/.hgrc:
[hostfingerprints] source.iopen.net = CE:CC:DF:DF:E6:32:89:E3:8A:CD:0B:A1:8F:15:FC:B7:0A:AC:23:D3
Because GroupServer and forums.e-democracy.org run on code that spans 100+ modules/repositories, both projects maintain project level Redmine instances for issue tracking/ticketing. The vast majority of tickets should be submitted to one of the Redmine instances below.
For non-GroupServer projects (e.x. edemsignups) it is much more likely that we will use an issue tracker associated directly with the project's repository.
There are two instances of Redmine to be aware of:
- E-Democracy Redmine -https://redmine.iopen.net/projects/edem - Tickets related specificly to forums.e-democracy.org. Most problems that you encounter will probably become tickets in here.
- GroupServer Redmine - https://redmine.iopen.net/projects/groupserver - Tickets related to the GroupServer platform. In general, it is best to ask about your problem in the GroupServer Development group before submitting a ticket here.
Because iopen.net's SSL certificate is not signed by a certificate authority, you will probably see a warning from your browser about the site's certificate. This is entirely normal, and you should disregard this warning.
You will need to register an account on redmine.iopen.net. Once you have registered, you will also need to email techteam [at] e-democracy.org so we can confirm your registration.
Estimating Project Time Requirements
GroupServer's Redmine includes a couple of useful advice pages. https://redmine.iopen.net/projects/groupserver/wiki/TimeEstimation provides a great guide on how to estimate the amount of time a certain programming task will take (assuming design and specs are already established.)
Deployed Eggs Server
The source repositories for eggs are outlined above. These, however, are not where Buildout fetches eggs from during a build.
Buildout instead fetches eggs from http://eggs.iopen.net/groupserver/, a server that hosts deployed versions of eggs. Deployed GroupServer eggs can be found in http://eggs.iopen.net/groupserver/base/, while E-Democracy eggs can be found in http://eggs.iopen.net/groupserver/custom/.
The code for eggs involved in a build can not be directly edited. Instead, there is a process for managing the editing of eggs.
Checking out Existing Eggs
In order to edit the eggs used in E-Democracy and GroupServer, you need to explicitly check out the egg for editing. This is done by running the following command from the root folder of your E-Democracy instance:
./bin/develop co <EGG NAME>
Doing this will cause Mr. Develop to fetch and place a folder in the src/ directory of your instance of E-Democracy that contains a version controlled repository for the egg's code. This will also tell Buildout to use the code in src/ for that egg during a build instead of the version of the egg specified in versions.cfg or custom.cfg. This, however, does not actually cause a rebuild to occur, so you will need to a
Once checked out, changes to the egg's files in src/ will be reflected in your instance of E-Democracy Generally, changes to templates will be reflected immediately, while changes to source files will require a restart of Zope.
Pushing and Pulling Code Changes
Since the folders fetched by Mr. Develop are version controlled (with master repository's URL defined in develop.cfg), you simply use Mercurial or Git (depending on the egg) to manage changes to the code. If you know how to pull, add, commit, and push with these, then you're set.
Deploying a new Version of an Egg
Once you have written code that is ready to be used by others, you are ready to deploy a new version of the egg you have been working on. Doing this will package up and upload a new version of the egg to the Deployed Eggs Server described above.
In order to deploy eggs to the Deployed Eggs Server, you need to have a copy of fabfile.py in the root folder of your E-Democracy instance. If you do not have this file, contact techteam [at] e-democracy.org to get a copy.
To actually deploy a new version of an E-Democracy egg, run the following command in the root folder of your E-Democracy instance:
If the egg you are deploying a new version for is a GroupServer core egg, then run this instead:
When the deployment finishes, it will provide a version string for the newly deployed version in the format <EGG NAME> = <VERSION>. For existing eggs, overwrite the egg's entry in versions.cfg or custom.cfg with this version string. For new eggs, add this string to versions.cfg (if a new GroupServer core egg) or custom.cfg (if a new E-Democracy egg), and add the egg's name to the list of eggs to include during a build in either buildout.cfg (for GroupServer core) or custom (for E-Democracy). Then [#Managing_the_Buildout_Files push out these changes to the Buildout config files].
Un-check out Egg
Once you have pushed changes, deployed a new version of an egg, and updated Buildout's config files, it is time to tell buildout to stop using the code in src/ for the egg in question. To deactivate checked out code, run the following command from the root folder of your E-Democracy instance:
./bin/develop d <EGG Name>
The egg's source will still be in src/, but it will no longer be referenced during a build. If you prefer a clean src/ directory, feel free to delete an egg's folder from src/ after you have deactivated it.
Create a New Egg
Creating a new egg involves creating a new repository on source.iopen.net or Github, adding its info to the Buildout config files, copying files into the new egg, and setting the basic configuration of the egg.
GroupServer also provides a page describing how to create a new egg. The process described by GroupServer is a bit different than the one described below, but also includes a lot more detail.
Create a new Repository
If you're creating a new E-Democracy egg, create a new repository on Github. If you're creating a new GroupServer egg, create a new repository on source.iopen.net. In both cases, copy the URI for the new repository, you'll need that for the next step.
Update the Buildout Config Files
Open develop.cfg and a line for the new egg under [sources]. This new line should include the name of the new egg, the tool used for version control (hg or git), and the URI from above. Save and close.
If the new egg is an E-Democracy egg, add the egg's name to custom-zope-eggs section of custom.cfg. If the new egg is a GroupServer egg, and the egg's name to the zope-eggs section of buildout.cfg. Save and close.
Now git add ., git commit, and git push.
Copy Files into the New Egg
Once the Buildout config files have been updated, check out the egg.
In the src/ folder you should find two empty_egg folders. These are templates for new eggs - one for eggs stored in git and one for eggs stored in mercurial. Copy the contents of the appropriate folder and paste them into the newly checked out repository folder.
Set Basic Configuration
In the folder for your new egg, edit setup.py. In the call to setup, a number of arguments need to be changed, including:
- name - This should be the same as your egg's name
- classifiers - Pay attention to Development Status
- namespace_packages - This need to reflect the hierarchy. For example, in the case of edem.group.messages.topics, namespace_packages should be set to "['edem', 'edem.group', 'edem.group.messages']". The final directory is supposed to be missing; it is a normal package, not a namespace package.
- install_requires - Set this to just 'setuptools' for now. As time goes on, add other eggs that the new egg depends on.
Save and close.
Next, create the file structure represented by your egg's name. For example, the egg edem.group.messages.topics should have the folder structure edem/group/messages/topics. In each namespace folder (in this case, edem, group, and messages), make a copy of a special __init__.py that is included in the egg template.
Next you need a __init__.py in the actual package (module) directory. Just enter the following into the module directory __init__.py
# coding=utf-8 # This space deliberately left blank
Finally, create a basic configure.zcml in your module directory. Enter the following into configure.zcml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
xmlns:browser="http://namespaces.zope.org/browser" xmlns:five="http://namespaces.zope.org/five" i18n_domain="groupserver">
Basic configuration is done. Commit your changes, cd back up to the root folder of your E-Democracy instance, and do a
./bin/buildout -N. Your instance of E-Democracy should not be running the egg you have just created (which does nothing.)
DB is updated regularly via cron based on a backup of the live db
can ssh in: deploy@ or root@
dev.forums.e-democracy.org needs to have your public key
Deploying eggs to this server
Just email version strings to firstname.lastname@example.org .
Send this email by Friday night (central time).