You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2015/08/18 13:01:11 UTC

[56/64] incubator-brooklyn git commit: brooklyn-software-database: add org.apache package prefix

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java
----------------------------------------------------------------------
diff --git a/software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java b/software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java
new file mode 100644
index 0000000..d66ed76
--- /dev/null
+++ b/software/database/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSshDriver.java
@@ -0,0 +1,425 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.entity.database.postgresql;
+
+import static brooklyn.util.ssh.BashCommands.INSTALL_WGET;
+import static brooklyn.util.ssh.BashCommands.alternativesGroup;
+import static brooklyn.util.ssh.BashCommands.chainGroup;
+import static brooklyn.util.ssh.BashCommands.dontRequireTtyForSudo;
+import static brooklyn.util.ssh.BashCommands.executeCommandThenAsUserTeeOutputToFile;
+import static brooklyn.util.ssh.BashCommands.fail;
+import static brooklyn.util.ssh.BashCommands.ifExecutableElse0;
+import static brooklyn.util.ssh.BashCommands.ifExecutableElse1;
+import static brooklyn.util.ssh.BashCommands.installPackage;
+import static brooklyn.util.ssh.BashCommands.sudo;
+import static brooklyn.util.ssh.BashCommands.sudoAsUser;
+import static brooklyn.util.ssh.BashCommands.warn;
+import static java.lang.String.format;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.annotation.Nullable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import brooklyn.entity.basic.AbstractSoftwareProcessSshDriver;
+import brooklyn.entity.basic.Attributes;
+import brooklyn.entity.basic.SoftwareProcess;
+import org.apache.brooklyn.entity.database.DatastoreMixins;
+import brooklyn.entity.software.SshEffectorTasks;
+
+import org.apache.brooklyn.api.location.OsDetails;
+import org.apache.brooklyn.core.util.task.DynamicTasks;
+import org.apache.brooklyn.core.util.task.ssh.SshTasks;
+import org.apache.brooklyn.core.util.task.ssh.SshTasks.OnFailingTask;
+import org.apache.brooklyn.core.util.task.system.ProcessTaskWrapper;
+import org.apache.brooklyn.location.basic.SshMachineLocation;
+
+import brooklyn.util.collections.MutableList;
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.exceptions.Exceptions;
+import brooklyn.util.net.Urls;
+import brooklyn.util.os.Os;
+import brooklyn.util.stream.Streams;
+import brooklyn.util.text.Identifiers;
+import brooklyn.util.text.StringFunctions;
+import brooklyn.util.text.Strings;
+
+import com.google.common.base.Charsets;
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+import com.google.common.io.Files;
+
+/**
+ * The SSH implementation of the {@link PostgreSqlDriver}.
+ */
+public class PostgreSqlSshDriver extends AbstractSoftwareProcessSshDriver implements PostgreSqlDriver {
+
+    public static final Logger log = LoggerFactory.getLogger(PostgreSqlSshDriver.class);
+
+    public PostgreSqlSshDriver(PostgreSqlNodeImpl entity, SshMachineLocation machine) {
+        super(entity, machine);
+
+        entity.setAttribute(Attributes.LOG_FILE_LOCATION, getLogFile());
+    }
+
+    /*
+     * TODO this is much messier than we would like because postgres runs as user postgres,
+     * meaning the dirs must be RW by that user, and accessible (thus all parent paths),
+     * which may rule out putting it in a location used by the default user.
+     * Two irritating things:
+     * * currently we sometimes make up a different onbox base dir;
+     * * currently we put files to /tmp for staging
+     * Could investigate if it really needs to run as user postgres;
+     * could also see whether default user can be added to group postgres,
+     * and the run dir (and all parents) made accessible to group postgres.
+     */
+    @Override
+    public void install() {
+        String version = getEntity().getConfig(SoftwareProcess.SUGGESTED_VERSION);
+        String majorMinorVersion = version.substring(0, version.lastIndexOf("-"));
+        String shortVersion = majorMinorVersion.replace(".", "");
+
+        String altTarget = "/opt/brooklyn/postgres/";
+        String altInstallDir = Urls.mergePaths(altTarget, "install/"+majorMinorVersion);
+        
+        Iterable<String> pgctlLocations = ImmutableList.of(
+            altInstallDir+"/bin",
+            "/usr/lib/postgresql/"+majorMinorVersion+"/bin/",
+            "/opt/local/lib/postgresql"+shortVersion+"/bin/",
+            "/usr/pgsql-"+majorMinorVersion+"/bin",
+            "/usr/local/bin/",
+            "/usr/bin/",
+            "/bin/");
+
+        DynamicTasks.queueIfPossible(SshTasks.dontRequireTtyForSudo(getMachine(),
+            // sudo is absolutely required here, in customize we set user to postgres
+            OnFailingTask.FAIL)).orSubmitAndBlock();
+        DynamicTasks.waitForLast();
+
+        // Check whether we can find a usable pg_ctl, and if not install one
+        MutableList<String> findOrInstall = MutableList.<String>of()
+            .append("which pg_ctl")
+            .appendAll(Iterables.transform(pgctlLocations, StringFunctions.formatter("test -x %s/pg_ctl")))
+            .append(installPackage(ImmutableMap.of(
+                "yum", "postgresql"+shortVersion+" postgresql"+shortVersion+"-server",
+                "apt", "postgresql-"+majorMinorVersion,
+                "port", "postgresql"+shortVersion+" postgresql"+shortVersion+"-server"
+                ), null))
+                // due to impl of installPackage, it will not come to the line below I don't think
+                .append(warn(format("WARNING: failed to find or install postgresql %s binaries", majorMinorVersion)));
+
+        // Link to correct binaries folder (different versions of pg_ctl and psql don't always play well together)
+        MutableList<String> linkFromHere = MutableList.<String>of()
+            .append(ifExecutableElse1("pg_ctl", chainGroup(
+                "PG_EXECUTABLE=`which pg_ctl`",
+                "PG_DIR=`dirname $PG_EXECUTABLE`",
+                "echo 'found pg_ctl in '$PG_DIR' on path so linking PG bin/ to that dir'",
+                "ln -s $PG_DIR bin")))
+                .appendAll(Iterables.transform(pgctlLocations, givenDirIfFileExistsInItLinkToDir("pg_ctl", "bin")))
+                .append(fail(format("WARNING: failed to find postgresql %s binaries for pg_ctl, may already have another version installed; aborting", majorMinorVersion), 9));
+
+        newScript(INSTALLING)
+        .body.append(
+            dontRequireTtyForSudo(),
+            ifExecutableElse0("yum", getYumRepository(version, majorMinorVersion, shortVersion)),
+            ifExecutableElse0("apt-get", getAptRepository()),
+            "rm -f bin", // if left over from previous incomplete/failed install (not sure why that keeps happening!)
+            alternativesGroup(findOrInstall),
+            alternativesGroup(linkFromHere))
+            .failOnNonZeroResultCode()
+            .queue();
+        
+        // check that the proposed install dir is one that user postgres can access
+        if (DynamicTasks.queue(SshEffectorTasks.ssh(sudoAsUser("postgres", "ls "+getInstallDir())).allowingNonZeroExitCode()
+                .summary("check postgres user can access install dir")).asTask().getUnchecked()!=0) {
+            log.info("Postgres install dir "+getInstallDir()+" for "+getEntity()+" is not accessible to user 'postgres'; " + "using "+altInstallDir+" instead");
+            String newRunDir = Urls.mergePaths(altTarget, "apps", getEntity().getApplication().getId(), getEntity().getId());
+            if (DynamicTasks.queue(SshEffectorTasks.ssh("ls "+altInstallDir+"/pg_ctl").allowingNonZeroExitCode()
+                    .summary("check whether "+altInstallDir+" is set up")).asTask().getUnchecked()==0) {
+                // alt target already exists with binary; nothing to do for install
+            } else {
+                DynamicTasks.queue(SshEffectorTasks.ssh(
+                    "mkdir -p "+altInstallDir,
+                    "rm -rf '"+altInstallDir+"'",
+                    "mv "+getInstallDir()+" "+altInstallDir,
+                    "rm -rf '"+getInstallDir()+"'",
+                    "ln -s "+altInstallDir+" "+getInstallDir(),
+                    "mkdir -p " + newRunDir,
+                    "chown -R postgres:postgres "+altTarget).runAsRoot().requiringExitCodeZero()
+                    .summary("move install dir from user to postgres owned space"));
+            }
+            DynamicTasks.waitForLast();
+            setInstallDir(altInstallDir);
+            setRunDir(newRunDir);
+        }
+    }
+
+    private String getYumRepository(String version, String majorMinorVersion, String shortVersion) {
+        // postgres becomes available if you add the repos using an RPM such as
+        // http://yum.postgresql.org/9.3/redhat/rhel-6-i386/pgdg-centos93-9.3-1.noarch.rpm
+        // fedora, rhel, sl, and centos supported for RPM's
+
+        OsDetails osDetails = getMachine().getMachineDetails().getOsDetails();
+        String arch = osDetails.getArch();
+        String osMajorVersion = osDetails.getVersion();
+        String osName = osDetails.getName();
+
+        log.debug("postgres detecting yum information for "+getEntity()+" at "+getMachine()+": "+osName+", "+osMajorVersion+", "+arch);
+
+        if (osName==null) osName = ""; else osName = osName.toLowerCase();
+
+        if (osName.equals("ubuntu")) return "echo skipping yum repo setup as this is not an rpm environment";
+
+        if (osName.equals("rhel")) osName = "redhat";
+        else if (osName.equals("centos")) osName = "centos";
+        else if (osName.equals("sl") || osName.startsWith("scientific")) osName = "sl";
+        else if (osName.equals("fedora")) osName = "fedora";
+        else {
+            log.debug("insufficient OS family information '"+osName+"' for "+getMachine()+" when installing "+getEntity()+" (yum repos); treating as centos");
+            osName = "centos";
+        }
+
+        if (Strings.isBlank(arch)) {
+            log.warn("Insuffient architecture information '"+arch+"' for "+getMachine()+"when installing "+getEntity()+"; treating as x86_64");
+            arch = "x86_64";
+        }
+
+        if (Strings.isBlank(osMajorVersion)) {
+            if (osName.equals("fedora")) osMajorVersion = "20";
+            else osMajorVersion = "6";
+            log.warn("Insuffient OS version information '"+getMachine().getOsDetails().getVersion()+"' for "+getMachine()+"when installing "+getEntity()+" (yum repos); treating as "+osMajorVersion);
+        } else {
+            if (osMajorVersion.indexOf(".")>0) 
+                osMajorVersion = osMajorVersion.substring(0, osMajorVersion.indexOf('.'));
+        }
+
+        return chainGroup(
+                INSTALL_WGET,
+                sudo(format("wget http://yum.postgresql.org/%s/redhat/rhel-%s-%s/pgdg-%s%s-%s.noarch.rpm", majorMinorVersion, osMajorVersion, arch, osName, shortVersion, version)),
+                sudo(format("rpm -Uvh pgdg-%s%s-%s.noarch.rpm", osName, shortVersion, version))
+            );
+    }
+
+    private String getAptRepository() {
+        return chainGroup(
+                INSTALL_WGET,
+                "wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo tee -a apt-key add -",
+                "echo \"deb http://apt.postgresql.org/pub/repos/apt/   $(sudo lsb_release --codename --short)-pgdg main\" | sudo tee -a /etc/apt/sources.list.d/postgresql.list"
+            );
+    }
+
+    private static Function<String, String> givenDirIfFileExistsInItLinkToDir(final String filename, final String linkToMake) {
+        return new Function<String, String>() {
+            public String apply(@Nullable String dir) {
+                return ifExecutableElse1(Urls.mergePaths(dir, filename),
+                    chainGroup("echo 'found "+filename+" in "+dir+" so linking to it in "+linkToMake+"'", "ln -s "+dir+" "+linkToMake));
+            }
+        };
+    }
+
+    @Override
+    public void customize() {
+        // Some OSes start postgres during package installation
+        DynamicTasks.queue(SshEffectorTasks.ssh(sudoAsUser("postgres", "/etc/init.d/postgresql stop")).allowingNonZeroExitCode()).get();
+
+        newScript(CUSTOMIZING)
+        .body.append(
+            sudo("mkdir -p " + getDataDir()),
+            sudo("chown postgres:postgres " + getDataDir()),
+            sudo("chmod 700 " + getDataDir()),
+            sudo("touch " + getLogFile()),
+            sudo("chown postgres:postgres " + getLogFile()),
+            sudo("touch " + getPidFile()),
+            sudo("chown postgres:postgres " + getPidFile()),
+            alternativesGroup(
+                chainGroup(format("test -e %s", getInstallDir() + "/bin/initdb"),
+                    sudoAsUser("postgres", getInstallDir() + "/bin/initdb -D " + getDataDir())),
+                    callPgctl("initdb", true)))
+                    .failOnNonZeroResultCode()
+                    .execute();
+
+        String configUrl = getEntity().getConfig(PostgreSqlNode.CONFIGURATION_FILE_URL);
+        if (Strings.isBlank(configUrl)) {
+            // http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
+            // If the same setting is listed multiple times, the last one wins.
+            DynamicTasks.queue(SshEffectorTasks.ssh(
+                executeCommandThenAsUserTeeOutputToFile(
+                    chainGroup(
+                        "echo \"listen_addresses = '*'\"",
+                        "echo \"port = " + getEntity().getPostgreSqlPort() +  "\"",
+                        "echo \"max_connections = " + getEntity().getMaxConnections() +  "\"",
+                        "echo \"shared_buffers = " + getEntity().getSharedMemory() +  "\"",
+                        "echo \"external_pid_file = '" + getPidFile() +  "'\""),
+                        "postgres", getDataDir() + "/postgresql.conf")));
+        } else {
+            String contents = processTemplate(configUrl);
+            DynamicTasks.queue(
+                SshEffectorTasks.put("/tmp/postgresql.conf").contents(contents),
+                SshEffectorTasks.ssh(sudoAsUser("postgres", "cp /tmp/postgresql.conf " + getDataDir() + "/postgresql.conf")));
+        }
+
+        String authConfigUrl = getEntity().getConfig(PostgreSqlNode.AUTHENTICATION_CONFIGURATION_FILE_URL);
+        if (Strings.isBlank(authConfigUrl)) {
+            DynamicTasks.queue(SshEffectorTasks.ssh(
+                // TODO give users control which hosts can connect and the authentication mechanism
+                executeCommandThenAsUserTeeOutputToFile("echo \"host all all 0.0.0.0/0 md5\"", "postgres", getDataDir() + "/pg_hba.conf")));
+        } else {
+            String contents = processTemplate(authConfigUrl);
+            DynamicTasks.queue(
+                SshEffectorTasks.put("/tmp/pg_hba.conf").contents(contents),
+                SshEffectorTasks.ssh(sudoAsUser("postgres", "cp /tmp/pg_hba.conf " + getDataDir() + "/pg_hba.conf")));
+        }
+
+        // Wait for commands to complete before running the creation script
+        DynamicTasks.waitForLast();
+
+        // Capture log file contents if there is an error configuring the database
+        try {
+            executeDatabaseCreationScript();
+        } catch (RuntimeException r) {
+            logTailOfPostgresLog();
+            throw Exceptions.propagate(r);
+        }
+
+        // Try establishing an external connection. If you get a "Connection refused...accepting TCP/IP connections
+        // on port 5432?" error then the port is probably closed. Check that the firewall allows external TCP/IP
+        // connections (netstat -nap). You can open a port with lokkit or by configuring the iptables.
+    }
+
+    protected void executeDatabaseCreationScript() {
+        if (copyDatabaseCreationScript()) {
+            newScript("running postgres creation script")
+            .body.append(
+                "cd " + getInstallDir(),
+                callPgctl("start", true),
+                sudoAsUser("postgres", getInstallDir() + "/bin/psql -p " + entity.getAttribute(PostgreSqlNode.POSTGRESQL_PORT) + " --file " + getRunDir() + "/creation-script.sql"),
+                callPgctl("stop", true))
+                .failOnNonZeroResultCode()
+                .execute();
+        }
+    }
+
+    private boolean installFile(InputStream contents, String destName) {
+        String uid = Identifiers.makeRandomId(8);
+        // TODO currently put in /tmp for staging, since run dir may not be accessible to ssh user
+        getMachine().copyTo(contents, "/tmp/"+destName+"_"+uid);
+        DynamicTasks.queueIfPossible(SshEffectorTasks.ssh(
+            "cd "+getRunDir(), 
+            "mv /tmp/"+destName+"_"+uid+" "+destName,
+            "chown postgres:postgres "+destName,
+            "chmod 644 "+destName)
+            .runAsRoot().requiringExitCodeZero())
+            .orSubmitAndBlock(getEntity()).andWaitForSuccess();
+        return true;
+    }
+    private boolean copyDatabaseCreationScript() {
+        InputStream creationScript = DatastoreMixins.getDatabaseCreationScript(entity);
+        if (creationScript==null)
+            return false;
+        return installFile(creationScript, "creation-script.sql");
+    }
+
+    public String getDataDir() {
+        return getRunDir() + "/data";
+    }
+
+    public String getLogFile() {
+        return getRunDir() + "/postgresql.log";
+    }
+
+    public String getPidFile() {
+        return getRunDir() + "/postgresql.pid";
+    }
+
+    /** @deprecated since 0.7.0 renamed {@link #logTailOfPostgresLog()} */
+    @Deprecated
+    public void copyLogFileContents() { logTailOfPostgresLog(); }
+    public void logTailOfPostgresLog() {
+        try {
+            File file = Os.newTempFile("postgresql-"+getEntity().getId(), "log");
+            int result = getMachine().copyFrom(getLogFile(), file.getAbsolutePath());
+            if (result != 0) throw new IllegalStateException("Could not access log file " + getLogFile());
+            log.info("Saving {} contents as {}", getLogFile(), file);
+            Streams.logStreamTail(log, "postgresql.log", Streams.byteArrayOfString(Files.toString(file, Charsets.UTF_8)), 1024);
+            file.delete();
+        } catch (IOException ioe) {
+            log.debug("Error reading copied log file: {}", ioe);
+        }
+    }
+
+    protected String callPgctl(String command, boolean waitForIt) {
+        return sudoAsUser("postgres", getInstallDir() + "/bin/pg_ctl -D " + getDataDir() +
+            " -l " + getLogFile() + (waitForIt ? " -w " : " ") + command);
+    }
+
+    @Override
+    public void launch() {
+        log.info(String.format("Starting entity %s at %s", this, getLocation()));
+        newScript(MutableMap.of("usePidFile", false), LAUNCHING)
+        .body.append(callPgctl("start", false))
+        .execute();
+    }
+
+    @Override
+    public boolean isRunning() {
+        return newScript(MutableMap.of("usePidFile", getPidFile()), CHECK_RUNNING)
+            .body.append(getStatusCmd())
+            .execute() == 0;
+    }
+
+    @Override
+    public void stop() {
+        newScript(MutableMap.of("usePidFile", false), STOPPING)
+        .body.append(callPgctl((entity.getConfig(PostgreSqlNode.DISCONNECT_ON_STOP) ? "-m immediate " : "") + "stop", false))
+        .failOnNonZeroResultCode()
+        .execute();
+        newScript(MutableMap.of("usePidFile", getPidFile(), "processOwner", "postgres"), STOPPING).execute();
+    }
+
+    @Override
+    public PostgreSqlNodeImpl getEntity() {
+        return (PostgreSqlNodeImpl) super.getEntity();
+    }
+
+    @Override
+    public String getStatusCmd() {
+        return callPgctl("status", false);
+    }
+
+    public ProcessTaskWrapper<Integer> executeScriptAsync(String commands) {
+        String filename = "postgresql-commands-"+Identifiers.makeRandomId(8);
+        installFile(Streams.newInputStreamWithContents(commands), filename);
+        return executeScriptFromInstalledFileAsync(filename);
+    }
+
+    public ProcessTaskWrapper<Integer> executeScriptFromInstalledFileAsync(String filenameAlreadyInstalledAtServer) {
+        return DynamicTasks.queue(
+            SshEffectorTasks.ssh(
+                "cd "+getRunDir(),
+                sudoAsUser("postgres", getInstallDir() + "/bin/psql -p " + entity.getAttribute(PostgreSqlNode.POSTGRESQL_PORT) + " --file " + filenameAlreadyInstalledAtServer))
+                .summary("executing datastore script "+filenameAlreadyInstalledAtServer));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepDriver.java
----------------------------------------------------------------------
diff --git a/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepDriver.java b/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepDriver.java
new file mode 100644
index 0000000..056dd3d
--- /dev/null
+++ b/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepDriver.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.entity.database.rubyrep;
+
+import brooklyn.entity.basic.SoftwareProcessDriver;
+
+/**
+ * The driver interface for {@link RubyRepNode}.
+ */
+public interface RubyRepDriver extends SoftwareProcessDriver {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepNode.java
----------------------------------------------------------------------
diff --git a/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepNode.java b/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepNode.java
new file mode 100644
index 0000000..207d233
--- /dev/null
+++ b/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepNode.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.entity.database.rubyrep;
+
+import org.apache.brooklyn.api.catalog.Catalog;
+import org.apache.brooklyn.api.entity.proxying.ImplementedBy;
+import org.apache.brooklyn.api.event.AttributeSensor;
+import org.apache.brooklyn.core.util.flags.SetFromFlag;
+
+import brooklyn.config.ConfigKey;
+import brooklyn.entity.basic.Attributes;
+import brooklyn.entity.basic.ConfigKeys;
+import brooklyn.entity.basic.SoftwareProcess;
+import org.apache.brooklyn.entity.database.DatastoreMixins;
+import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
+import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
+import brooklyn.event.basic.BasicAttributeSensorAndConfigKey.StringAttributeSensorAndConfigKey;
+import brooklyn.event.basic.Sensors;
+
+@Catalog(name = "RubyRep Node", description = "RubyRep is a database replication system", iconUrl = "classpath:///rubyrep-logo.jpeg")
+@ImplementedBy(RubyRepNodeImpl.class)
+public interface RubyRepNode extends SoftwareProcess {
+
+    @SetFromFlag("version")
+    ConfigKey<String> SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "1.2.0");
+
+    @SetFromFlag("downloadUrl")
+    public static final BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = new StringAttributeSensorAndConfigKey(
+            Attributes.DOWNLOAD_URL, "http://files.rubyforge.vm.bytemark.co.uk/rubyrep/rubyrep-${version}.zip");
+
+    @SetFromFlag("configurationScriptUrl")
+    ConfigKey<String> CONFIGURATION_SCRIPT_URL = ConfigKeys.newStringConfigKey(
+            "database.rubyrep.configScriptUrl",
+            "URL where RubyRep configuration can be found - disables other configuration options (except version)");
+
+    @SetFromFlag("templateUrl")
+    ConfigKey<String> TEMPLATE_CONFIGURATION_URL = ConfigKeys.newStringConfigKey(
+            "database.rubyrep.templateConfigurationUrl", "Template file (in freemarker format) for the rubyrep.conf file",
+            "classpath://org/apache/brooklyn/entity/database/rubyrep/rubyrep.conf");
+
+    @SetFromFlag("tables")
+    ConfigKey<String> TABLE_REGEXP = ConfigKeys.newStringConfigKey(
+            "database.rubyrep.tableRegex", "Regular expression to select tables to sync using RubyRep", ".");
+
+    @SetFromFlag("replicationInterval")
+    ConfigKey<Integer> REPLICATION_INTERVAL = ConfigKeys.newIntegerConfigKey(
+            "database.rubyrep.replicationInterval", "Replication Interval", 30);
+
+    @SetFromFlag("startupTimeout")
+    ConfigKey<Integer> DATABASE_STARTUP_TIMEOUT = ConfigKeys.newIntegerConfigKey(
+            "database.rubyrep.startupTimeout", "Time to wait until databases have started up (in seconds)", 120);
+
+    // Left database
+
+    AttributeSensor<String> LEFT_DATASTORE_URL = Sensors.newSensorWithPrefix("left", DatastoreMixins.DATASTORE_URL);
+
+    @SetFromFlag("leftDatabase")
+    ConfigKey<? extends DatastoreCommon> LEFT_DATABASE = ConfigKeys.newConfigKey(DatastoreCommon.class,
+            "database.rubyrep.leftDatabase", "Brooklyn database entity to use as the left DBMS");
+
+    @SetFromFlag("leftDatabaseName")
+    ConfigKey<String> LEFT_DATABASE_NAME = ConfigKeys.newStringConfigKey(
+            "database.rubyrep.leftDatabaseName", "name of database to use for left db");
+
+    @SetFromFlag("leftUsername")
+    ConfigKey<String> LEFT_USERNAME = ConfigKeys.newStringConfigKey(
+            "database.rubyrep.leftUsername", "username to connect to left db");
+
+    @SetFromFlag("leftPassword")
+    ConfigKey<String> LEFT_PASSWORD = ConfigKeys.newStringConfigKey(
+            "database.rubyrep.leftPassword", "password to connect to left db");
+
+    // Right database
+
+    AttributeSensor<String> RIGHT_DATASTORE_URL = Sensors.newSensorWithPrefix("right", DatastoreMixins.DATASTORE_URL);
+
+    @SetFromFlag("rightDatabase")
+    ConfigKey<? extends DatastoreCommon> RIGHT_DATABASE = ConfigKeys.newConfigKey(DatastoreCommon.class,
+            "database.rubyrep.rightDatabase", "Brooklyn database entity to use as the right DBMS");
+
+    @SetFromFlag("rightDatabaseName")
+    ConfigKey<String> RIGHT_DATABASE_NAME = ConfigKeys.newStringConfigKey(
+            "database.rubyrep.rightDatabaseName", "name of database to use for right db");
+
+    @SetFromFlag("rightUsername")
+    ConfigKey<String> RIGHT_USERNAME = ConfigKeys.newStringConfigKey(
+            "database.rubyrep.rightUsername", "username to connect to right db");
+
+    @SetFromFlag("rightPassword")
+    ConfigKey<String> RIGHT_PASSWORD = ConfigKeys.newStringConfigKey(
+            "database.rubyrep.rightPassword", "password to connect to right db");
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepNodeImpl.java
----------------------------------------------------------------------
diff --git a/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepNodeImpl.java b/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepNodeImpl.java
new file mode 100644
index 0000000..282608f
--- /dev/null
+++ b/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepNodeImpl.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.entity.database.rubyrep;
+
+import java.net.URI;
+
+import brooklyn.entity.basic.Entities;
+import brooklyn.entity.basic.SoftwareProcessImpl;
+import org.apache.brooklyn.entity.database.DatastoreMixins.DatastoreCommon;
+import brooklyn.event.basic.DependentConfiguration;
+import brooklyn.util.time.Duration;
+
+public class RubyRepNodeImpl extends SoftwareProcessImpl implements RubyRepNode {
+
+    @Override
+    protected void connectSensors() {
+        super.connectSensors();
+        connectServiceUpIsRunning();
+    }
+
+    @Override
+    public void disconnectSensors() {
+        disconnectServiceUpIsRunning();
+        super.disconnectSensors();
+    }
+
+    /**
+     * Set the database {@link DatastoreCommon#DATASTORE_URL urls} as attributes when they become available on the entities.
+     */
+    @Override
+    protected void preStart() {
+        super.preStart();
+
+        DatastoreCommon leftNode = getConfig(LEFT_DATABASE);
+        if (leftNode != null) {
+            setAttribute(LEFT_DATASTORE_URL, Entities.submit(this, DependentConfiguration.attributeWhenReady(leftNode, DatastoreCommon.DATASTORE_URL)).getUnchecked(getDatabaseStartupDelay()));
+        }
+
+        DatastoreCommon rightNode = getConfig(RIGHT_DATABASE);
+        if (rightNode != null) {
+            setAttribute(RIGHT_DATASTORE_URL, Entities.submit(this, DependentConfiguration.attributeWhenReady(rightNode, DatastoreCommon.DATASTORE_URL)).getUnchecked(getDatabaseStartupDelay()));
+        }
+    }
+
+    @Override
+    public Class<?> getDriverInterface() {
+        return RubyRepDriver.class;
+    }
+
+    public Duration getDatabaseStartupDelay() {
+        return Duration.seconds(getConfig(DATABASE_STARTUP_TIMEOUT));
+    }
+
+    // Accessors used in freemarker template processing
+
+    public int getReplicationInterval() {
+        return getConfig(REPLICATION_INTERVAL);
+    }
+    
+    public String getTableRegex() {
+        return getConfig(TABLE_REGEXP);
+    }
+    
+    public URI getLeftDatabaseUrl() {
+        return URI.create(getAttribute(LEFT_DATASTORE_URL));
+    }
+    
+    public String getLeftDatabaseName() {
+        return getConfig(LEFT_DATABASE_NAME);
+    }
+
+    public String getLeftUsername() {
+        return getConfig(LEFT_USERNAME);
+    }
+
+    public String getLeftPassword() {
+        return getConfig(LEFT_PASSWORD);
+    }
+
+    public URI getRightDatabaseUrl() {
+        return URI.create(getAttribute(RIGHT_DATASTORE_URL));
+    }
+
+    public String getRightDatabaseName() {
+        return getConfig(RIGHT_DATABASE_NAME);
+    }
+
+    public String getRightUsername() {
+        return getConfig(RIGHT_USERNAME);
+    }
+
+    public String getRightPassword() {
+        return getConfig(RIGHT_PASSWORD);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepSshDriver.java
----------------------------------------------------------------------
diff --git a/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepSshDriver.java b/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepSshDriver.java
new file mode 100644
index 0000000..ad8bfde
--- /dev/null
+++ b/software/database/src/main/java/org/apache/brooklyn/entity/database/rubyrep/RubyRepSshDriver.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.entity.database.rubyrep;
+
+import static java.lang.String.format;
+
+import java.io.Reader;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+import org.apache.brooklyn.api.entity.basic.EntityLocal;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import brooklyn.entity.basic.AbstractSoftwareProcessSshDriver;
+import brooklyn.entity.basic.Attributes;
+import brooklyn.entity.basic.Entities;
+import org.apache.brooklyn.location.basic.SshMachineLocation;
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.os.Os;
+import brooklyn.util.ssh.BashCommands;
+import brooklyn.util.stream.Streams;
+
+import com.google.common.collect.ImmutableList;
+
+public class RubyRepSshDriver extends AbstractSoftwareProcessSshDriver implements RubyRepDriver {
+
+    public static final Logger log = LoggerFactory.getLogger(RubyRepSshDriver.class);
+
+    public RubyRepSshDriver(EntityLocal entity, SshMachineLocation machine) {
+        super(entity, machine);
+
+        entity.setAttribute(Attributes.LOG_FILE_LOCATION, getLogFileLocation());
+    }
+
+    protected String getLogFileLocation() {
+        return Os.mergePaths(getRunDir(), "log", "rubyrep.log");
+    }
+
+    @Override
+    public void preInstall() {
+        resolver = Entities.newDownloader(this);
+        setExpandedInstallDir(Os.mergePaths(getInstallDir(), resolver.getUnpackedDirectoryName(format("rubyrep-%s", getVersion()))));
+    }
+
+    @Override
+    public void install() {
+        List<String> urls = resolver.getTargets();
+        String saveAs = resolver.getFilename();
+
+        List<String> commands = ImmutableList.<String>builder()
+                .addAll(BashCommands.commandsToDownloadUrlsAs(urls, saveAs))
+                .add(BashCommands.INSTALL_UNZIP)
+                .add("unzip " + saveAs)
+                .build();
+
+        newScript(INSTALLING)
+                .body.append(commands)
+                .failOnNonZeroResultCode()
+                .execute();
+    }
+
+    @Override
+    public void customize() {
+        newScript(CUSTOMIZING)
+                .body.append(format("cp -R %s %s", getExpandedInstallDir(), getRunDir()))
+                .failOnNonZeroResultCode()
+                .execute();
+        try {
+            customizeConfiguration();
+        } catch (Exception e) {
+            log.error("Failed to configure rubyrep, replication is unlikely to succeed", e);
+        }
+    }
+
+    protected void customizeConfiguration() throws ExecutionException, InterruptedException, URISyntaxException {
+        log.info("Copying creation script " + getEntity().toString());
+
+        // TODO check these semantics are what we really want?
+        String configScriptUrl = entity.getConfig(RubyRepNode.CONFIGURATION_SCRIPT_URL);
+        Reader configContents;
+        if (configScriptUrl != null) {
+            // If set accept as-is
+            configContents = Streams.reader(resource.getResourceFromUrl(configScriptUrl));
+        } else {
+            String configScriptContents = processTemplate(entity.getConfig(RubyRepNode.TEMPLATE_CONFIGURATION_URL));
+            configContents = Streams.newReaderWithContents(configScriptContents);
+        }
+
+        getMachine().copyTo(configContents, getRunDir() + "/rubyrep.conf");
+    }
+
+    @Override
+    public void launch() {
+        newScript(MutableMap.of("usePidFile", true), LAUNCHING)
+                .body.append(format("nohup rubyrep-%s/jruby/bin/jruby rubyrep-%s/bin/rubyrep replicate -c rubyrep.conf > ./console 2>&1 &", getVersion(), getVersion()))
+                .execute();
+    }
+
+    @Override
+    public boolean isRunning() {
+        return newScript(MutableMap.of("usePidFile", true), CHECK_RUNNING).execute() == 0;
+    }
+
+    @Override
+    public void stop() {
+        newScript(MutableMap.of("usePidFile", true), STOPPING).execute();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/crate/crate.yaml
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/crate/crate.yaml b/software/database/src/main/resources/brooklyn/entity/database/crate/crate.yaml
deleted file mode 100644
index 42fcee5..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/crate/crate.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-# The Crate distribution comes with comprehensive instructions on available
-# configuration. Select sections are reproduced here.
-
-
-############################## Network And HTTP ###############################
-
-# Crate, by default, binds itself to the 0.0.0.0 address, and listens
-# on port [4200-4300] for HTTP traffic and on port [4300-4400] for node-to-node
-# communication. (the range means that if the port is busy, it will automatically
-# try the next port).
-
-# Set both 'bind_host' and 'publish_host':
-network.host: ${driver.subnetHostname}
-
-# Set a custom port for the node to node communication (4300 by default):
-transport.tcp.port: ${entity.port?c}
-
-# Set a custom port to listen for HTTP traffic:
-http.port: ${entity.httpPort?c}
-
-
-#################################### Paths ####################################
-
-# Path to directory where to store table data allocated for this node.
-path.data: ${driver.dataLocation}
-
-# Path to log files:
-path.logs: ${driver.runDir}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mariadb/my.cnf
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mariadb/my.cnf b/software/database/src/main/resources/brooklyn/entity/database/mariadb/my.cnf
deleted file mode 100644
index d78f88e..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mariadb/my.cnf
+++ /dev/null
@@ -1,19 +0,0 @@
-[client]
-port            = ${driver.port?c}
-socket          = /tmp/mysql.sock.${entity.socketUid}.${driver.port?c}
-user            = root
-password        = ${entity.password}
-
-# Here follows entries for some specific programs
-
-# The MariaDB server, which (confusingly) uses MySQL terminology for backwards compatibility
-[mysqld]
-port            = ${driver.port?c}
-socket          = /tmp/mysql.sock.${entity.socketUid}.${driver.port?c}
-basedir         = ${driver.baseDir}
-datadir         = ${driver.dataDir}
-bind-address    = 0.0.0.0
-# skip-networking
-
-# Custom configuration options
-${driver.mariaDbServerOptionsString}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mssql/ConfigurationFile.ini
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mssql/ConfigurationFile.ini b/software/database/src/main/resources/brooklyn/entity/database/mssql/ConfigurationFile.ini
deleted file mode 100644
index ee437ac..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mssql/ConfigurationFile.ini
+++ /dev/null
@@ -1,390 +0,0 @@
-;SQL Server 2012 Configuration File
-
-
-[OPTIONS]
-
-
-
-; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter. 
-
-
-
-ACTION="Install"
-
-; Detailed help for command line argument ROLE has not been defined yet.
-
-ROLE="AllFeatures_WithDefaults"
-
-
-; Detailed help for command line argument ENU has not been defined yet. 
-
-
-
-ENU="True"
-
-
-
-; Setup will not display any user interface. 
-
-
-
-QUIET="True"
-
- 
-
-; Setup will display progress only, without any user interaction. 
-
-
-
-QUIETSIMPLE="False"
-
-
-
-; Specify whether SQL Server Setup should discover and include product updates. The valid values are True and False or 1 and 0. By default SQL Server Setup will include updates that are found. 
-
-
-
-UpdateEnabled="False"
-
-
-
-; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, MDS, and Tools. The SQL feature will install the Database Engine, Replication, Full-Text, and Data Quality Services (DQS) server. The Tools feature will install Management Tools, Books online components, SQL Server Data Tools, and other shared components. 
-
-
-
-FEATURES="${config['mssql.features']}"
-
-
-
-; Specify the location where SQL Server Setup will obtain product updates. The valid values are "MU" to search Microsoft Update, a valid folder path, a relative path such as .\MyUpdates or a UNC share. By default SQL Server Setup will search Microsoft Update or a Windows Update service through the Window Server Update Services. 
-
-
-
-UpdateSource="MU"
-
-
-
-; Displays the command line parameters usage 
-
-
-
-HELP="False"
-
-
-
-; Specifies that the detailed Setup log should be piped to the console. 
-
-
-
-INDICATEPROGRESS="True"
-
-
-
-; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system. 
-
-
-
-X86="False"
-
-
-
-; Specify the root installation directory for shared components.  This directory remains unchanged after shared components are already installed. 
-
-
-
-INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server"
-
-
-
-; Specify the root installation directory for the WOW64 shared components.  This directory remains unchanged after WOW64 shared components are already installed. 
-
-
-
-INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server"
-
-
-
-; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS). 
-
-
-
-INSTANCENAME="MSSQLSERVER"
-
-
-
-; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will incorporate the instance ID of the SQL Server instance. 
-
-
-
-INSTANCEID="MSSQLSERVER"
-
-
-
-; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature. 
-
-
-
-SQMREPORTING="False"
-
-
-; The account used by the Distributed Replay Controller service.
-
-CTLRSVCACCOUNT="NT Service\SQL Server Distributed Replay Controller"
-
-; The startup type for the Distributed Replay Controller service.
-
-CTLRSTARTUPTYPE="Manual"
-
-; The account used by the Distributed Replay Client service.
-
-CLTSVCACCOUNT="NT Service\SQL Server Distributed Replay Client"
-
-; The startup type for the Distributed Replay Client service.
-
-CLTSTARTUPTYPE="Manual"
-
-; The result directory for the Distributed Replay Client service.
-
-CLTRESULTDIR="C:\Program Files (x86)\Microsoft SQL Server\DReplayClient\ResultDir"
-
-; The working directory for the Distributed Replay Client service.
-
-CLTWORKINGDIR="C:\Program Files (x86)\Microsoft SQL Server\DReplayClient\WorkingDir"
-
-; RSInputSettings_RSInstallMode_Description
-
-RSINSTALLMODE="DefaultNativeMode"
-
-; RSInputSettings_RSInstallMode_Description
-
-RSSHPINSTALLMODE="SharePointFilesOnlyMode"
-
-; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature.
-
-
-
-; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature. 
-
-
-
-ERRORREPORTING="False"
-
-
-
-; Specify the installation directory. 
-
-
-
-INSTANCEDIR="C:\Program Files\Microsoft SQL Server"
-
-
-
-; Agent account name 
-
-
-
-AGTSVCACCOUNT="NT Service\SQLSERVERAGENT"
-
-
-
-; Auto-start service after installation.  
-
-
-
-AGTSVCSTARTUPTYPE="Automatic"
-
-
-; Startup type for Integration Services.
-
-ISSVCSTARTUPTYPE="Automatic"
-
-; Account for Integration Services: Domain\User or system account.
-
-ISSVCACCOUNT="NT Service\MsDtsServer110"
-
-; The name of the account that the Analysis Services service runs under.
-
-ASSVCACCOUNT="NT Service\MSSQLServerOLAPService"
-
-; Controls the service startup type setting after the service has been created.
-
-ASSVCSTARTUPTYPE="Automatic"
-
-; The collation to be used by Analysis Services.
-
-ASCOLLATION="Latin1_General_CI_AS"
-
-; The location for the Analysis Services data files.
-
-ASDATADIR="C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Data"
-
-; The location for the Analysis Services log files.
-
-ASLOGDIR="C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Log"
-
-; The location for the Analysis Services backup files.
-
-ASBACKUPDIR="C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Backup"
-
-; The location for the Analysis Services temporary files.
-
-ASTEMPDIR="C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Temp"
-
-; The location for the Analysis Services configuration files.
-
-ASCONFIGDIR="C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Config"
-
-; Specifies whether or not the MSOLAP provider is allowed to run in process.
-
-ASPROVIDERMSOLAP="1"
-
-; Specifies the list of administrator accounts that need to be provisioned.
-
-ASSYSADMINACCOUNTS="BUILTIN\Administrators"
-
-; Specifies the server mode of the Analysis Services instance. Valid values are MULTIDIMENSIONAL and TABULAR. The default value is MULTIDIMENSIONAL.
-
-ASSERVERMODE="MULTIDIMENSIONAL"
-
-; CM brick TCP communication port 
-
-
-
-COMMFABRICPORT="0"
-
-
-
-; How matrix will use private networks 
-
-
-
-COMMFABRICNETWORKLEVEL="0"
-
-
-
-; How inter brick communication will be protected 
-
-
-
-COMMFABRICENCRYPTION="0"
-
-
-
-; TCP port used by the CM brick 
-
-
-
-MATRIXCMBRICKCOMMPORT="0"
-
-
-
-; Startup type for the SQL Server service. 
-
-
-
-SQLSVCSTARTUPTYPE="Automatic"
-
-
-
-; Level to enable FILESTREAM feature at (0, 1, 2 or 3). 
-
-
-
-FILESTREAMLEVEL="0"
-
-
-
-; Set to "1" to enable RANU for SQL Server Express. 
-
-
-
-ENABLERANU="False"
-
-
-
-; Specifies a Windows collation or an SQL collation to use for the Database Engine. 
-
-
-
-SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS"
-
-
-
-; Account for SQL Server service: Domain\User or system account. 
-
-
-
-SQLSVCACCOUNT="NT Service\MSSQLSERVER"
-
-
-
-; Windows account(s) to provision as SQL Server system administrators. 
-
-
-
-SQLSYSADMINACCOUNTS="BUILTIN\Administrators"
-
-
-
-; The default is Windows Authentication. Use "SQL" for Mixed Mode Authentication. 
-
-
-
-SECURITYMODE="SQL"
-
-
-SAPWD="${config['mssql.sa.password']}"
-
-
-
-; Provision current user as a Database Engine system administrator for SQL Server 2012 Express. 
-
-
-
-ADDCURRENTUSERASSQLADMIN="False"
-
-
-
-; Specify 0 to disable or 1 to enable the TCP/IP protocol. 
-
-
-
-TCPENABLED="1"
-
-
-
-; Specify 0 to disable or 1 to enable the Named Pipes protocol. 
-
-
-
-NPENABLED="0"
-
-
-
-; Startup type for Browser Service. 
-
-
-
-BROWSERSVCSTARTUPTYPE="Disabled"
-
-
-; Specifies which account the report server NT service should execute under.  When omitted or when the value is empty string, the default built-in account for the current operating system.
-; The username part of RSSVCACCOUNT is a maximum of 20 characters long and
-; The domain part of RSSVCACCOUNT is a maximum of 254 characters long.
-
-RSSVCACCOUNT="NT Service\ReportServer"
-
-; Specifies how the startup mode of the report server NT service.  When
-; Manual - Service startup is manual mode (default).
-; Automatic - Service startup is automatic mode.
-; Disabled - Service is disabled
-
-RSSVCSTARTUPTYPE="Automatic"
-
-; Add description of input argument FTSVCACCOUNT
-
-FTSVCACCOUNT="NT Service\MSSQLFDLauncher"
-
-
-
-IAcceptSQLServerLicenseTerms="True"

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mssql/checkrunningmssql.bat
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mssql/checkrunningmssql.bat b/software/database/src/main/resources/brooklyn/entity/database/mssql/checkrunningmssql.bat
deleted file mode 100644
index 34512c8..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mssql/checkrunningmssql.bat
+++ /dev/null
@@ -1,23 +0,0 @@
-[#ftl]
-@echo off
-REM Licensed to the Apache Software Foundation (ASF) under one
-REM or more contributor license agreements.  See the NOTICE file
-REM distributed with this work for additional information
-REM regarding copyright ownership.  The ASF licenses this file
-REM to you under the Apache License, Version 2.0 (the
-REM "License"); you may not use this file except in compliance
-REM with the License.  You may obtain a copy of the License at
-REM
-REM   http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing,
-REM software distributed under the License is distributed on an
-REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-REM KIND, either express or implied.  See the License for the
-REM specific language governing permissions and limitations
-REM under the License.
-
-set serviceName=MSSQL\$${config['mssql.instance.name']}
-
-[#noparse]
-sc query %serviceName% | find "RUNNING"

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mssql/configuremssql.ps1
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mssql/configuremssql.ps1 b/software/database/src/main/resources/brooklyn/entity/database/mssql/configuremssql.ps1
deleted file mode 100644
index 06522fd..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mssql/configuremssql.ps1
+++ /dev/null
@@ -1,22 +0,0 @@
-[#ftl]
-#!ps1
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#  http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-netsh advfirewall firewall add rule name=SQLPort dir=in protocol=tcp action=allow localport=1433 remoteip=any profile=any
-( Get-WmiObject -Namespace "root\Microsoft\SqlServer\ComputerManagement11" -Query "Select * from ServerNetworkProtocolProperty where ProtocolName='Tcp' and IPAddressName='IPAll' and PropertyName='TcpPort'" ).SetStringValue("1433")

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mssql/installmssql.ps1
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mssql/installmssql.ps1 b/software/database/src/main/resources/brooklyn/entity/database/mssql/installmssql.ps1
deleted file mode 100644
index 6c1f30b..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mssql/installmssql.ps1
+++ /dev/null
@@ -1,49 +0,0 @@
-[#ftl]
-#!ps1
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#  http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-$Url = "${config['mssql.download.url']}"
-$Path = "C:\sql2008.iso"
-$Username = "${config['mssql.download.user']}"
-$Password = '${config['mssql.download.password']}'
-
-
-$WebClient = New-Object System.Net.WebClient
-$WebClient.Credentials = New-Object System.Net.Networkcredential($Username, $Password)
-$WebClient.DownloadFile( $url, $path )
-
-$mountResult = Mount-DiskImage $Path -PassThru
-$driveLetter = (($mountResult | Get-Volume).DriveLetter) + ":\"
-
-New-Item -ItemType Directory -Force -Path "C:\Program Files (x86)\Microsoft SQL Server\DReplayClient\ResultDir"
-New-Item -ItemType Directory -Force -Path "C:\Program Files (x86)\Microsoft SQL Server\DReplayClient\WorkingDir"
-
-Install-WindowsFeature NET-Framework-Core
-
-$pass = '${attribute['windows.password']}'
-$secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
-$mycreds = New-Object System.Management.Automation.PSCredential ($($env:COMPUTERNAME + "\Administrator"), $secpasswd)
-
-Invoke-Command -ComputerName localhost -credential $mycreds -scriptblock {
-    param($driveLetter)
-    Start-Process ( $driveLetter + "setup.exe") -ArgumentList "/ConfigurationFile=C:\ConfigurationFile.ini" -RedirectStandardOutput "C:\sqlout.txt" -RedirectStandardError "C:\sqlerr.txt" -Wait
-} -Authentication CredSSP -argumentlist $driveLetter
-
-## Process complete
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mssql/launchmssql.bat
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mssql/launchmssql.bat b/software/database/src/main/resources/brooklyn/entity/database/mssql/launchmssql.bat
deleted file mode 100644
index ad0deff..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mssql/launchmssql.bat
+++ /dev/null
@@ -1,25 +0,0 @@
-[#ftl]
-@echo off
-REM Licensed to the Apache Software Foundation (ASF) under one
-REM or more contributor license agreements.  See the NOTICE file
-REM distributed with this work for additional information
-REM regarding copyright ownership.  The ASF licenses this file
-REM to you under the Apache License, Version 2.0 (the
-REM "License"); you may not use this file except in compliance
-REM with the License.  You may obtain a copy of the License at
-REM
-REM   http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing,
-REM software distributed under the License is distributed on an
-REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-REM KIND, either express or implied.  See the License for the
-REM specific language governing permissions and limitations
-REM under the License.
-
-set serviceName=MSSQL\$${config['mssql.instance.name']}
-
-[#noparse]
-sc stop %serviceName%
-sc config %serviceName% start=auto
-sc start %serviceName%

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mssql/mssql.yaml
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mssql/mssql.yaml b/software/database/src/main/resources/brooklyn/entity/database/mssql/mssql.yaml
deleted file mode 100644
index d82a7f7..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mssql/mssql.yaml
+++ /dev/null
@@ -1,40 +0,0 @@
-name: mssql
-
-location:
-  jclouds:aws-ec2:us-west-2:
-    displayName: AWS Oregon (Windows)
-    imageId: us-west-2/ami-8fd3f9bf
-    hardwareId:  m3.medium
-    useJcloudsSshInit: false
-    templateOptions:
-      subnetId: subnet-a10e96c4
-      securityGroupIds: [['sg-a2d0c2c7']]
-      mapNewVolumeToDeviceName: ["/dev/sda1", 100, true]
-
-services:
-- type: brooklyn.entity.basic.VanillaWindowsProcess
-  brooklyn.config:
-    templates.install:
-      classpath://brooklyn/entity/database/mssql/ConfigurationFile.ini: "C:\\ConfigurationFile.ini"
-      classpath://brooklyn/entity/database/mssql/installmssql.ps1: "C:\\installmssql.ps1"
-      classpath://brooklyn/entity/database/mssql/configuremssql.ps1: "C:\\configuremssql.ps1"
-      classpath://brooklyn/entity/database/mssql/launchmssql.bat: "C:\\launchmssql.bat"
-      classpath://brooklyn/entity/database/mssql/stopmssql.bat: "C:\\stopmssql.bat"
-    install.command: powershell -command "C:\\installmssql.ps1"
-    customize.command: powershell -command "C:\\configuremssql.ps1"
-    launch.command: "C:\\launchmssql.bat"
-    stop.command: "C:\\stopmssql.bat"
-    checkRunning.command: echo true
-
-    ## NOTE: Values must be supplied for the following
-    mssql.download.url:
-    mssql.download.user:
-    mssql.download.password:
-    mssql.sa.password:
-    mssql.instance.name:
-
-    ## The following is a list of *all* MSSQL features. Installation time and footprint can be greatly
-    ## reduced by removing unnecessary features
-    mssql.features: "SQLENGINE,REPLICATION,FULLTEXT,DQ,AS,RS,RS_SHP,DQC,BIDS,CONN,IS,BC,SDK,BOL,SSMS,ADV_SSMS,DREPLAY_CTLR,DREPLAY_CLT,SNAC_SDK"
-  provisioning.properties:
-    required.ports: 1433
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mssql/stopmssql.bat
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mssql/stopmssql.bat b/software/database/src/main/resources/brooklyn/entity/database/mssql/stopmssql.bat
deleted file mode 100644
index 68358f1..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mssql/stopmssql.bat
+++ /dev/null
@@ -1,24 +0,0 @@
-[#ftl]
-@echo off
-REM Licensed to the Apache Software Foundation (ASF) under one
-REM or more contributor license agreements.  See the NOTICE file
-REM distributed with this work for additional information
-REM regarding copyright ownership.  The ASF licenses this file
-REM to you under the Apache License, Version 2.0 (the
-REM "License"); you may not use this file except in compliance
-REM with the License.  You may obtain a copy of the License at
-REM
-REM   http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing,
-REM software distributed under the License is distributed on an
-REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-REM KIND, either express or implied.  See the License for the
-REM specific language governing permissions and limitations
-REM under the License.
-
-set serviceName=MSSQL\$${config['mssql.instance.name']}
-
-[#noparse]
-sc config %serviceName% start=demand
-sc stop %serviceName%

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql.conf
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql.conf b/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql.conf
deleted file mode 100644
index 85f55ab..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql.conf
+++ /dev/null
@@ -1,19 +0,0 @@
-[client]
-port            = ${driver.port?c}
-socket          = /tmp/mysql.sock.${entity.socketUid}.${driver.port?c}
-user            = root
-password        = ${entity.password}
-
-# Here follows entries for some specific programs
-
-# The MySQL server
-[mysqld]
-port            = ${driver.port?c}
-socket          = /tmp/mysql.sock.${entity.socketUid}.${driver.port?c}
-basedir         = ${driver.baseDir}
-datadir         = ${driver.dataDir}
-bind-address    = 0.0.0.0
-# skip-networking
-
-# Custom configuration options
-${driver.mySqlServerOptionsString}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql_master.conf
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql_master.conf b/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql_master.conf
deleted file mode 100644
index 791f2da..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql_master.conf
+++ /dev/null
@@ -1,26 +0,0 @@
-[client]
-port            = ${driver.port?c}
-socket          = /tmp/mysql.sock.${entity.socketUid}.${driver.port?c}
-user            = root
-password        = ${entity.password}
-
-# Here follows entries for some specific programs
-
-# The MySQL server
-[mysqld]
-port            = ${driver.port?c}
-socket          = /tmp/mysql.sock.${entity.socketUid}.${driver.port?c}
-basedir         = ${driver.baseDir}
-datadir         = ${driver.dataDir}
-bind-address    = 0.0.0.0
-# skip-networking
-
-# Replication config
-server-id       = 1
-binlog-format   = mixed
-log-bin         = mysql-bin
-sync_binlog     = 1
-innodb_flush_log_at_trx_commit=1
-
-# Custom configuration options
-${driver.mySqlServerOptionsString}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql_slave.conf
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql_slave.conf b/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql_slave.conf
deleted file mode 100644
index 2e1e945..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/mysql/mysql_slave.conf
+++ /dev/null
@@ -1,33 +0,0 @@
-[#ftl]
-[client]
-port            = ${driver.port?c}
-socket          = /tmp/mysql.sock.${entity.socketUid}.${driver.port?c}
-user            = root
-password        = ${entity.password}
-
-# Here follows entries for some specific programs
-
-# The MySQL server
-[mysqld]
-port            = ${driver.port?c}
-socket          = /tmp/mysql.sock.${entity.socketUid}.${driver.port?c}
-basedir         = ${driver.baseDir}
-datadir         = ${driver.dataDir}
-bind-address    = 0.0.0.0
-# skip-networking
-
-# Replication config
-server-id       = ${config["mysql.server_id"]}
-relay-log       = mysql-slave-${config["mysql.server_id"]}-relay
-relay-log-recovery = 1
-relay-log-info-repository = TABLE
-relay-log-purge = 1
-[#if !config["mysql.slave.replicate_do_db"]??            ]#[/#if]replicate-do-db             = ${config["mysql.slave.replicate_do_db"]!}
-[#if !config["mysql.slave.replicate_ignore_db"]??        ]#[/#if]replicate-ignore-db         = ${config["mysql.slave.replicate_ignore_db"]!}
-[#if !config["mysql.slave.replicate_do_table"]??         ]#[/#if]replicate-do-table          = ${config["mysql.slave.replicate_do_table"]!}
-[#if !config["mysql.slave.replicate_ignore_table"]??     ]#[/#if]replicate-ignore-table      = ${config["mysql.slave.replicate_ignore_table"]!}
-[#if !config["mysql.slave.replicate_wild_do_table"]??    ]#[/#if]replicate-wild-do-table     = ${config["mysql.slave.replicate_wild_do_table"]!}
-[#if !config["mysql.slave.replicate_wild_ignore_table"]??]#[/#if]replicate-wild-ignore-table = ${config["mysql.slave.replicate_wild_ignore_table"]!}
-
-# Custom configuration options
-${driver.mySqlServerOptionsString}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/postgresql/postgresql.conf
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/postgresql/postgresql.conf b/software/database/src/main/resources/brooklyn/entity/database/postgresql/postgresql.conf
deleted file mode 100644
index b6234c9..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/postgresql/postgresql.conf
+++ /dev/null
@@ -1,513 +0,0 @@
-[#ftl]
-#
-
-# -----------------------------
-# PostgreSQL configuration file
-# -----------------------------
-#
-# This file consists of lines of the form:
-#
-#   name = value
-#
-# (The "=" is optional.)  Whitespace may be used.  Comments are introduced with
-# "#" anywhere on a line.  The complete list of parameter names and allowed
-# values can be found in the PostgreSQL documentation.
-#
-# The commented-out settings shown in this file represent the default values.
-# Re-commenting a setting is NOT sufficient to revert it to the default value;
-# you need to reload the server.
-#
-# This file is read on server startup and when the server receives a SIGHUP
-# signal.  If you edit the file on a running system, you have to SIGHUP the
-# server for the changes to take effect, or use "pg_ctl reload".  Some
-# parameters, which are marked below, require a server shutdown and restart to
-# take effect.
-#
-# Any parameter can also be given as a command-line option to the server, e.g.,
-# "postgres -c log_connections=on".  Some parameters can be changed at run time
-# with the "SET" SQL command.
-#
-# Memory units:  kB = kilobytes        Time units:  ms  = milliseconds
-#                MB = megabytes                     s   = seconds
-#                GB = gigabytes                     min = minutes
-#                                                   h   = hours
-#                                                   d   = days
-
-
-#------------------------------------------------------------------------------
-# FILE LOCATIONS
-#------------------------------------------------------------------------------
-
-# The default values of these variables are driven from the -D command-line
-# option or PGDATA environment variable.
-
-data_directory = '${driver.dataDir}'       # use data in another directory
-                    # (change requires restart)
-#hba_file = '${driver.dataDir}/pg_hba.conf' # host-based authentication file
-                    # (change requires restart)
-#ident_file = '${driver.dataDir}/pg_ident.conf' # ident configuration file
-                    # (change requires restart)
-
-# If external_pid_file is not explicitly set, no extra PID file is written.
-external_pid_file = '${driver.pidFile}'       # write an extra PID file
-                    # (change requires restart)
-
-
-#------------------------------------------------------------------------------
-# CONNECTIONS AND AUTHENTICATION
-#------------------------------------------------------------------------------
-
-# - Connection Settings -
-
-listen_addresses = '${driver.hostname}'     # what IP address(es) to listen on;
-                    # comma-separated list of addresses;
-                    # defaults to 'localhost', '*' = all
-                    # (change requires restart)
-port = ${entity.postgreSqlPort?c}                # (change requires restart)
-max_connections = ${entity.maxConnections?c}           # (change requires restart)
-# Note:  Increasing max_connections costs ~400 bytes of shared memory per 
-# connection slot, plus lock space (see max_locks_per_transaction).
-#superuser_reserved_connections = 3 # (change requires restart)
-#unix_socket_directory = ''     # (change requires restart)
-#unix_socket_group = ''         # (change requires restart)
-#unix_socket_permissions = 0777     # begin with 0 to use octal notation
-                    # (change requires restart)
-#bonjour = off              # advertise server via Bonjour
-                    # (change requires restart)
-#bonjour_name = ''          # defaults to the computer name
-                    # (change requires restart)
-
-# - Security and Authentication -
-
-#authentication_timeout = 1min      # 1s-600s
-#ssl = off              # (change requires restart)
-#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH'  # allowed SSL ciphers
-                    # (change requires restart)
-#password_encryption = on
-#db_user_namespace = off
-
-# Kerberos and GSSAPI
-#krb_server_keyfile = ''
-#krb_srvname = 'postgres'       # (Kerberos only)
-#krb_caseins_users = off
-
-# - TCP Keepalives -
-# see "man 7 tcp" for details
-
-#tcp_keepalives_idle = 0        # TCP_KEEPIDLE, in seconds;
-                    # 0 selects the system default
-#tcp_keepalives_interval = 0        # TCP_KEEPINTVL, in seconds;
-                    # 0 selects the system default
-#tcp_keepalives_count = 0       # TCP_KEEPCNT;
-                    # 0 selects the system default
-
-
-#------------------------------------------------------------------------------
-# RESOURCE USAGE (except WAL)
-#------------------------------------------------------------------------------
-
-# - Memory -
-
-shared_buffers = ${entity.sharedMemory}           # min 128kB
-                    # (change requires restart)
-#temp_buffers = 8MB         # min 800kB
-#max_prepared_transactions = 0      # zero disables the feature
-                    # (change requires restart)
-# Note:  Increasing max_prepared_transactions costs ~600 bytes of shared memory
-# per transaction slot, plus lock space (see max_locks_per_transaction).
-# It is not advisable to set max_prepared_transactions nonzero unless you
-# actively intend to use prepared transactions.
-#work_mem = 1MB             # min 64kB
-#maintenance_work_mem = 16MB        # min 1MB
-#max_stack_depth = 2MB          # min 100kB
-
-# - Kernel Resource Usage -
-
-#max_files_per_process = 1000       # min 25
-                    # (change requires restart)
-#shared_preload_libraries = ''      # (change requires restart)
-
-# - Cost-Based Vacuum Delay -
-
-#vacuum_cost_delay = 0ms        # 0-100 milliseconds
-#vacuum_cost_page_hit = 1       # 0-10000 credits
-#vacuum_cost_page_miss = 10     # 0-10000 credits
-#vacuum_cost_page_dirty = 20        # 0-10000 credits
-#vacuum_cost_limit = 200        # 1-10000 credits
-
-# - Background Writer -
-
-#bgwriter_delay = 200ms         # 10-10000ms between rounds
-#bgwriter_lru_maxpages = 100        # 0-1000 max buffers written/round
-#bgwriter_lru_multiplier = 2.0      # 0-10.0 multipler on buffers scanned/round
-
-# - Asynchronous Behavior -
-
-#effective_io_concurrency = 1       # 1-1000. 0 disables prefetching
-
-
-#------------------------------------------------------------------------------
-# WRITE AHEAD LOG
-#------------------------------------------------------------------------------
-
-# - Settings -
-
-#fsync = on             # turns forced synchronization on or off
-#synchronous_commit = on        # immediate fsync at commit
-#wal_sync_method = fsync        # the default is the first option 
-                    # supported by the operating system:
-                    #   open_datasync
-                    #   fdatasync
-                    #   fsync
-                    #   fsync_writethrough
-                    #   open_sync
-#full_page_writes = on          # recover from partial page writes
-#wal_buffers = 64kB         # min 32kB
-                    # (change requires restart)
-#wal_writer_delay = 200ms       # 1-10000 milliseconds
-
-#commit_delay = 0           # range 0-100000, in microseconds
-#commit_siblings = 5            # range 1-1000
-
-# - Checkpoints -
-
-#checkpoint_segments = 3        # in logfile segments, min 1, 16MB each
-#checkpoint_timeout = 5min      # range 30s-1h
-#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
-#checkpoint_warning = 30s       # 0 disables
-
-# - Archiving -
-
-#archive_mode = off     # allows archiving to be done
-                # (change requires restart)
-#archive_command = ''       # command to use to archive a logfile segment
-#archive_timeout = 0        # force a logfile segment switch after this
-                # number of seconds; 0 disables
-
-
-#------------------------------------------------------------------------------
-# QUERY TUNING
-#------------------------------------------------------------------------------
-
-# - Planner Method Configuration -
-
-#enable_bitmapscan = on
-#enable_hashagg = on
-#enable_hashjoin = on
-#enable_indexscan = on
-#enable_mergejoin = on
-#enable_nestloop = on
-#enable_seqscan = on
-#enable_sort = on
-#enable_tidscan = on
-
-# - Planner Cost Constants -
-
-#seq_page_cost = 1.0            # measured on an arbitrary scale
-#random_page_cost = 4.0         # same scale as above
-#cpu_tuple_cost = 0.01          # same scale as above
-#cpu_index_tuple_cost = 0.005       # same scale as above
-#cpu_operator_cost = 0.0025     # same scale as above
-#effective_cache_size = 128MB
-
-# - Genetic Query Optimizer -
-
-#geqo = on
-#geqo_threshold = 12
-#geqo_effort = 5            # range 1-10
-#geqo_pool_size = 0         # selects default based on effort
-#geqo_generations = 0           # selects default based on effort
-#geqo_selection_bias = 2.0      # range 1.5-2.0
-#geqo_seed = 0.0            # range 0.0-1.0
-
-# - Other Planner Options -
-
-#default_statistics_target = 100    # range 1-10000
-#constraint_exclusion = partition   # on, off, or partition
-#cursor_tuple_fraction = 0.1        # range 0.0-1.0
-#from_collapse_limit = 8
-#join_collapse_limit = 8        # 1 disables collapsing of explicit 
-                    # JOIN clauses
-
-
-#------------------------------------------------------------------------------
-# ERROR REPORTING AND LOGGING
-#------------------------------------------------------------------------------
-
-# - Where to Log -
-
-#log_destination = 'stderr'     # Valid values are combinations of
-                    # stderr, csvlog, syslog and eventlog,
-                    # depending on platform.  csvlog
-                    # requires logging_collector to be on.
-
-# This is used when logging to stderr:
-#logging_collector = off        # Enable capturing of stderr and csvlog
-                    # into log files. Required to be on for
-                    # csvlogs.
-                    # (change requires restart)
-
-# These are only used if logging_collector is on:
-#log_directory = 'pg_log'       # directory where log files are written,
-                    # can be absolute or relative to PGDATA
-#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'    # log file name pattern,
-                    # can include strftime() escapes
-#log_truncate_on_rotation = off     # If on, an existing log file of the
-                    # same name as the new log file will be
-                    # truncated rather than appended to.
-                    # But such truncation only occurs on
-                    # time-driven rotation, not on restarts
-                    # or size-driven rotation.  Default is
-                    # off, meaning append to existing files
-                    # in all cases.
-#log_rotation_age = 1d          # Automatic rotation of logfiles will
-                    # happen after that time.  0 disables.
-#log_rotation_size = 10MB       # Automatic rotation of logfiles will 
-                    # happen after that much log output.
-                    # 0 disables.
-
-# These are relevant when logging to syslog:
-#syslog_facility = 'LOCAL0'
-#syslog_ident = 'postgres'
-
-#silent_mode = off          # Run server silently.
-                    # DO NOT USE without syslog or
-                    # logging_collector
-                    # (change requires restart)
-
-
-# - When to Log -
-
-#client_min_messages = notice       # values in order of decreasing detail:
-                    #   debug5
-                    #   debug4
-                    #   debug3
-                    #   debug2
-                    #   debug1
-                    #   log
-                    #   notice
-                    #   warning
-                    #   error
-
-#log_min_messages = warning     # values in order of decreasing detail:
-                    #   debug5
-                    #   debug4
-                    #   debug3
-                    #   debug2
-                    #   debug1
-                    #   info
-                    #   notice
-                    #   warning
-                    #   error
-                    #   log
-                    #   fatal
-                    #   panic
-
-#log_error_verbosity = default      # terse, default, or verbose messages
-
-#log_min_error_statement = error    # values in order of decreasing detail:
-                    #   debug5
-                    #   debug4
-                    #   debug3
-                    #   debug2
-                    #   debug1
-                    #   info
-                    #   notice
-                    #   warning
-                    #   error
-                    #   log
-                    #   fatal
-                    #   panic (effectively off)
-
-#log_min_duration_statement = -1    # -1 is disabled, 0 logs all statements
-                    # and their durations, > 0 logs only
-                    # statements running at least this number
-                    # of milliseconds
-
-
-# - What to Log -
-
-#debug_print_parse = off
-#debug_print_rewritten = off
-#debug_print_plan = off
-#debug_pretty_print = on
-#log_checkpoints = off
-#log_connections = off
-#log_disconnections = off
-#log_duration = off
-#log_hostname = off
-#log_line_prefix = ''           # special values:
-                    #   %u = user name
-                    #   %d = database name
-                    #   %r = remote host and port
-                    #   %h = remote host
-                    #   %p = process ID
-                    #   %t = timestamp without milliseconds
-                    #   %m = timestamp with milliseconds
-                    #   %i = command tag
-                    #   %e = SQL state
-                    #   %c = session ID
-                    #   %l = session line number
-                    #   %s = session start timestamp
-                    #   %v = virtual transaction ID
-                    #   %x = transaction ID (0 if none)
-                    #   %q = stop here in non-session
-                    #        processes
-                    #   %% = '%'
-                    # e.g. '<%u%%%d> '
-#log_lock_waits = off           # log lock waits >= deadlock_timeout
-#log_statement = 'none'         # none, ddl, mod, all
-#log_temp_files = -1            # log temporary files equal or larger
-                    # than the specified size in kilobytes;
-                    # -1 disables, 0 logs all temp files
-#log_timezone = unknown         # actually, defaults to TZ environment
-                    # setting
-
-
-#------------------------------------------------------------------------------
-# RUNTIME STATISTICS
-#------------------------------------------------------------------------------
-
-# - Query/Index Statistics Collector -
-
-#track_activities = on
-#track_counts = on
-#track_functions = none         # none, pl, all
-#track_activity_query_size = 1024
-#update_process_title = on
-#stats_temp_directory = 'pg_stat_tmp'
-
-
-# - Statistics Monitoring -
-
-#log_parser_stats = off
-#log_planner_stats = off
-#log_executor_stats = off
-#log_statement_stats = off
-
-
-#------------------------------------------------------------------------------
-# AUTOVACUUM PARAMETERS
-#------------------------------------------------------------------------------
-
-#autovacuum = on            # Enable autovacuum subprocess?  'on' 
-                    # requires track_counts to also be on.
-#log_autovacuum_min_duration = -1   # -1 disables, 0 logs all actions and
-                    # their durations, > 0 logs only
-                    # actions running at least this number
-                    # of milliseconds.
-#autovacuum_max_workers = 3     # max number of autovacuum subprocesses
-#autovacuum_naptime = 1min      # time between autovacuum runs
-#autovacuum_vacuum_threshold = 50   # min number of row updates before
-                    # vacuum
-#autovacuum_analyze_threshold = 50  # min number of row updates before 
-                    # analyze
-#autovacuum_vacuum_scale_factor = 0.2   # fraction of table size before vacuum
-#autovacuum_analyze_scale_factor = 0.1  # fraction of table size before analyze
-#autovacuum_freeze_max_age = 200000000  # maximum XID age before forced vacuum
-                    # (change requires restart)
-#autovacuum_vacuum_cost_delay = 20ms    # default vacuum cost delay for
-                    # autovacuum, in milliseconds;
-                    # -1 means use vacuum_cost_delay
-#autovacuum_vacuum_cost_limit = -1  # default vacuum cost limit for
-                    # autovacuum, -1 means use
-                    # vacuum_cost_limit
-
-
-#------------------------------------------------------------------------------
-# CLIENT CONNECTION DEFAULTS
-#------------------------------------------------------------------------------
-
-# - Statement Behavior -
-
-#search_path = '"[#noparse]$user[/#noparse]",public'     # schema names
-#default_tablespace = ''        # a tablespace name, '' uses the default
-#temp_tablespaces = ''          # a list of tablespace names, '' uses
-                    # only default tablespace
-#check_function_bodies = on
-#default_do_language = 'plpgsql'
-#default_transaction_isolation = 'read committed'
-#default_transaction_read_only = off
-#session_replication_role = 'origin'
-#statement_timeout = 0          # in milliseconds, 0 is disabled
-#vacuum_freeze_min_age = 50000000
-#vacuum_freeze_table_age = 150000000
-#bytea_output = 'hex'           # hex, escape
-#xmlbinary = 'base64'
-#xmloption = 'content'
-
-# - Locale and Formatting -
-
-datestyle = 'iso, mdy'
-#intervalstyle = 'postgres'
-#timezone = unknown         # actually, defaults to TZ environment
-                    # setting
-#timezone_abbreviations = 'Default'     # Select the set of available time zone
-                    # abbreviations.  Currently, there are
-                    #   Default
-                    #   Australia
-                    #   India
-                    # You can create your own file in
-                    # share/timezonesets/.
-#extra_float_digits = 0         # min -15, max 3
-#client_encoding = sql_ascii        # actually, defaults to database
-                    # encoding
-
-# These settings are initialized by initdb, but they can be changed.
-lc_messages = 'en_US.UTF-8'         # locale for system error message
-                    # strings
-lc_monetary = 'en_US.UTF-8'         # locale for monetary formatting
-lc_numeric = 'en_US.UTF-8'          # locale for number formatting
-lc_time = 'en_US.UTF-8'             # locale for time formatting
-
-# default configuration for text search
-default_text_search_config = 'pg_catalog.english'
-
-# - Other Defaults -
-
-#dynamic_library_path = '[#noparse]$libdir[/#noparse]'
-#local_preload_libraries = ''
-
-
-#------------------------------------------------------------------------------
-# LOCK MANAGEMENT
-#------------------------------------------------------------------------------
-
-#deadlock_timeout = 1s
-#max_locks_per_transaction = 64     # min 10
-                    # (change requires restart)
-# Note:  Each lock table slot uses ~270 bytes of shared memory, and there are
-# max_locks_per_transaction * (max_connections + max_prepared_transactions)
-# lock table slots.
-
-
-#------------------------------------------------------------------------------
-# VERSION/PLATFORM COMPATIBILITY
-#------------------------------------------------------------------------------
-
-# - Previous PostgreSQL Versions -
-
-#add_missing_from = off
-#array_nulls = on
-#backslash_quote = safe_encoding    # on, off, or safe_encoding
-#default_with_oids = off
-#escape_string_warning = on
-#regex_flavor = advanced        # advanced, extended, or basic
-#sql_inheritance = on
-#standard_conforming_strings = off
-#synchronize_seqscans = on
-
-# - Other Platforms and Clients -
-
-#transform_null_equals = off
-
-
-#------------------------------------------------------------------------------
-# CUSTOMIZED OPTIONS
-#------------------------------------------------------------------------------
-
-#custom_variable_classes = ''       # list of custom variable class names
-
-# Lines that pgtune has had problems parsing
-
-log_line_prefix = 'user=%u,db=%d '

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/resources/brooklyn/entity/database/rubyrep/rubyrep.conf
----------------------------------------------------------------------
diff --git a/software/database/src/main/resources/brooklyn/entity/database/rubyrep/rubyrep.conf b/software/database/src/main/resources/brooklyn/entity/database/rubyrep/rubyrep.conf
deleted file mode 100644
index 12fed6f..0000000
--- a/software/database/src/main/resources/brooklyn/entity/database/rubyrep/rubyrep.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-[#ftl]
-#
-
-RR::Initializer::run do |config|
-config.left = {
-:adapter  => '${entity.leftDatabaseUrl.scheme}', 
-:database => '${entity.leftDatabaseName}',
-:username => '${entity.leftUsername}',
-:password => '${entity.leftPassword}',
-:host     => '${entity.leftDatabaseUrl.host}',
-:port     => ${entity.leftDatabaseUrl.port?c}
-}
- 
-config.right ={
-:adapter  => '${entity.rightDatabaseUrl.scheme}', 
-:database => '${entity.rightDatabaseName}',
-:username => '${entity.rightUsername}',
-:password => '${entity.rightPassword}',
-:host     => '${entity.rightDatabaseUrl.host}',
-:port     => ${entity.rightDatabaseUrl.port?c}
-}
- 
-config.include_tables /${entity.tableRegex}/
-config.options[:replication_interval] = ${entity.replicationInterval?c}
-config.options[:logged_replication_events] = [
-:all_changes, 
-:all_conflicts
-]end