Restructure murano-apps repository
Change-Id: I9cdb1e4afcb9929c7b7a5437faaa25d284daefdb Closes-Bug: #1441644
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
Namespaces:
|
||||
=: io.murano.apps.docker
|
||||
std: io.murano
|
||||
|
||||
Name: DockerPostgreSQL
|
||||
|
||||
Extends: DockerApplication
|
||||
|
||||
Properties:
|
||||
name:
|
||||
Contract: $.string().notNull()
|
||||
|
||||
publish:
|
||||
Contract: $.bool().notNull()
|
||||
Default: true
|
||||
|
||||
password:
|
||||
Contract: $.string().notNull()
|
||||
|
||||
|
||||
Methods:
|
||||
initialize:
|
||||
Body:
|
||||
- $._environment: $.find(std:Environment).require()
|
||||
- $._scope: switch($.publish, $ => public, not $ => internal)
|
||||
|
||||
|
||||
getContainer:
|
||||
Body:
|
||||
Return:
|
||||
name: $.name
|
||||
image: postgres
|
||||
env:
|
||||
POSTGRES_PASSWORD: $.password
|
||||
ports:
|
||||
- port: 5432
|
||||
scope: $._scope
|
||||
|
||||
|
||||
onInstallationStart:
|
||||
Body:
|
||||
- $._environment.reporter.report($this, 'Installing PostgreSQL')
|
||||
|
||||
|
||||
onInstallationFinish:
|
||||
Body:
|
||||
- If: $.publish
|
||||
Then:
|
||||
- $endpoints: $.applicationEndpoints.where($.scope = $this._scope).
|
||||
select(format('{0}:{1}', $.address, $.port))
|
||||
- $._environment.reporter.report($this, 'PostgreSQL {0} is available at {1}'.format($.name, join(', ', $endpoints)))
|
||||
Else:
|
||||
- $._environment.reporter.report($this, 'PostgreSQL {0} has deployed but is not accessible from outside'.format($.name))
|
||||
Reference in New Issue
Block a user