Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
Merge branch 'relpath'
Browse files Browse the repository at this point in the history
Fix for Bug 7045: Make Nimbus services installation portable
  • Loading branch information
timf committed Jun 9, 2010
2 parents 44fc5f7 + 419643c commit b643c45
Show file tree
Hide file tree
Showing 38 changed files with 490 additions and 309 deletions.
4 changes: 3 additions & 1 deletion .idea-modules/wrksp-svc/workspace-service.iml
Expand Up @@ -23,7 +23,9 @@
<content url="file://$MODULE_DIR$/../../pilot" />
<content url="file://$MODULE_DIR$/../../service/service/java/source">
<sourceFolder url="file://$MODULE_DIR$/../../service/service/java/source/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../service/service/java/source/tests" isTestSource="true" />
</content>
<content url="file://$MODULE_DIR$/../../service/service/java/tests">
<sourceFolder url="file://$MODULE_DIR$/../../service/service/java/tests/src" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
Expand Up @@ -17,8 +17,8 @@
package org.nimbustools.auto_config.groupauthz.harness;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.globus.workspace.groupauthz.GroupAuthz;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class Action {

Expand All @@ -41,6 +41,7 @@ public Action(String confPath, String[] args, boolean debug) throws Exception {
this.args = args;
this.debug = debug;

// NOT using NimbusFileSystemXmlApplicationContext, absolute path expected from cmdline
final ApplicationContext ctx =
new FileSystemXmlApplicationContext(this.confPath);

Expand Down
41 changes: 39 additions & 2 deletions home/sbin/nimbusconfigure.py
Expand Up @@ -382,6 +382,35 @@ def write_env_file(self):
if f:
f.close()

def write_db_props(self):
"""Writes ant properties file used by db-mgmt.xml
"""
persistdir = os.path.join(self.gtdir, 'var/nimbus')
dbsetupdir = os.path.join(self.gtdir, 'share/nimbus')
dbsetuplibdir = os.path.join(self.gtdir, 'share/nimbus/lib')
derbyhomedir = os.path.join(self.gtdir, 'var')
derbylibdir = os.path.join(self.gtdir, 'lib')
pwgenfile = os.path.join(self.gtdir, 'etc/nimbus/workspace-service/other/shared-secret-suggestion.py')

lines = ['#Autogenerated by nimbus-configure\n',
'#'+time.strftime('%c')+'\n']
lines.append('workspace.dbdir.prop=%s\n' % persistdir)
lines.append('workspace.sqldir.prop=%s\n' % dbsetuplibdir)
lines.append('workspace.notifdir.prop=%s\n' % dbsetuplibdir)
lines.append('derby.system.home.prop=%s\n' % derbyhomedir)
lines.append('derby.relative.dir.prop=nimbus\n')
lines.append('derby.classpath.dir.prop=%s\n' % derbylibdir)
lines.append('pwGen.path.prop=%s\n' % pwgenfile)

db_props_path = os.path.join(dbsetupdir,'workspace.persistence.conf')
f = None
try:
f = open(db_props_path, 'w')
f.writelines(lines)
finally:
if f:
f.close()

def perform_setup(self):
# first, set up CA and host cert/key
ca_name = self["ca.name"]
Expand All @@ -397,8 +426,13 @@ def perform_setup(self):
pathutil.ensure_file_exists(ca_cert, "CA certificate")
pathutil.ensure_file_exists(ca_key, "CA private key")

hostname = self.ask_hostname()
self['hostname'] = hostname
if self['hostname']:
hostname = self['hostname']
log.debug('Using configured hostname: "%s". Run with %s to change.',
hostname, ARGS.HOSTNAME_LONG)
else:
hostname = self.ask_hostname()
self['hostname'] = hostname

#TODO the hostcert/key creation should be extracted from here
# right now it just does a bunch of redundant checks first
Expand Down Expand Up @@ -458,6 +492,9 @@ def perform_setup(self):
# write an enviroment file
self.write_env_file()

# and db properties file
self.write_db_props()

def import_db(setup, old_db_path):
derbyrun_path = os.path.join(setup.gtdir, 'lib/derbyrun.jar')
if not os.path.exists(derbyrun_path):
Expand Down
6 changes: 6 additions & 0 deletions home/sbin/run-services.sh
Expand Up @@ -12,4 +12,10 @@ export X509_CERT_DIR
LOGFILE="$NIMBUS_HOME/var/services.log"
PORT="8443"

# Changing CWD is necessary only to keep relative path settings for the
# "main.xml" spring paths in "services/etc/nimbus/jndi-config.xml"
# Everything else is run through a $NIMBUS_HOME translator.

cd $GLOBUS_LOCATION

exec $NIMBUS_HOME/services/bin/globus-start-container -p $PORT > $LOGFILE 2>&1
Expand Up @@ -24,33 +24,33 @@

<!-- grab some shared settings from the workspace-service common.conf file,
will have to adjust for other deployment scenarios -->
<property name="location" value="/@WORKSPACE_CONFDIR@/other/common.conf" />
<property name="location" value="$NIMBUS_HOME/services/etc/nimbus/workspace-service/other/common.conf" />
<property name="placeholderPrefix" value="$COMMON{" />
</bean>

<bean id="elasticSettings"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="location" value="/@ELASTIC_CONFDIR@/elastic.conf" />
<property name="location" value="$NIMBUS_HOME/services/etc/nimbus/elastic/elastic.conf" />
<property name="placeholderPrefix" value="$ELASTIC{" />
</bean>

<bean id="otherElasticSettings"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="location" value="/@ELASTIC_CONFDIR@/other/other-elastic.conf" />
<property name="location" value="$NIMBUS_HOME/services/etc/nimbus/elastic/other/other-elastic.conf" />
<property name="placeholderPrefix" value="$OTHER_ELASTIC{" />
</bean>

<bean id="querySettings"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="/@QUERY_CONFDIR@/query.conf" />
<property name="location" value="$NIMBUS_HOME/services/etc/nimbus/query/query.conf" />
<property name="placeholderPrefix" value="$QUERY{" />
</bean>

<bean id="restSettings"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="file://@REST_CONFDIR@/rest.conf" />
<property name="location" value="$NIMBUS_HOME/services/etc/nimbus/rest/rest.conf" />
<property name="placeholderPrefix" value="$REST{" />
</bean>

Expand Down
Expand Up @@ -203,9 +203,9 @@
<property name="enabled" value="$QUERY{query.enabled}"/>
<property name="port" value="$QUERY{https.port}" />
<property name="headerBufferBytes" value="$QUERY{query.header.size}"/>
<property name="keystoreLocation" value="$QUERY{keystore.path}"/>
<property name="keystoreResource" value="$QUERY{keystore.path}"/>
<property name="keystorePassword" value="$QUERY{keystore.password}"/>
<property name="springConfig" value="$QUERY{query.spring.path}"/>
<property name="springConfigResource" value="$QUERY{query.spring.path}"/>
</bean>

<!-- TODO this should happen somewhere else... -->
Expand All @@ -214,9 +214,9 @@
init-method="startListening">
<property name="enabled" value="$REST{rest.enabled}" />
<property name="port" value="$REST{rest.port}" />
<property name="keystoreLocation" value="$REST{keystore.path}"/>
<property name="keystoreResource" value="$REST{keystore.path}"/>
<property name="keystorePassword" value="$REST{keystore.password}"/>
<property name="springConfig" value="$REST{rest.spring.path}"/>
<property name="springConfigResource" value="$REST{rest.spring.path}"/>
</bean>


Expand Down
Expand Up @@ -16,8 +16,8 @@

package org.nimbustools.messaging.gt4_0_elastic.context;

import org.nimbustools.api.brain.NimbusFileSystemXmlApplicationContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.ServiceRM;
import org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.ServiceGeneral;
import org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.ServiceSecurity;
Expand Down Expand Up @@ -114,7 +114,7 @@ public synchronized void initialize() throws Exception {
final String elasticCtxPath = this.fixAbsolute(this.springConf);

// instantiate spring container
this.appCtx = new FileSystemXmlApplicationContext(elasticCtxPath);
this.appCtx = new NimbusFileSystemXmlApplicationContext(elasticCtxPath);
}


Expand Down
Expand Up @@ -19,6 +19,7 @@
import org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.IDMappings;
import org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.security.defaults.KeyCacheProvider;

import java.io.IOException;
import java.util.Random;
import java.net.URL;

Expand All @@ -28,6 +29,7 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.Resource;

/**
* Translations between underlying manager IDs and elastic style. Since the
Expand Down Expand Up @@ -70,12 +72,14 @@ public class DefaultIDMgmt implements IDMappings, KeyCacheProvider {
// CONSTRUCTOR
// -------------------------------------------------------------------------

public DefaultIDMgmt(String diskStorePath) {
public DefaultIDMgmt(Resource diskStoreResource) throws IOException {

if (diskStorePath == null) {
throw new IllegalArgumentException("diskStorePath may not be null");
if (diskStoreResource == null) {
throw new IllegalArgumentException("diskStoreResource may not be null");
}

final String diskStorePath = diskStoreResource.getFile().getAbsolutePath();

// TODO: Do dynamically. This is problematic for other ehcache+diskstore
// users, could not quickly see how to set on per-manager basis
// via spring etc. (specifically, the to-disk part).
Expand Down
Expand Up @@ -16,7 +16,7 @@
<resourceParams>
<parameter>
<name>masterConf</name>
<value>@WORKSPACE_CONFDIR@/other/main.xml</value>
<value>etc/nimbus/workspace-service/other/main.xml</value>
</parameter>
<parameter>
<name>factory</name>
Expand All @@ -31,7 +31,7 @@
<resourceParams>
<parameter>
<name>elasticConf</name>
<value>@ELASTIC_CONFDIR@/other/main.xml</value>
<value>etc/nimbus/elastic/other/main.xml</value>
</parameter>
<parameter>
<name>factory</name>
Expand Down

0 comments on commit b643c45

Please sign in to comment.