(context)
return {'resources': resources}
Generate configuration.
Generate configuration.
Generate configuration .
def GenerateConfig(context):
  """Generate configuration."""

  backend = context.env['deployment'] + '-backend'
  frontend = context.env['deployment'] + '-frontend'
  firewall = context.env['deployment'] + '-application-fw'
  application_port = 8080
  mysql_port = 3306
  resources = [{
      'name': backend,
      'type': 'container_vm.py',
      'properties': {
          'zone': context.properties['zone'],
          'dockerImage': 'gcr.io/qwiklabs-resources/mysql',
          'containerImage': 'family/cos-stable',
          'port': mysql_port,
          'dockerEnv': {
              'MYSQL_ROOT_PASSWORD': 'mypassword'
          }
      }
  }, {
      'name': frontend,
      'type': 'frontend.py',
      'properties': {
          'zone': context.properties['zone'],
          'dockerImage': 'gcr.io/qwiklabs-resources/nodejsservice',
          'port': application_port,
          # Define the variables that are exposed to container as env variables.
          'dockerEnv': {
              'SEVEN_SERVICE_MYSQL_PORT': mysql_port,
              'SEVEN_SERVICE_PROXY_HOST': '$(ref.' + backend
                                          + '.networkInterfaces[0].networkIP)'
          },
          # If left out will default to 1
          'size': 2,
          # If left out will default to 1
          'maxSize': 20
      }
  }, {
      'name': firewall,
      'type': 'compute.v1.firewall',
      'properties': {
          'allowed': [{
              'IPProtocol': 'TCP',
              'ports': [application_port]
          }],
          'sourceRanges': ['0.0.0.0/0']
      }
  }]
  return {'resources': resources}
def GenerateConfig ( context ) : backend = context . env [ 'deployment' ] + '-backend' frontend = context . env [ 'deployment' ] + '-frontend' firewall = context . env [ 'deployment' ] + '-application-fw' application_port = 8080 mysql_port = 3306 resources = [ { 'name' : backend , 'type' : 'container_vm.py' , 'properties' : { 'zone' : context . properties [ 'zone' ] , 'dockerImage' : 'gcr.io/qwiklabs-resources/mysql' , 'containerImage' : 'family/cos-stable' , 'port' : mysql_port , 'dockerEnv' : { 'MYSQL_ROOT_PASSWORD' : 'mypassword' } } } , { 'name' : frontend , 'type' : 'frontend.py' , 'properties' : { 'zone' : context . properties [ 'zone' ] , 'dockerImage' : 'gcr.io/qwiklabs-resources/nodejsservice' , 'port' : application_port , # Define the variables that are exposed to container as env variables. 'dockerEnv' : { 'SEVEN_SERVICE_MYSQL_PORT' : mysql_port , 'SEVEN_SERVICE_PROXY_HOST' : '$(ref.' + backend + '.networkInterfaces[0].networkIP)' } , # If left out will default to 1 'size' : 2 , # If left out will default to 1 'maxSize' : 20 } } , { 'name' : firewall , 'type' : 'compute.v1.firewall' , 'properties' : { 'allowed' : [ { 'IPProtocol' : 'TCP' , 'ports' : [ application_port ] } ] , 'sourceRanges' : [ '0.0.0.0/0' ] } } ] return { 'resources' : resources }