Skip to content

Commit

Permalink
[system] use SMF for composer
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrugzz committed Nov 6, 2013
1 parent 0fe113e commit a816772
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
23 changes: 23 additions & 0 deletions opsmezzo/composer/files/composer.xml
@@ -0,0 +1,23 @@
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='composer'>
<service name='application/composer' type='service' version='0'>
<create_default_instance enabled='true'/>
<single_instance/>
<dependency name='multiuser' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/multi-user:default'/>
</dependency>
<exec_method name='start' type='method' exec='forever start $HOME/conservatory/bin/composer --config $HOME/config/composer.json' timeout_seconds='60'>

This comment has been minimized.

Copy link
@mmalecki

mmalecki Nov 6, 2013

Contributor

I'd recommend dropping forever from the mix. I think that this will cause SMF to execute forever start indefinitely because forever exits after spawning a daemon.

Besides that, come on, you have SMF, why use forever?

This comment has been minimized.

Copy link
@jcrugzz

jcrugzz Nov 6, 2013

Author Member

only reason really is thats how we handle the logs output. There needs to be a simple stdout -> file redirect. And it doesn't execute it indefinitely, SMF just watches both of the spawned processes. Im glad its smarter than that xD.

This comment has been minimized.

Copy link
@mmalecki

mmalecki Nov 6, 2013

Contributor

Oh, word. Glad you found that out - I thought SMF would only watch the parent process.

<method_context>
<method_credential user='root' group='root'/>
<method_environment>
<envvar name='PATH' value='/opt/local/bin:/usr/bin:/bin'/>
<envvar name='HOME' value='/root'/>
</method_environment>
</method_context>
</exec_method>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'>
<method_context />
</exec_method>
</service>
</service_bundle>
4 changes: 3 additions & 1 deletion opsmezzo/composer/scripts/configure.sh
Expand Up @@ -3,4 +3,6 @@
#
# Configure quill-composer
#
npm-configure quill-composer
npm-configure quill-composer

svccfg import ../files/composer.xml
4 changes: 2 additions & 2 deletions opsmezzo/composer/scripts/start.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

#
# Start bin/composer with forever
# Start bin/composer with SMF
#
forever start $HOME/quill-composer/bin/composer -e $q_env --config $HOME/config/composer.json -p $q_composer_port
svcadm enable composer
2 changes: 1 addition & 1 deletion opsmezzo/composer/system.json
@@ -1,6 +1,6 @@
{
"name": "composer",
"version": "1.0.3",
"version": "1.0.4",
"description": "Configuration management, and SSH key management sauteed in awesomesauce",
"keywords": ["configuration management", "devops"],
"author": "Nodejitsu Inc <info@nodejitsu.com>",
Expand Down
4 changes: 3 additions & 1 deletion opsmezzo/composer/templates/composer.json
@@ -1,9 +1,11 @@
{
"log": {{ composer.log }}
, "env": "{{ env }}"
, "port": {{ composer.port }}
{{#exceptions}}
, "exceptions": {{.}}
{{/exceptions}}
{{#loggly}}
{{#loggly}}
, "loggly": {{.}}
{{/loggly}}
, "database": {{ composer.database }}
Expand Down

0 comments on commit a816772

Please sign in to comment.