Пример #1
0
def install_app():
    """ Performs application installation
    """

    hookenv.log('Installing Dokuwiki', 'info')

    # Configure NGINX vhost
    nginx.configure_site('default', 'vhost.conf',
                         listen_address=php.socket())

    # Update application
    dokuwiki.download_archive()

    # Needs to set dokuwiki directory permissions for installation
    app_path = nginx.get_app_path()

    render(source='local.php',
           target=path.join(app_path, 'conf/local.php'),
           context=config, perms=0o644)

    render(source='acl.auth.php',
           target=path.join(app_path, 'conf/acl.auth.php'),
           context=config, perms=0o644)

    render(source='plugins.local.php',
           target=path.join(app_path, 'conf/plugins.local.php'),
           context=config, perms=0o644)

    # Clean up install.php as we don't need it
    call("rm -f {}/conf/install.php", shell=True)

    php.restart()
    service_restart('nginx')
    hookenv.status_set('active', 'Dokuwiki is installed!')
Пример #2
0
def config_changed():

    if not is_state('nginx.available'):
        return

    # Define user
    app_path = nginx.get_app_path()
    render(source='users.auth.php',
           target=path.join(app_path, 'conf/users.auth.php'),
           context=config, perms=0o664)
    call('chown www-data:www-data -R {}'.format(app_path), shell=True)
    call('chmod 775 -R {}/conf'.format(app_path), shell=True)
    call('mkdir -p {app_path}/data && chmod 775 -R {app_path}/data'.format(
        app_path=app_path), shell=True)

    php.restart()
    service_restart('nginx')
    hookenv.status_set('active', 'Ready')