ubuntu mirror #6

Description

Provides an Ubuntu archive mirror and keeps it up-to-date using rsync


Overview

This charm provides a complete Ubuntu mirror service, handling fetching the
data via rsync from a master server (updates either triggered on-demand using
ssh or by cron), and making it available through http, ftp and rsync.

It can work alongside a log-archive subordinate charm to transfer logs to
a suitable storage host.

Usage

Assuming you already have a bootstrapped Juju environment, the charm can
be deployed using:

juju deploy ubuntu-mirror

Once deployed, you will need to configure it for your local environment.
An Ubuntu archive mirror can be created using the following commands:

juju set ubuntu-mirror mirror_ubuntu_name="myhost.mydomain.com"
juju set ubuntu-mirror mirror_ubuntu_sync_time="0 1 * * *"
juju set ubuntu-mirror role_map='{"myhost":["ubuntu"]}'

Replace "myhost" with the hostname of your server and "myhost.mydomain.com" with
its fully qualified domain name (FQDN).

The "role_map" variable tells the charm what type of mirror you want to create
(currently, this can be any of "ubuntu" (a mirror of archive.ubuntu.com),
"releases" (a mirror of releases.ubuntu.com), "cdimage" (a mirror of
cdimage.ubuntu.com" or "ports" (a mirror of ports.ubuntu.com) If you have a
sufficiently large server, multiple roles can be assigned to one server
(role_map='{"myhost":["ubuntu","cdimage"]}' for example)

If you have more than one server, you should list each one (e.g. role_map='{"host1":["cdimage","ubuntu"],"host2":["releases"]}')

The "mirror_ubuntu_name" variable is the name the webserver will use for
the Ubuntu mirror. In the above example, it would answer requests for
http://myhost.mydomain.com

The "mirror_ubuntu_sync_time" variable tells the charm what time it should
update. In the above example, the update would happen every day at 1am.

There are a number of variables that can be set on a per-role basis. They
all follow the pattern mirror__, so if we were setting up
a cdimage mirror, we would use "mirror_cdimage_name" and
"mirror_cdimage_sync_time".

To cater for rsync servers that require authentication, there is a per-role
variable, mirror__rsync_auth. If you don't need to authenticate
against your upstream mirror, leave this alone, the defaults will be fine.
If you do need to authenticate, this variable should be used like this:

juju set ubuntu-mirror mirror_cdimage_rsync_auth='{"myhost":{"user":"eric", "password":"YXBwbGVzCg=="}}'

The password value is just a Base64-encoded string, just in case it needs to contain any special characters (it also helps avoid people casually reading passwords over your shoulder when you run juju get).

As with role_map (above), if you have multiple servers they should all be listed
(e.g. mirror_cdimage_rsync_auth='{"host1":{"user":"eric","password":"YXBwbGVzCg=="},"host2":{"user":"frank","password":"b3Jhbmdlcwo="}}')

For simplicity, if all of your servers authenticate with the same username
and password, you can use: '{"<>":{"user":"eric","password":"YXBwbGVzCg=="}}'.

Configuration

ftp_max_per_source
(int) Maximum number of concurrent FTP connections allowed
10
ftp_logdir
(string) Where ftpd logfiles should be written
/var/log/ftp
mirror_ubuntu_trigger
(string) A base64 string containing the ssh trigger public key
disk_inode_crit
(string) Disk inode critical threshold
5%
mirror_ubuntu_aliases
(string) List of Apache aliases for the Ubuntu mirror
[]
rsync_motd
(string) Rsync server welcome message text (base64 encoded)
VGhpcyBpcyBhbiBVYnVudHUgbWlycm9yIC0gdHJlYXQgaXQga2luZGx5Cg==
mirror_cdimage_rsync_log
(boolean) Whether to log rsync requests for the cdimage mirror
True
apache_serverlimit
(int) Maximum number of Apache server processes allowed
256
mirror_releases_apache_late_extra
(string) A base64 string containing apache configuration options to be included late in the config file
mirror_cdimage_sync_time
(string) When mirror updates should be run. Either a cron(5) format time specification or 'ondemand' for ssh triggering
ondemand
mirror_cdimage_aliases
(string) List of Apache aliases for the cdimage mirror
[]
ftp_delete_logs_after
(int) Delete FTP logs after n days.
28
mirror_releases_rsync_log
(boolean) Whether to log rsync requests for the releases mirror
True
mirror_releases_name
(string) FQDN of the releases mirror
releases.ubuntu.com
mirror_ubuntu_sync_time
(string) When mirror updates should be run. Either a cron(5) format time specification or 'ondemand' for ssh triggering
ondemand
apache_maxclients
(int) Maximum number of simultaneous client connections
4096
mirror_ubuntu_path
(string) Root location of mirrored files for the Ubuntu mirror
/srv/ftp.root/ubuntu
ftp_max_instances
(int) Maximum number of FTP connections allowed
200
mirror_ports_name
(string) FQDN of the ports mirror
ports.ubuntu.com
mirror_cdimage_name
(string) FQDN of the cdimage mirror
cdimage.ubuntu.com
mirror_ubuntu_rsync_log
(boolean) Whether to log rsync requests for the Ubuntu mirror
mirror_ports_aliases
(string) List of Apache aliases for the ports mirror
[]
mirror_cdimage_trigger
(string) A base64 string containing the ssh trigger public key
mirror_releases_path
(string) Root location of mirrored files for the releases mirror
/srv/ftp.root/releases
apache_minsparethreads
(int) Minimum number of Apache worker threads which are kept spare
50
apache_threadlimit
(int) Upper limit of ThreadsPerChild allowed in a graceful restart
64
apache_status_allowed_from
(string) A list of addresses allowed to access the Apache server-status page
[]
mirror_releases_trigger
(string) A base64 string containing the ssh trigger public key
rsync_motdfile
(string) Rsync server welcome message file
/etc/rsyncd/motd
mirror_cdimage_apache_late_extra
(string) A base64 string containing apache configuration options to be included late in the config file
mirror_releases_source_url
(string) The URL the releases mirror will be fetched from
rsync://rsync.releases.ubuntu.com/releases
mirror_releases_description
(string) A brief welcome message for the releases mirror
Ubuntu Releases CD Images
apache_threadsperchild
(int) Constant number of worker threads in each Apache server process
64
mirror_ports_source_url
(string) The URL the ports mirror will be fetched from
rsync://ports.ubuntu.com/ubuntu-ports
apache_delete_logs_after
(int) Delete apache logs after n days.
14
mirror_ports_rsync_log
(boolean) Whether to log rsync requests for the ports mirror
mirror_ports_rsync_auth
(string) Optional rsync authentication details for mirror_ports_source_url
{}
mirror_releases_rsync_auth
(string) Optional rsync authentication details for mirror_releases_source_url
{}
mirror_ubuntu_command
(string) The command to use to sync the Ubuntu mirror
mirror-2stage.sh
nagios_servicegroup
(string) If set, this is the Nagios servicegroup for alerts. If unset, an appropriate one will be chosen
apache_maxrequestsperchild
(int) Maximum number of requests a server process serves
mirror_cdimage_rsync_auth
(string) Optional rsync authentication details for mirror_cdimage_source_url
{}
mirror_ubuntu_description
(string) A brief welcome message for the Ubuntu mirror
Ubuntu Archive
role_map
(string) JSON-formatted list of which type of mirror is enabled on which unit. Format is: {"hostname1":["cdimage","ubuntu"],"hostname2":["releases"]}
mirror_ports_description
(string) A brief welcome message for the ports mirror
Ubuntu Ports Archive
nagios_critical_servicegroup
(string) If set, this is an additional Nagios servicegroup for critical alerts.
application_name
(string) The name of this charm
ubuntu-mirror
apache_startservers
(int) Initial number of Apache server processes to start
2
mirror_releases_sync_time
(string) When mirror updates should be run. Either a cron(5) format time specification or 'ondemand' for ssh triggering
ondemand
rsync_max_connections
(int) Maximum number of rsync connections allowed
45
mirror_cdimage_description
(string) A brief welcome message for the cdimage mirror
Ubuntu CD Images
mirror_ubuntu_apache_late_extra
(string) A base64 string containing apache configuration options to be included late in the config file
mirror_ports_sync_time
(string) When mirror updates should be run. Either a cron(5) format time specification or 'ondemand' for ssh triggering
ondemand
archive_logs_apache
(boolean) Enable log archiving for Apache logs
True
archive_logs_ftp
(boolean) Enable log archiving for FTP logs
script_dir
(string) Install location for any mirror-related scripts
/srv/ubuntu-mirror/bin
mirror_ports_command
(string) The command to use to sync the ports mirror
mirror-2stage.sh
rsync_logdir
(string) Rsync log directory
/var/log/rsyncd
mirror_cdimage_source_url
(string) The URL the cdimage mirror will be fetched from
rsync://cdimage.ubuntu.com/cdimage
archive_logs_rsync
(boolean) Enable log archiving for Rsync logs
apache_maxsparethreads
(int) Maximum number of Apache worker threads which are kept spare
100
archive_logs_after
(int) Archive the logs after n days. This is only used when a suitable log-archive subordinate charm is provided
1
ftp_welcome_banner
(string) FTP welcome message
FTP server (vsftpd)
mirror_releases_command
(string) The command to use to sync the releases mirror
mirror-1stage.sh
mirror_releases_aliases
(string) List of Apache aliases for the releases mirror
[]
mirror_cdimage_path
(string) Root location of mirrored files for the cdimage mirror
/srv/ftp.root/cdimage
mirror_ports_path
(string) Root location of mirrored files for the ports mirror
/srv/ftp.root/ubuntu-ports
mirror_cdimage_command
(string) The command to use to sync the cdimage mirror
mirror-1stage.sh
mirror_ports_apache_late_extra
(string) A base64 string containing apache configuration options to be included late in the config file
mirror_ubuntu_name
(string) FQDN of the Ubuntu mirror
archive.ubuntu.com
mirror_ubuntu_rsync_auth
(string) Optional rsync authentication details for mirror_ubuntu_source_url
{}
nagios_host_context
(string) Used for nagios monitoring. See nrpe-external-master charm for details
juju
mirror_user
(string) Mirror system user id
mirror
apache_logdir
(string) Where Apache logfiles should be written
/var/log/apache2
disk_space_crit
(string) Disk space critical threshold
20%
mirror_ports_trigger
(string) A base64 string containing the ssh trigger public key
disk_space_warn
(string) Disk space warning threshold
25%
mirror_ubuntu_source_url
(string) The URL the Ubuntu mirror will be fetched from
rsync://archive.ubuntu.com/ubuntu