Fix GuestBook app
* Fixed name of variable in DockerApplication class * Changed creating instance of RedisSlave class Change-Id: I2e57e0719d6c17b9f4dea3516c508b0a23242cab Closes-Bug: #1446245
This commit is contained in:
parent
f56c8d889e
commit
e882ebbffc
@ -29,8 +29,12 @@ Properties:
|
||||
redisMaster:
|
||||
Contract: $.class(DockerRedis).notNull()
|
||||
|
||||
redisSlaveHost:
|
||||
Contract: $.class(DockerContainerHost).notNull()
|
||||
|
||||
redisSlave:
|
||||
Contract: $.class(DockerRedisSlave).notNull()
|
||||
Contract: $.class(DockerRedisSlave)
|
||||
Usage: Out
|
||||
|
||||
|
||||
Methods:
|
||||
@ -43,6 +47,12 @@ Methods:
|
||||
deploy:
|
||||
Body:
|
||||
- $.redisMaster.deploy()
|
||||
- $.redisSlave: new(
|
||||
DockerRedisSlave,
|
||||
name => 'RedisSlave',
|
||||
host => $this.redisSlaveHost,
|
||||
publish => false,
|
||||
redisMaster => $this.redisMaster)
|
||||
- $.redisSlave.deploy()
|
||||
- $.super($.deploy())
|
||||
|
||||
@ -55,10 +65,10 @@ Methods:
|
||||
name: $.name
|
||||
image: 'brendanburns/php-redis'
|
||||
env:
|
||||
REDIS_MASTER_SERVICE_HOST: $.redisMaster.host
|
||||
REDIS_MASTER_SERVICE_PORT: $.redisMaster.port
|
||||
REDISSLAVE_SERVICE_HOST: $.redisSlave.host
|
||||
REDISSLAVE_SERVICE_PORT: $.redisSlave.port
|
||||
REDIS_MASTER_SERVICE_HOST: $redisMasterLink.host
|
||||
REDIS_MASTER_SERVICE_PORT: $redisMasterLink.port
|
||||
REDISSLAVE_SERVICE_HOST: $redisSlaveLink.host
|
||||
REDISSLAVE_SERVICE_PORT: $redisSlaveLink.port
|
||||
ports:
|
||||
- port: 80
|
||||
scope: $._scope
|
||||
|
@ -31,12 +31,6 @@ Properties:
|
||||
|
||||
|
||||
Methods:
|
||||
initialize:
|
||||
Body:
|
||||
- $._environment: $.find(std:Environment).require()
|
||||
- $._scope: switch($.publish, $ => public, not $ => internal)
|
||||
|
||||
|
||||
getContainer:
|
||||
Body:
|
||||
- $redisMasterLink: $.getConnectionTo($.redisMaster, 6379)
|
||||
@ -44,24 +38,8 @@ Methods:
|
||||
name: $.name
|
||||
image: 'brendanburns/redis-slave'
|
||||
env:
|
||||
REDIS_MASTER_SERVICE_HOST: $redisMaster.host
|
||||
REDIS_MASTER_SERVICE_PORT: $redisMaster.port
|
||||
REDIS_MASTER_SERVICE_HOST: $redisMasterLink.host
|
||||
REDIS_MASTER_SERVICE_PORT: $redisMasterLink.port
|
||||
ports:
|
||||
- port: 6379
|
||||
scope: $._scope
|
||||
|
||||
|
||||
onInstallationStart:
|
||||
Body:
|
||||
- $._environment.reporter.report($this, 'Installing RedisSlave')
|
||||
|
||||
|
||||
onInstallationFinish:
|
||||
Body:
|
||||
- If: $.publish
|
||||
Then:
|
||||
- $endpoints: $.applicationEndpoints.where($.scope = $this._scope).
|
||||
select(format('{0}:{1}', $.address, $.port))
|
||||
- $._environment.reporter.report($this, 'Redis Slave {0} is available at {1}'.format($.name, join(', ', $endpoints)))
|
||||
Else:
|
||||
- $._environment.reporter.report($this, 'Redis Slave {0} has deployed but is not accessible from outside'.format($.name))
|
||||
scope: switch($.publish, $ => public, not $ => internal)
|
||||
|
@ -20,6 +20,14 @@ Templates:
|
||||
kubernetesCluster: $.appConfiguration.kubernetesCluster
|
||||
replicas: 3
|
||||
|
||||
redisSlaveHost:
|
||||
?:
|
||||
type: io.murano.apps.docker.kubernetes.KubernetesPod
|
||||
name: 'redis-slave'
|
||||
labels: 'name=redis-slave,app=redis,uses=redis-master'
|
||||
kubernetesCluster: $.appConfiguration.kubernetesCluster
|
||||
replicas: 2
|
||||
|
||||
redisMaster:
|
||||
?:
|
||||
type: io.murano.apps.docker.DockerRedis
|
||||
@ -33,19 +41,6 @@ Templates:
|
||||
replicas: 1
|
||||
publish: false
|
||||
|
||||
redisSlave:
|
||||
?:
|
||||
type: io.murano.apps.docker.DockerRedisSlave
|
||||
name: RedisSlave
|
||||
host:
|
||||
?:
|
||||
type: io.murano.apps.docker.kubernetes.KubernetesPod
|
||||
name: 'redis-slave'
|
||||
labels: 'name=redis-slave,app=redis,uses=redis-master'
|
||||
kubernetesCluster: $.appConfiguration.kubernetesCluster
|
||||
replicas: 2
|
||||
publish: false
|
||||
redisMaster: $redisMaster
|
||||
|
||||
Application:
|
||||
?:
|
||||
@ -53,7 +48,8 @@ Application:
|
||||
name: $.appConfiguration.name
|
||||
host: $guestBookHost
|
||||
redisMaster: $redisMaster
|
||||
redisSlave: $redisSlave
|
||||
|
||||
redisSlaveHost: $redisSlaveHost
|
||||
publish: $.appConfiguration.publish
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ Methods:
|
||||
Else:
|
||||
- If: $.host.getInternalScopeId() = $application.host.getInternalScopeId()
|
||||
Then:
|
||||
- $scopes: list(internal) + $scope
|
||||
- $scopes: list(internal) + $scopes
|
||||
- For: s
|
||||
In: $scopes
|
||||
Do:
|
||||
|
Loading…
Reference in New Issue
Block a user