def GenerateConfig(context):
    config = {}
    config['resources'] = []

    couchbaseUsername = '******'
    couchbasePassword = GeneratePassword()

    clusterName = 'td'
    serverGroupName = 'server'
    syncGatewayGroupName = 'syncgateway'

    cluster = GetCluster(context, clusterName, serverGroupName,
                         syncGatewayGroupName)

    deployment = {
        'name': 'deployment',
        'type': 'deployment.py',
        'properties': {
            'serverVersion': context.properties['serverVersion'],
            'syncGatewayVersion': context.properties['syncGatewayVersion'],
            'couchbaseUsername': couchbaseUsername,
            'couchbasePassword': couchbasePassword,
            'license': 'byol',
            'clusters': [cluster]
        }
    }
    config['resources'].append(deployment)

    serverAdminUrl = 'http://$(ref.deployment.' \
        + naming.ExternalIpOutputName(clusterName, serverGroupName) \
        + '):8091/'

    syncGatewayAdminUrl = 'http://$(ref.deployment.' \
        + naming.ExternalIpOutputName(clusterName, syncGatewayGroupName) \
        + '):4985/_admin/'

    config['outputs'] = [{
        'name': 'couchbaseUsername',
        'value': couchbaseUsername
    }, {
        'name': 'couchbasePassword',
        'value': couchbasePassword
    }, {
        'name': 'serverAdminUrl',
        'value': serverAdminUrl
    }, {
        'name': 'syncGatewayAdminUrl',
        'value': syncGatewayAdminUrl
    }]

    return config
Example #2
0
def GenerateConfig(context):
    license = '-byol'

    config={}
    config['resources'] = []
    config['outputs'] = []

    clusters = GetClusters(context)

    deployment = {
        'name': 'deployment',
        'type': 'deployment.py',
        'properties': {
            'syncGatewayVersion': context.properties['syncGatewayVersion'],
            'couchbaseUsername': context.properties['couchbaseUsername'],
            'couchbasePassword': context.properties['couchbasePassword'],
            'couchbaseConnectionString': context.properties['couchbaseConnectionstring'],
            'couchbaseBucketName': context.properties['couchbaseBucketName'],
            'serverVersion': '6.6.1',
            'license': license,
            'clusters': clusters
        }
    }
    config['resources'].append(deployment)

    for cluster in clusters:
        clusterName = cluster['cluster']
        for group in cluster['groups']:
            outputName = naming.ExternalIpOutputName(context, clusterName, group['group'])
            config['outputs'].append({
                'name': outputName,
                'value': '$(ref.deployment.%s)' % outputName
            })

    return config
Example #3
0
def GenerateConfig(context):
    config = {}
    config['resources'] = []
    config['outputs'] = []

    runtimeconfigName = naming.RuntimeConfigName(context)
    runtimeconfig = {
        'name': runtimeconfigName,
        'type': 'runtimeconfig.v1beta1.config',
        'properties': {
            'config': runtimeconfigName
        }
    }
    config['resources'].append(runtimeconfig)

    for cluster in context.properties['clusters']:
        clusterName = cluster['cluster']
        clusterResourceName = naming.ClusterName(context, clusterName)

        clusterJSON = {
            'name': clusterResourceName,
            'type': 'cluster.py',
            'properties': {
                'runtimeconfigName':
                runtimeconfigName,
                'syncGatewayVersion':
                context.properties['syncGatewayVersion'],
                'couchbaseUsername':
                context.properties['couchbaseUsername'],
                'couchbasePassword':
                context.properties['couchbasePassword'],
                'couchbaseConnectionstring':
                context.properties['couchbaseConnectionstring'],
                'couchbaseBucketName':
                context.properties['couchbaseBucketName'],
                'license':
                context.properties['license'],
                'cluster':
                cluster['cluster'],
                'region':
                cluster['region'],
                'groups':
                cluster['groups'],
            }
        }
        config['resources'].append(clusterJSON)

        for group in cluster['groups']:
            groupName = group['group']
            outputName = naming.ExternalIpOutputName(clusterName, groupName)

            readActionName = naming.ExternalIpVariableReadActionName(
                context, clusterName, groupName)

            config['outputs'].append({
                'name': outputName,
                'value': '$(ref.%s.text)' % readActionName
            })

    firewall = {
        'name': naming.FirewallName(context),
        'type': 'compute.v1.firewall',
        'properties': {
            'sourceRanges': ['0.0.0.0/0'],
            'allowed': [{
                'IPProtocol':
                'tcp',
                'ports': [
                    '8091', '8092', '8093', '8094', '8095', '8096', '18091',
                    '18092', '18093', '18094', '18095', '18096', '4984',
                    '4985', '11210', '9130'
                ]
            }]
        }
    }
    config['resources'].append(firewall)

    return config
Example #4
0
def GenerateConfig(context):
    config = {}
    config['resources'] = []
    config['outputs'] = []

    runtimeconfigName = naming.RuntimeConfigName(context)
    runtimeconfig = {
        'name': runtimeconfigName,
        'type': 'runtimeconfig.v1beta1.config',
        'properties': {
            'config': runtimeconfigName
        }
    }
    config['resources'].append(runtimeconfig)
    config['resources'].append(
        GenerateCouchbaseUserPasswordVariable(
            context, runtimeconfigName,
            context.properties['couchbasePassword']))
    config['resources'].append(
        GenerateCouchbaseUserUsernameVariable(
            context, runtimeconfigName,
            context.properties['couchbaseUsername']))
    for cluster in context.properties['clusters']:
        clusterName = cluster['cluster']
        clusterResourceName = naming.ClusterName(context, clusterName)

        clusterJSON = {
            'name': clusterResourceName,
            'type': 'cluster.py',
            'properties': {
                'runtimeconfigName': runtimeconfigName,
                'serverVersion': context.properties['serverVersion'],
                'syncGatewayVersion': context.properties['syncGatewayVersion'],
                'couchbaseUsername': context.properties['couchbaseUsername'],
                'couchbasePassword': context.properties['couchbasePassword'],
                'license': context.properties['license'],
                'cluster': cluster['cluster'],
                'region': cluster['region'],
                'groups': cluster['groups'],
            }
        }
        config['resources'].append(clusterJSON)

        for group in cluster['groups']:
            groupName = group['group']
            outputName = naming.ExternalIpOutputName(context, clusterName,
                                                     groupName)

            createActionName = naming.ExternalIpVariableCreateActionName(
                context, clusterName, groupName)

            config['outputs'].append({
                'name':
                outputName,
                'value':
                '$(ref.%s.text)' % createActionName
            })

    firewall = {
        'name': naming.FirewallName(context),
        'type': 'compute.v1.firewall',
        'properties': {
            'sourceRanges': ['0.0.0.0/0'],
            'allowed': [{
                'IPProtocol':
                'tcp',
                'ports': [
                    '4369', '8091-8096', '9100-9105', '9110-9118', '9120-9122',
                    '9130', '9140', '9999', '11207', '11209-11211', '11207',
                    '21100', '11206-11207', '18091-18096', '19130', '21150'
                ]
            }]
        }
    }
    config['resources'].append(firewall)

    return config