53 lines
1.2 KiB
YAML
53 lines
1.2 KiB
YAML
Namespaces:
|
|
=: io.murano.apps.docker
|
|
std: io.murano
|
|
|
|
Name: DockerNginxSite
|
|
|
|
Extends: DockerApplication
|
|
|
|
Properties:
|
|
name:
|
|
Contract: $.string().notNull()
|
|
|
|
publish:
|
|
Contract: $.bool().notNull()
|
|
Default: true
|
|
|
|
siteRepo:
|
|
Contract: $.string().notNull()
|
|
|
|
|
|
Methods:
|
|
initialize:
|
|
Body:
|
|
- $._environment: $.find(std:Environment).require()
|
|
- $._scope: switch($.publish, $ => public, not $ => internal)
|
|
|
|
|
|
getContainer:
|
|
Body:
|
|
Return:
|
|
name: $.name
|
|
image: 'ddovbii/nginx-site'
|
|
env:
|
|
APP_URL: $.siteRepo
|
|
ports:
|
|
- port: 80
|
|
scope: $._scope
|
|
|
|
|
|
onInstallationStart:
|
|
Body:
|
|
- $._environment.reporter.report($this, 'Installing Nginx and site from ' + $.siteRepo)
|
|
|
|
|
|
onInstallationFinish:
|
|
Body:
|
|
- If: $.publish
|
|
Then:
|
|
- $endpoints: $.applicationEndpoints.where($.scope = $this._scope).select(format('http://{0}:{1}', $.address, $.port))
|
|
- $._environment.reporter.report($this, 'Nginx application {0} is available at {1}'.format($.name, join(', ', $endpoints)))
|
|
Else:
|
|
- $._environment.reporter.report($this, 'Nginx application {0} has deployed but is not accessible from outside'.format($.name))
|