Webapp-config

is Article description::Gentoo's installer for web-based applications. It is used for automatic setup of web applications in virtual hosting environments. Originally written as a bash script, is now Python-based and available in the Gentoo ebuild repository.

Concepts
is aimed at providing the package management functionality that web server administrators need when running multiple web sites off of the same IP address (virtual hosting).

Two-stage install
Package managers such as RPM and Portage are designed to install one copy of a package, and to install it onto a fixed location. This conflicts with the needs of a virtual hosting environment, where administrators need to be able to install one package in multiple places so that it can be part of more than one website. With that being said, package managers are essential for maintaining an operating system over time - how is it possible to have the best of both worlds?

The answer is a two-stage install. The traditional package manager installs a master copy into This master copy is not fit to run - but it is ready to be used by the  utility to install a single package multiple times in multiple places.

Multiple installations of the same package
allows the administrator to install multiple copies of the same package on the same system at the same time. The administrator decides which directories to install each copy into.

In the web application world, these multiple installations are called "virtual copies".

Different versions of the same package can be installed on the same system at the same time. This allows web administrators to gradually roll out a new version of a package across sites; they are not forced to upgrade every site at once.

minimizes the number of duplicated files to the absolute minimum. This keeps disk space usage low. The majority of files are hard linked to the master copy; only configuration files, and any files that the package needs to write to are copied into the virtual copy.

File ownership and permissions
Administrators who are used to installing web-based applications by hand will know that it can be a pain to get every file owned by the correct user, and with the correct permissions. Some files need to be owned by the user that the web server runs as. Others need to be owned by specific shell accounts, so that those users can login and edit the configuration files. If the Linux distribution offers a choice of web servers - each running under a different user - even the installers can struggle to get it right.

With, the administrator tells the installer which web server to use and which shell account needs to be able to edit the configuration files. then installs the files with the correct ownership and permissions.

Protected configuration files
automatically ensures that configuration files are never overwritten during an upgrade - even if the files have not been edited since the original installation. Additionally, will never overwrite any file that it did not install, or that has been changed since it was installed by. uses MD5 check sums to determine whether a file has been changed or not. In the case of symbolic links, will not replace a symlink that points to a different file.

When an upgrade does attempt to overwrite a protected file, creates a  file with the new file inside. can be used to complete the install, just as a regular.

File copying options
A virtual copy is built mostly by creating hard links to files under. If a hard link cannot be created, the file is copied from instead.

Hard links can only be created to files on the same file system. If and  on kept on different file systems,  cannot use hard links, and will be forced to copy the files instead.

There are three ways to get around the hard link problem.

The easiest way is to make a symlink to a directory under. For most administrators, this will ensure that everything is on the same file system.

However, if the hosted websites are kept on separate file systems, then is never going to be able to hard-link files.

As an alternative the  command-line option can be used. This tells to create symbolic links instead of hard links. Symbolic links work across file systems.

The problem with using symbolic links is that some packages do not work when the virtual copy is made from symbolic links. Many users, and system administrators alas, have also complained that they find directories full of symbolic links confusing. For these reasons, symbolic links are not used by default in any more.

The  command-line option can also be chosen. This particular switch tells to directly copy the files from  instead of hard links. Copying directly works across file systems with the drawback of using more space. This may be desired instead of relying on symbolic links in order to separate the virtualhost files, which admins can then modify, and files in.

Virtual file voodoo
By default, the master copy contains the metadata that decides which files get linked into a virtual copy and which files do not. Files are either owned by the web server (server-owned), are configuration files (config-owned), or are linked in (virtual). Directories can be server-owned or config-owned, but most of the time they need to be just plain directories (default-owned) created inside the installation directory (set with the  option). provides a number of switches which allows for overriding the master copy's metadata - in the case the overriding is ever needed.

The  and   switches allow the administrator to decide what  will do if (respectively) a directory or a file is marked as being default or virtual. can be instructed to make the directory or file any of the other choices - server-owned or config-owned - instead.

${ROOT}
is intended to fully support. For administrators unsure what that means see the emerge man page.

Features
Using the  USE flag  is capable of managing the following applications:

Emerge
Install :

Web server setup
needs to know which web server to host the installed applications with. Popular choices include:


 * Apache
 * Lighttpd
 * Nginx

Edit the following line in the file to set a web server. This example would be the correct modification to make if  was the web server of choice:

Listing and installing webapps
First, determine which versions are available but unused:

To list the webapps that are installed, with their version and full install location:

webapp-config does not list the host or dir arguments used to install the webapp, if any.

To install a webapp, use the  switch and provide two arguments, the application name (which will be short, such as  ), and the version:

To install a webapp under a specific vhost or subdirectory, use the  and/or   arguments to override the defaults from  :

The webapp will be accessible at.

To show information about an installed webapp:

This will print the webapp name, and installed version, of the webapp at the given location.

Upgrading an installed webapp
First, determine which versions are available but unused:

This will list applications in a format like

Then determine what you are using:

You might see listings like, figure out how this maps to the   and   arguments, if at all. Run the upgrade with:

Removing an installation
To remove an installed webapp:

If you've removed a webapp by hand and need to update the database for webapp-config, first check using pretend:

If this looks correct, follow up with:

will only remove the registry entries, it will never remove files it doesn't recognize.