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' ...@@ -30,8 +30,8 @@ CONFIG_PATH = '/opt/ghost/config.js'
TEMPLATE_RESOURCE_NAME = 'resources/ghost/ghost.default.template' TEMPLATE_RESOURCE_NAME = 'resources/ghost/ghost.default.template'
def configure(subject=None): def install():
subject = subject or ctx
ctx.logger.info('Configuring ghost.') ctx.logger.info('Configuring ghost.')
...@@ -39,6 +39,12 @@ def configure(subject=None): ...@@ -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 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') _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)) template = Template(ctx.get_resource(TEMPLATE_RESOURCE_NAME))
ctx.logger.debug('Building a dict object that will contain variables ' ctx.logger.debug('Building a dict object that will contain variables '
...@@ -59,9 +65,12 @@ def configure(subject=None): ...@@ -59,9 +65,12 @@ def configure(subject=None):
_run('sudo mv {0} {1}'.format(temp_config.name, CONFIG_PATH), _run('sudo mv {0} {1}'.format(temp_config.name, CONFIG_PATH),
error_message='Failed to write to {0}.'.format(CONFIG_PATH)) error_message='Failed to write to {0}.'.format(CONFIG_PATH))
def start(subject=None):
def start():
writeConfig(subject)
_run('cd /opt/ghost/ && sudo npm install /opt/ghost/',error_message='Failed running npm install') _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') _run('cd /opt/ghost/ && sudo npm start &',error_message='Failed running npm start')
......
...@@ -46,12 +46,12 @@ node_types: ...@@ -46,12 +46,12 @@ node_types:
derived_from: cloudify.nodes.ApplicationModule derived_from: cloudify.nodes.ApplicationModule
interfaces: interfaces:
cloudify.interfaces.lifecycle: cloudify.interfaces.lifecycle:
configure: install:
implementation: scripts/ghost/ghost.py implementation: scripts/ghost/ghost.py
inputs: inputs:
invocation: invocation:
default: default:
function: configure function: install
start: start:
implementation: scripts/ghost/ghost.py implementation: scripts/ghost/ghost.py
inputs: inputs:
...@@ -77,10 +77,10 @@ node_types: ...@@ -77,10 +77,10 @@ node_types:
relationships: 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. # 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. # 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