Commit bb683838 authored by Daniel Baur's avatar Daniel Baur

Moved access to postgre ip to start action of ghost

parent 05c9fa2a
......@@ -30,8 +30,8 @@ CONFIG_PATH = '/opt/ghost/config.js'
TEMPLATE_RESOURCE_NAME = 'resources/ghost/ghost.default.template'
def configure(subject=None):
subject = subject or ctx
def install():
ctx.logger.info('Configuring ghost.')
......@@ -39,6 +39,12 @@ def configure(subject=None):
_run('sudo curl -L https://ghost.org/zip/ghost-latest.zip -o /opt/ghost.zip',error_message='Failed downloading ghost')
_run('sudo unzip -uo /opt/ghost.zip -d /opt/ghost',error_message='Failed unzipping ghost')
def writeConfig(subject=None):
subject = subject or ctx
template = Template(ctx.get_resource(TEMPLATE_RESOURCE_NAME))
ctx.logger.debug('Building a dict object that will contain variables '
......@@ -61,7 +67,10 @@ def configure(subject=None):
error_message='Failed to write to {0}.'.format(CONFIG_PATH))
def start():
def start(subject=None):
writeConfig(subject)
_run('cd /opt/ghost/ && sudo npm install /opt/ghost/',error_message='Failed running npm install')
_run('cd /opt/ghost/ && sudo npm start &',error_message='Failed running npm start')
......
......@@ -46,12 +46,12 @@ node_types:
derived_from: cloudify.nodes.ApplicationModule
interfaces:
cloudify.interfaces.lifecycle:
configure:
install:
implementation: scripts/ghost/ghost.py
inputs:
invocation:
default:
function: configure
function: install
start:
implementation: scripts/ghost/ghost.py
inputs:
......@@ -77,10 +77,10 @@ node_types:
relationships:
###########################################################
# This relationship is responsible for setting the mongo
# This relationship is responsible for setting the postgre
# host ip on the source node as a runtime property.
#
# This will enable the source node to locate the mongo
# This will enable the source node to locate the postgre
# database.
###########################################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment