Setting Up a Proxy Server for EZ Templates
You can set up special caching proxy servers and use them to efficiently manage your OS and application EZ templates. The following figure illustrates an example network configuration that contains two servers and a separate proxy server:

In this configuration:
- The caching proxy server sits between the servers (Hardware Node 1 and Hardware Node 2) and keeps a number of EZ templates and the repositories (Repository 1, Repository 2, and Repository 3) storing the packages for these EZ templates.
- When either server requests certain packages from any repository for the first time, these packages are first downloaded to the proxy server where they are cached and then downloaded to the corresponding server.
- When a server requests a package that is already available in the cache on the proxy server and none of the repositories has updates for the package, this package is immediately downloaded to the server from the proxy server. If any updates are available in the official repositories, the procedure of handling these updates is identical to that of the main packages: The update is downloaded to the proxy server where it is cached and then retransmitted to the corresponding server.
- A special script is automatically run on the proxy server at set intervals. During its execution, the script creates a local repository from the cached packages. All you have to do is to configure the
vzpkg tool to use packages from this repository instead of obtaining them from remote repositories.
Setting up a proxy server for managing EZ templates has the following advantages:
- Your Internet bandwidth consumption is greatly reduced because all packages are downloaded to the proxy server only once and can then be used by any server on your network.
- You can more rapidly apply software updates to Containers since the proxy server where the downloaded packages are stored resides in the local network.
- You can always have the software packages included in OS EZ templates at hand and do not have to worry whether they have been changed in or removed from their original repositories. The Virtuozzo script running on the proxy sever does not remove any cached packages; so it is up to you when to delete a specific package, if at all.
Setting Up a Proxy Server
To make a server act as a caching proxy server for EZ templates, you need to install the vzpkgproxy package on this server. vzpkgproxy is located in the /virtuozzo/RPMS directory of your Virtuozzo distribution and can be installed with the rpm -i command on servers (including Containers) meeting the following requirements:
- The Apache
httpd server, version 2.0.53 and higher, is installed on the server. - The
createrepo package, version 0.4.2 and higher, is installed on the server.
Keep in mind that you may also need to install a number of additional packages to satisfy the vzpkgproxy dependencies.
By default, the caching proxy server does not allow connections from external hosts. To allow external connections, you need to edit the /etc/httpd/conf.d/vzproxy.conf file as described below:
- Locate the following section in the
vzproxy.conf file.<Proxy *>
Order deny,allow
Deny from all
# Enter all clients here
Allow from localhost.localdomain
</Proxy>
- Replace
localhost.localdomain with the hostnames of external servers you want to be able to connect to the proxy server. For example, to allow connections from the myserver1.com and myserver2.com servers, you can edit the section as follows:<Proxy *>
Order deny,allow
Deny from all
# Enter all clients here
Allow from myserver1.com myserver2.com
</Proxy>
You can also remove the string Deny from all and change the string Allow from localhost.localdomain to Allow from all to allow all external hosts to connect to the proxy server.
Once you edit the /etc/httpd/conf.d/vzproxy.conf file, you need to tell the vzpkg tool to use the packages from the local repository on the proxy server while handling EZ templates. To do this, edit the /etc/vztt/vztt.conf file on the server and specify the following parameters:
- The URL of the proxy server, the port number where the
httpd daemon is listening, and the path to the directory where the EZ templates local repository is located as the value of the VZTT_PROXY parameter. For example, if your proxy server has the 127.123.123.127 IP address assigned, the httpd daemon running on the proxy server is listening on port 8080, and the local repository is stored in /var/www/html/download , you should set the VZTT_PROXY parameter to http://127.123.123.127:8080/download . - The URL of the proxy server and the port number where the
httpd daemon is listening as the value of the HTTP_PROXY parameter. For example, you should set this value for the aforementioned proxy server to http://127.123.123.127:8080 . Keep in mind that you also need to set the HTTP_PROXY_PASSWORD and HTTP_PROXY_USER parameters in the /etc/vztt/vztt.conf file if the access to your proxy server is password-protected.
Configuring Proxy Server Parameters
You can configure a number of proxy server parameters to meet your demands:
- Configure the
CACHE_DISABLE parameter in the /etc/vzpkgpoxy/vzpkgproxy.conf file on the proxy server to specify the hosts to be excluded from the caching process. By default, the proxy server caches the packages from all external hosts that are allowed to connect to the proxy server. - Configure the port number on which the
httpd daemon running on the proxy server is listening. To do this, specify the desired port number in the /etc/httpd/conf.d/vzproxy.conf file on the proxy server. The default port number is 8080. - Configure the
REPO_DIR parameter in the vzpkgproxy.conf file to change the path to the directory where the local repository created on the basis of the cached packages will be stored. By default, this directory is /var/www/html/download .
|