diff --git a/config.yaml b/config.yaml index 6417a156..c6ad45a1 100644 --- a/config.yaml +++ b/config.yaml @@ -57,6 +57,16 @@ options: 100-continue. See the following page for more info: http://ceph.com/docs/dumpling/radosgw/manual-install/#continue-support + use-embedded-webserver: + type: boolean + default: false + description: | + Newer versions of the Ceph RADOS Gateway support use of an embedded web + container instead of Apache + mod-fastcgi, avoiding some of the nuances + of using the stock mod-fastcgi packages from Ubuntu. + . + Enable this option to disable use of Apache and enable the embedded + web container feature. vip: type: string default: diff --git a/hooks/hooks.py b/hooks/hooks.py index fa301bd6..4a5b7271 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -28,9 +28,13 @@ from charmhelpers.core.hookenv import ( from charmhelpers.fetch import ( apt_update, apt_install, + apt_purge, add_source, ) -from charmhelpers.core.host import lsb_release +from charmhelpers.core.host import ( + lsb_release, + restart_on_change +) from utils import ( render_template, get_host_ip, @@ -79,16 +83,29 @@ def install_ceph_optimised_packages(): add_source(source, key='6EAEAE2203C3951A') +PACKAGES = [ + 'radosgw', + 'ntp', +] + +APACHE_PACKAGES = [ + 'libapache2-mod-fastcgi', + 'apache2', +] + + def install_packages(): add_source(config('source'), config('key')) - if config('use-ceph-optimised-packages'): + if (config('use-ceph-optimised-packages') and + not config('use-embedded-webserver')): install_ceph_optimised_packages() apt_update(fatal=True) - apt_install(['radosgw', - 'libapache2-mod-fastcgi', - 'apache2', - 'ntp'], fatal=True) + apt_install(PACKAGES, fatal=True) + if config('use-embedded-webserver'): + apt_purge(APACHE_PACKAGES) + else: + apt_install(APACHE_PACKAGES, fatal=True) @hooks.hook('install') @@ -109,7 +126,8 @@ def emit_cephconf(): 'mon_hosts': ' '.join(get_mon_hosts()), 'hostname': get_unit_hostname(), 'old_auth': cmp_pkgrevno('radosgw', "0.51") < 0, - 'use_syslog': str(config('use-syslog')).lower() + 'use_syslog': str(config('use-syslog')).lower(), + 'embedded_webserver': config('use-embedded-webserver'), } # Check to ensure that correct version of ceph is @@ -154,14 +172,16 @@ def apache_reload(): @hooks.hook('upgrade-charm', 'config-changed') +@restart_on_change({'/etc/ceph/ceph.conf': ['radosgw']}) def config_changed(): install_packages() emit_cephconf() - emit_apacheconf() - install_www_scripts() - apache_sites() - apache_modules() - apache_reload() + if not config('use-embedded-webserver'): + emit_apacheconf() + install_www_scripts() + apache_sites() + apache_modules() + apache_reload() for r_id in relation_ids('identity-service'): identity_joined(relid=r_id) diff --git a/templates/ceph.conf b/templates/ceph.conf index a94483d1..5c1473ba 100644 --- a/templates/ceph.conf +++ b/templates/ceph.conf @@ -16,9 +16,13 @@ host = {{ hostname }} keyring = /etc/ceph/keyring.rados.gateway rgw socket path = /tmp/radosgw.sock log file = /var/log/ceph/radosgw.log +{% if embedded_webserver %} +rgw frontends = civetweb port=80 +{% else %} # Turn off 100-continue optimization as stock mod_fastcgi # does not support it -rgw print continue = false +rgw print continue = false +{% endif %} {% if auth_type == 'keystone' %} rgw keystone url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/ rgw keystone admin token = {{ admin_token }}