Archive for the ‘rapache’ Category
Eagle resting on Ibex’s shoulder
Just a notice to announce that Rapache Early Eagle just got into Intrepid Ibex’s Universe repository.
Feel encouraged to give it a spin :).
Rapache PPA updated to the last beta
The Rapache development team is happy to announce the immediate availability of latest Rapache beta release on the Rapache PPA.
Please see this post for more infos on the new features.
To add the PPA insert the following lines in your /etc/apt/sources.list:
deb http://ppa.launchpad.net/rapache-devel/ubuntu hardy main deb-src http://ppa.launchpad.net/rapache-devel/ubuntu hardy main
Then issue the following commands:
sudo apt-get update sudo apt-get install rapache
At this point the Rapache icon will appear inside Applications >> System Tools.
This release brings many improvements and you’re encouraged to test it and report any bug.
We can be contacted in the following ways:
- in #rapache-devel, on freenode.
- on the mailing list (rapache-devel@lists.launchpad.net)
You are also welcome to request new features / new plugins. We will read and evaluate everything, just file your request as a bug in launchpad.
Many thanks to emgent for the swift packaging response.
Early Eagle taking off
It’s been a while since I blogged about Rapache. Hell, I didn’t even mentioned that Rapache 0.6 made it in Intrepid repositories and in Hardy backports!
I am happy to say 0.7 release is coming soon. The codename for this release is early eagle, but don’t fear it’s unlikely we will stick with Ubuntu’s naming convention, and, if we do, we won’t come up with.. ehm.. Jackalopes. Promise !
This release marks the half way beetwen the proof of concept-ish rapache and the full featured version (which will have - most notably - ssh capabilities).
Major points for this release are:
Reworked UI
The edges of the user interface has been rounded a little.
- most notably: the “Virtualhost Editor” window is very polished and has not anymore horizontal tabs.
- Virtualhost and Module editors have a link to the respective online documentation. This is something very simple to implement, yet much needed.
Plugins for more advanced capabilities
Rapache enjoys now a handful plugins to let you perform common tasks easily:
- the advanced tab lets you configure less often needed things like the server admin e-mail, the custom error log location (along with the error log level), enable or disable apache’s directory listing and to setup your own default documents policy.
- the basic security plugin it’s basically an interface to the basic_auth module of Apache. This is simple but incredibly handy, you can quickly set up an access list (namely creating users and assigning a password to them) to any virtualhost. Useful for disabling or enabling access to any virtualhost with a click or to restrict the access to a given site without having to resort to any server-side technology other than Apache.
- SSL ! We provide a Gui to quickly set-up an https:// enabled Virtualhost. Certificate Request creation is provided and even certificates self signing is available. It takes 5-6 clicks to be in business with Apache+SSL
- We now store last 20 backups of every virtualhost you edit within Rapache. That means that if something goes wrong, you can quickly restore the previous version.
- You can also now edit the virtualhosts source at hand and save it directly from Rapache. You will enjoy syntax highlighting as you deserve (hey, everyone deserves syntax highlighting).
Apache status
- Rapache now shows Apache’s status changing its own icon color. So you can see at a glance if Apache is up or not.
- We put some new item in the menu bar to allow users to start/stop/restart Apache.
- The new “Log Files” tab allows the user to quickly browse the logs.
- Every error you get on Apache restart will be shown to the user inside a tab in the main window.
That’s it with the features.
How to get it:
The new dependencies are: python-crypto and python-lxml. After installing those, just check it out from the Rapache’s branch on launchpad.
sudo apt-get install python-crypto python-openssl python-lxml sudo apt-get install python-glade2 python-gnome2-extras sudo apt-get install python-gtk2 python-gtksourceview2 gksu bzr branch lp:rapache cd rapache ./rapache
Please report any dependency issues you encounter.
What’s next ?
We will soon be putting Rapache in the PPA to let you get it from there. As early eagle is not yet released, we welcome anyone willing to test it to download it and report bugs.
We are also looking for non-debian contributors interested to see Rapache run on their distribution of choice. If you are amongst them, please get in touch.
We can be contacted:
- in #rapache-devel, on freenode.
- on the mailing list (rapache-devel@lists.launchpad.net)
Also, here’s the Rapache project homepage.
Big thanks !
To Jason for doing so much work! To Qense for helping out with bugs and QA.
Sorry !
No EULA available yet. ![]()
A new parser for Rapache
Writing a parser for Apache configuration files presented many interesting challenges. Along with the third rewrite of the parser (which shouldn’t considered ’stable’ yet, anyway) we tried to fullfill our need of having a more powerful API and managed to make the new API quite pythonic.
I thought I’ll just post a little tutorial I wrote for it, in the case someone is interested in something like that.
Warning: lots of grammatical errors down there. Late night writing
Warning !!: long and boring post.
Rapache Parser
The parser is currently in RapacheCore.LineElement. A rename will happen soon.
Loading a file
In this tutorial we’ll work mostly on this file:
ServerAlias www.example.com
ServerAlias www.example.net
ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
ErrorDocument 410 /error/HTTP_GONE.html.var
ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
<VirtualHost *>
ServerName example.org
DocumentRoot /var/www/example.org/httpdocs
ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
ErrorDocument 666 /error/HTTP_FORBIDDEN.html.var
ErrorDocument 666 /error/HTTP_NOT_FOUND.html.var
</VirtualHost>
Let’s instance the parser and load the file:
>>> from RapacheCore.LineElement import Parser >>> p = Parser() >>> p.load ( 'tests/datafiles/errordocuments.conf' )
Basics
The parser instance:
>>> print p <RapacheCore.LineElement.Parser object at 0x822256c>
The parser allows searching for directives and sections by its attributes. Every attribute (but .lines, .sections, .value and .opts) returns a selection object.
>>> print p.ErrorDocument <RapacheCore.LineElement.PlainSelection object at 0x825ee2c>
It is case insensitive, by the way
>>> print p.errordocument <RapacheCore.LineElement.PlainSelection object at 0x826faec>
2 specialized selections also exist: .lines and .sections. Everyone of these contains all the lines/sections to be found in the global scope of the loaded file.
>>> len ( p.lines ) 21 >>> len ( p.sections ) 1
Selections
A selection is an iterable object, which allow iteration on the group of lines/sections it rappresents.
For example p.ErrorDocument will return a selection of all the ErrorDocument directives in the global scope of the configuration file.
>>> print len (p.ErrorDocument) 17
Direct access is also allowed.
>>> print p.ErrorDocument[0] <RapacheCore.LineElement.Line object at 0x8273aac> >>> for line in p.ErrorDocument[0:3]: print line <RapacheCore.LineElement.Line object at 0x82789ac> <RapacheCore.LineElement.Line object at 0x82789cc> <RapacheCore.LineElement.Line object at 0x827888c>
Lines
Every directive is reppresented by a Line object.
line = p.ServerAlias >>> line.value 'www.example.net' >>> print line.key ServerAlias >>> print line.opts <RapacheCore.LineElement.Options object at 0x8273d2c>
The opts attribute treats the value as a list of sub-values separated by a space. It’s an iterable object, you can convert it easily to a list and you can set it from a list or a tuple.
>>>print list(line.opts) ['www.example.net'] >>> line.opts = "test.example.net", "beta.example.net", "www.example.net" >>> print line.opts <RapacheCore.LineElement.Options object at 0x827366c> >>> print list(line.opts) ['test.example.net', 'beta.example.net', 'www.example.net'] >>> print line.value test.example.net beta.example.net www.example.net >>> print line.opts[0] test.example.net
You can as well delete elements from .opts as you’d do with a normal list and so on.
Selections meet lines
Every selection object also support the Line interface. .value .key and .opts will work, and will refer to the last line in the selection (given that last line wins in apache configuration files this seems the best policy)
>>> print p.ErrorDocument.value 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
You still can access the other lines as you would with list items
>>> print p.ErrorDocument[0].value 400 /error/HTTP_BAD_REQUEST.html.var
Creating a new line is as easy as specifying a new value for a non existing directive. (if the directive already exists it will just be overwritten)
>>> len(p.lines) 21 >>> p.fakeline.value = 'sdoij' >>> p.fakeline.value 'sdoij' >>> len(p.lines) 22
As affirmed before, trying to create a directive that already exist will just overwrite the last existing line.
>>> len(p.lines) 22 >>> p.ServerAlias.value = "www.example.org" >>> len(p.lines) 22
As a possible exception to the ‘whatever you do on a selection, it’ll affect the last line in that selection’ rule, deleting a selection will erase all the lines pertaining to it.
>>> len( p.ServerAlias ) 2 >>> del p.ServerAlias >>> len( p.ServerAlias ) 0
To be able to delete individual lines, just specify their index:
>>> len ( p.ErrorDocument ) 17 >>> p.ErrorDocument[-1].value '506 /error/HTTP_VARIANT_ALSO_VARIES.html.var' >>> del p.ErrorDocument[-1] >>> len ( p.ErrorDocument ) 16 >>> p.ErrorDocument[-1].value '503 /error/HTTP_SERVICE_UNAVAILABLE.html.var'
Searching
As not every directive in Apache configuration files is meant to be unique (ErrorDocument for example), searching may be necessary.
You can search using the .search() method, specifying a list of searched options as parameters.
The search will return a Selection so quite everything valid for selections (iterating, last line wins, etc) will be valid for search result
>>> len( p.ErrorDocument.search([404]) ) 1 >>> p.ErrorDocument.search([404]).value '404 /error/HTTP_NOT_FOUND.html.var'
It’s possible to search for just the second option, just specify None as the first option
>>> p.ErrorDocument.search([None, '/error/HTTP_NOT_FOUND.html.var']).value '404 /error/HTTP_NOT_FOUND.html.var'
You can modify the value of the searched lines easily:
>>> p.ErrorDocument.search([404]).opts = [404, '/error/NEW_ERROR.html.var'] >>> p.ErrorDocument.search([404]).value '404 /error/NEW_ERROR.html.var'
As an exception, deleting all the found lines requires the use of the delete() method.
>>> p.ErrorDocument.search([404]).delete() >>> len( p.ErrorDocument.search([404]) ) 0
Sections
A section is a part of the config file enclosed in some <TAG></TAG>. Every directive or sub-section inside a section is not accessible from the outscope selections. (i.e.: p.ErrorDocument won’t return the entries inside a <VirtualHost>).
You can get a selection of sections in the very same way you access lines. Also, the sections behave the precise same way as the Parser class.
>>> len( p.VirtualHost ) 1 >>> len( p.VirtualHost.ErrorDocument ) 6
Sections also implement the Line interface, which means you that expose .key,.value and .opts attributes you can manipulate
>>> print p.VirtualHost.key VirtualHost >>> print p.VirtualHost.value *
While sections are deletable the exact same ways as line, they you can’t create the same way you do with lines.
p.Directory.value = ”/var/www”, for example, would create a line “Directory /var/www” and not a full section, and that will cause Apache to complain on the next restart. That’s because the parser has no way to know that you want to create a section.
To create a section, you should use the following code:
>>> v.sections.create( 'VirtualHost', '*:80') >>> p.sections.create( 'VirtualHost', '*:80') <RapacheCore.LineElement.Section object at 0x8260f2c> >>> p.VirtualHost.get_as_str() '<VirtualHost *:80>\n</section>\n'
Getting/Setting the content
You can get and set the config file into the parser not only via load() but also passing in a list or string.
- p.set_from_str( string ) : sets the content from a string
- p.set_from_list( list ) : sets the content from a list of individual lines
- p.get_as_str() : returns content as a string
- p.get_as_list() : returns content as a list containing individual lines
Syntax Highlightining in Python
Working on Rapache, it’s been a while I wanted to add syntax highlightining, but I didn’t dare too loose time on a “side feature” like that. Last night though, Jason came in chat, and pasted me the code to do that straight away. That was nice, I only needed to paste that code in the source and make little adjustments.
Some little glitches arose though, so I eventually had to work a little more on it. I just thought I’d share what I had to do with other people.
My problems:
- I had to put together a language definition for Apache config files, since no one currently exists
- I had to find out how to read if from a non system dir (ie. from my program data directory)
This is the Apache .lang file (needs more love, but that’s a start) ended up with.
Here’s the code:
import gtksourceview2
custom_langs_path = '/home/myuser/mydir/datafiles'
bufferS = gtksourceview2.Buffer()
manager = gtksourceview2.LanguageManager()
manager.set_search_path( [ custom_langs_path ] + manager.get_search_path() )
language = manager.get_language('apache')
bufferS.set_language(language)
bufferS.set_highlight_syntax(True)
sourceview = gtksourceview2.View(bufferS)
sourceview.set_show_line_numbers(True)
#TODO sniff gnome default monospace font
sourceview.modify_font(pango.FontDescription("monospace 10"))
This is how the final result looks like:
Everything looks nicer now ! ![]()
Rapache by night
It’s been a while from the last post about Rapache. So I thought time has come to make our last progresses public.
For those who doesn’t know Rapache is a GTK utility that tries to ease the configuration of Apache on Debian alike systems.
This night was a long night :). It’s 6.48am here, so I’ll just get to the point: features !
Not so fast, baby !
- Thanks to Qense, Rapache now detects if Apache is not installed and refuses to run.
What’s new in the Main window
- Rapache now features two handy buttons, one to open a VirtualHost URL in the default browser and one to browse the DocumentRoot folder with Nautilus
- We moved the problem handling (for now just virtualhost not conforming to debian guidelines) in a separate tab, which appears only when its needed.
Edit window completely redesigned
- This guy, other than helping tremendously in other parts of the software, completely redesigned the VirtualHost creation window
- Rapache now allows to specify any number of aliases to be associated with the virtual host.
We has modulez !
- Module enabling/disabling was put in place. Things are not perfect, but works nicely.
- Many modules show a brief description just under the module name. I love this one :-).
- We also detect the dependencies (and that work is misspelled in the screenshot above and in the actual program - deep apologies) of every module.
- Modules .conf files editing is in the works. Not available at the moment, sorry !
How to get it
Beware, this is still an alpha release and it took a fair amount of refactoring, so you’re likely to find little glitches here and there. Despite of that, we are likely to package it today or tomorrow on our PPA. If you’re not prone to wait, you can check it out right now with bzr:
#install bazaar if you don't already have it sudo apt-get install bzr #to get rapache bzr branch lp:~rapache-devel/rapache/rapache-stage0 #to launch it cd rapache-stage0 ./rapache
If you prefer to wait to get the old version from the repository and just wait for updates you can add these lines to your repository list and then:
#install it sudo apt-get install rapache #run it rapache
Lending an hand
You can always lend us an hand.
- If you’re interested in the project, just checkout the Launchpad Page, or drop to say hi in #rapache-devel on freenode. Feel free to branch the last revision, play with it and propose it for merge.
- If you have any suggestion please open a bug in launchpad, we’d love to hear from you !
- Let you friends know about the project, this could help us get some contributors. Digg or share the link of this page and/or project page, or post it in your favourite forum.
Hitting the duck
It’s been 2 busy days. I didn’t really expected to receive any response on my previous post about Rapache and that was cool. Some of the received suggestion have beenĀ already implemented, so, if you’re still interested in Rapache, pull it from stage0 branch and check it out.
Shhht! Don’t tell anyone, the secret command to get the code is:
bzr branch lp:~rapache-devel/rapache/rapache-stage0
Some people asked how to help.
Well, the first way to help is to open new bugs (even for feature requests, just open a bug and explain your idea). You can do it at https://launchpad.net/rapache .
The second way is actually… to solve bugs, or indicate a way to solve them. I’ve tagged a bunch of them as ‘need-help’. You cand find them here: https://bugs.launchpad.net/rapache/+bugs?field.tag=need-help. For this kind of bugs, we don’t need a full patch, you can just send a proof of concept indicating how to solve the bug. That would save us a nice amount of googling :-).
I forgot to say: thank you thank you thank you.
Thank you thank you thanks to you all for having told me that rapache gui sucked. Shame on you :-). I tried to re-organize the main window at the best of my skills. We also had to wake up Luana and ask her to revamp our application icon.
Here is the result of all the effort:
As you can see Rapache can now take care of vhost definitions only present into /etc/apache2/sites-enabled and not present inside sites-available (the correct way would be to create the vhost configuration file inside sites-available and then link to it from sites-enabled in order to enabling it).
How do Rapache and Ubuntu relate ?
My very first aim with Rapache was to help webdev beginners and webdesigner (oh, they hate configuration files so much) to quickly be able to handle apache in the correct way. Giving support in ubuntu irc support channels I noticed many people came there asking how to set up apache and, even easy as it is creating a new virtual host, helping them required a lot of time each.
As for now, the primary goal of apache is to get in a decent shape soon enough to be proposed for Intrepid universe repositories. In order to be able to accomplish such goal, we should focus on a realistic set of features and test them enough to make everything working smoothly. It’s of course better a small working program than a big buggy ball of mud.
That said: which features do you think we still miss in order to make sense for a repo inclusion ? Would you open some bug in launchpad and tell us about what we need to do ? Help us hit the duck :-).
Come say “hello!”
Last post I forgot to tell we have an irc channel on freenode. Feel free to drop in #rapache-devel to greet us and talk to us.
Me and Rapache
For those who missed the announce on Ubuntu Planet, a new project - called Rapache - is born.
What is Rapache ?
Rapache is a simple Apache administration tool. It offers a GTK interface to allow extremely rapid VirtualHost creation and manipulation.

Favicons add a nice touch to the list ![]()
Personally, as a web developer, I felt the need of a simple tool to manage virtualhosts on my localhost for a long time, just because creating them at hand is way too time consuming than I’d like. Then, right after stumbling on this and reading users comments (some may be biased, I know), I decided to make such a tool by myself.
Funnily enough, me and Emgent had the same idea at the same time so, when he announced the project, I got in touch with him and we decided to join forces.
What to expect
Personally I would have not announced the project before having already put together the basic program. We divided our roadmap in basically 3 stages, the first being my original previous goal.
- Stage 0: basic functionality on localhost. Virtual hosts and Apache modules enabling/disabling/modification. Aimed to web developers.
- Stage 1: Localization, more polished Gui. Functional separation before GUI and Libraries (i.e. a number of handy commands you can use from commandline). A number of handy wizards to handle common configuration issue. More Apache configuration options available from the GUI
- Stage 2: Sky’s the limit ;-). Handling remote servers via SSH. Server bookmarking.
What not to expect
At the moment we’re relying on debian way to handle Apache configuration. So do not expect to be able to run Rapache on a non-debian system at lease before Stage 3, maybe not even afterwards. That’s mainly because the debian way of manage Apache confs is much more easy to handle than the upstream’s one.
In a way we’re creating Rapache for Ubuntu itself (and Debian, by reflex) rather than for Linux in general. Despite of that we’re open for people willing to help us hacking it to work on non-debian systems either.
Where to find us
- Launchpad project page: https://launchpad.net/rapache
- Messy wiki page: https://wiki.ubuntu.com/Rapache








