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:
|
redisMaster:
|
||||||
Contract: $.class(DockerRedis).notNull()
|
Contract: $.class(DockerRedis).notNull()
|
||||||
|
|
||||||
|
redisSlaveHost:
|
||||||
|
Contract: $.class(DockerContainerHost).notNull()
|
||||||
|
|
||||||
redisSlave:
|
redisSlave:
|
||||||
Contract: $.class(DockerRedisSlave).notNull()
|
Contract: $.class(DockerRedisSlave)
|
||||||
|
Usage: Out
|
||||||
|
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
@ -43,6 +47,12 @@ Methods:
|
|||||||
deploy:
|
deploy:
|
||||||
Body:
|
Body:
|
||||||
- $.redisMaster.deploy()
|
- $.redisMaster.deploy()
|
||||||
|
- $.redisSlave: new(
|
||||||
|
DockerRedisSlave,
|
||||||
|
name => 'RedisSlave',
|
||||||
|
host => $this.redisSlaveHost,
|
||||||
|
publish => false,
|
||||||
|
redisMaster => $this.redisMaster)
|
||||||
- $.redisSlave.deploy()
|
- $.redisSlave.deploy()
|
||||||
- $.super($.deploy())
|
- $.super($.deploy())
|
||||||
|
|
||||||
@ -55,10 +65,10 @@ Methods:
|
|||||||
name: $.name
|
name: $.name
|
||||||
image: 'brendanburns/php-redis'
|
image: 'brendanburns/php-redis'
|
||||||
env:
|
env:
|
||||||
REDIS_MASTER_SERVICE_HOST: $.redisMaster.host
|
REDIS_MASTER_SERVICE_HOST: $redisMasterLink.host
|
||||||
REDIS_MASTER_SERVICE_PORT: $.redisMaster.port
|
REDIS_MASTER_SERVICE_PORT: $redisMasterLink.port
|
||||||
REDISSLAVE_SERVICE_HOST: $.redisSlave.host
|
REDISSLAVE_SERVICE_HOST: $redisSlaveLink.host
|
||||||
REDISSLAVE_SERVICE_PORT: $.redisSlave.port
|
REDISSLAVE_SERVICE_PORT: $redisSlaveLink.port
|
||||||
ports:
|
ports:
|
||||||
- port: 80
|
- port: 80
|
||||||
scope: $._scope
|
scope: $._scope
|
||||||
|
@ -31,12 +31,6 @@ Properties:
|
|||||||
|
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
initialize:
|
|
||||||
Body:
|
|
||||||
- $._environment: $.find(std:Environment).require()
|
|
||||||
- $._scope: switch($.publish, $ => public, not $ => internal)
|
|
||||||
|
|
||||||
|
|
||||||
getContainer:
|
getContainer:
|
||||||
Body:
|
Body:
|
||||||
- $redisMasterLink: $.getConnectionTo($.redisMaster, 6379)
|
- $redisMasterLink: $.getConnectionTo($.redisMaster, 6379)
|
||||||
@ -44,24 +38,8 @@ Methods:
|
|||||||
name: $.name
|
name: $.name
|
||||||
image: 'brendanburns/redis-slave'
|
image: 'brendanburns/redis-slave'
|
||||||
env:
|
env:
|
||||||
REDIS_MASTER_SERVICE_HOST: $redisMaster.host
|
REDIS_MASTER_SERVICE_HOST: $redisMasterLink.host
|
||||||
REDIS_MASTER_SERVICE_PORT: $redisMaster.port
|
REDIS_MASTER_SERVICE_PORT: $redisMasterLink.port
|
||||||
ports:
|
ports:
|
||||||
- port: 6379
|
- port: 6379
|
||||||
scope: $._scope
|
scope: switch($.publish, $ => public, not $ => internal)
|
||||||
|
|
||||||
|
|
||||||
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))
|
|
||||||
|
@ -20,6 +20,14 @@ Templates:
|
|||||||
kubernetesCluster: $.appConfiguration.kubernetesCluster
|
kubernetesCluster: $.appConfiguration.kubernetesCluster
|
||||||
replicas: 3
|
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:
|
redisMaster:
|
||||||
?:
|
?:
|
||||||
type: io.murano.apps.docker.DockerRedis
|
type: io.murano.apps.docker.DockerRedis
|
||||||
@ -33,19 +41,6 @@ Templates:
|
|||||||
replicas: 1
|
replicas: 1
|
||||||
publish: false
|
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:
|
Application:
|
||||||
?:
|
?:
|
||||||
@ -53,7 +48,8 @@ Application:
|
|||||||
name: $.appConfiguration.name
|
name: $.appConfiguration.name
|
||||||
host: $guestBookHost
|
host: $guestBookHost
|
||||||
redisMaster: $redisMaster
|
redisMaster: $redisMaster
|
||||||
redisSlave: $redisSlave
|
|
||||||
|
redisSlaveHost: $redisSlaveHost
|
||||||
publish: $.appConfiguration.publish
|
publish: $.appConfiguration.publish
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ Methods:
|
|||||||
Else:
|
Else:
|
||||||
- If: $.host.getInternalScopeId() = $application.host.getInternalScopeId()
|
- If: $.host.getInternalScopeId() = $application.host.getInternalScopeId()
|
||||||
Then:
|
Then:
|
||||||
- $scopes: list(internal) + $scope
|
- $scopes: list(internal) + $scopes
|
||||||
- For: s
|
- For: s
|
||||||
In: $scopes
|
In: $scopes
|
||||||
Do:
|
Do:
|
||||||
|
Loading…
Reference in New Issue
Block a user