Skip to content

Instantly share code, notes, and snippets.

@johnsca
Last active August 29, 2015 14:06
Show Gist options
  • Save johnsca/23d339b15c9e701edfb7 to your computer and use it in GitHub Desktop.
Save johnsca/23d339b15c9e701edfb7 to your computer and use it in GitHub Desktop.
Chamilo charm services block
def manage():
manager = ServiceManager([
{
'service': 'apache2',
'ports': [80],
'provided_data': [helpers.HttpRelation()], # interfaces provided by this charm
'required_data': [ # requirements for this charm to be started
helpers.RequiredConfig('domain', 'pass'),
helpers.MysqlRelation(),
helpers.StoredContext('chamilo-secret.json', {
'key': host.pwgen(7),
'version': CHAMILO_VERSION,
}),
],
'data_ready': [ # actions to take to start / update this charm
helpers.render_template(source='configuration.php.j2',
target="/var/www/main/inc/conf/"
"configuration.php"),
helpers.render_template(source='apache-site.j2',
target="/etc/apache2/sites-available/"
"default"),
actions.init_database,
actions.update_admin_account,
],
},
])
manager.manage()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment