Examples of JcloudsNodeLauncherConfig


Examples of org.apache.ace.nodelauncher.amazon.JcloudsNodeLauncherConfig

        start(id, m_defaultNodeConfig);
    }

    public void start(String id, NodeLauncherConfig cfg) throws Exception {
        JcloudsNodeLauncherConfig config = (JcloudsNodeLauncherConfig) cfg;
        m_currentConfig = config;

        ComputeService computeService = config.getComputeService();
        TemplateBuilder template = computeService.templateBuilder()
                .imageId(config.getImageId())
                .hardwareId(config.getHardwareId())
                .locationId(config.getLocation());

        int[] extraPorts = parseExtraPorts(config.getExtraPorts());
        int[] inboundPorts = mergePorts(DEFAULT_PORTS, extraPorts);

        TemplateOptions options = new EC2TemplateOptions()
                .as(EC2TemplateOptions.class).inboundPorts(inboundPorts)
                .blockOnComplete(false)
                .runAsRoot(config.isRunAsRoot());

        if (useConfiguredKeyPair(config)) {
            options.as(EC2TemplateOptions.class).keyPair(config.getKeyPair());
        }

        template.options(options);

        Set<? extends NodeMetadata> tag = computeService.createNodesInGroup(config.getTagPrefix() + id, 1, template.build());
        if (!useConfiguredPrivateKey(config)) {
            System.out.println("In case you need it, this is the key to ssh to " + id + ":\n" + tag.iterator().next().getCredentials().credential);
        }

        LoginCredentials.Builder loginBuilder = LoginCredentials.builder();

        if (config.getSshUser() != null && config.getSshUser().length() > 0) {
            loginBuilder.user(config.getSshUser());
        } else {
            loginBuilder.user("ec2-user");
        }

        if (useConfiguredPrivateKey(config)) {
            loginBuilder.privateKey(Files.toString(new File(config.getPrivateKeyFile()), Charset.defaultCharset()));
        }

        computeService.runScriptOnNodesMatching(runningInGroup(config.getTagPrefix() + id),
                Statements.exec(buildStartupScript(id, config)),
                RunScriptOptions.Builder.blockOnComplete(false).overrideLoginCredentials(loginBuilder.build()));
    }
View Full Code Here

Examples of org.apache.ace.nodelauncher.amazon.JcloudsNodeLauncherConfig

    }

    public Properties getProperties(String id) throws Exception {
        Properties result = new Properties();

        JcloudsNodeLauncherConfig config = getActiveConfig();
        NodeMetadata nodeMetadata = getNodeMetadataForRunningNodeWithTag(config.getTagPrefix() + id, config);
        if (nodeMetadata == null) {
            return null;
        }
        result.put("id", id);
        result.put("node-id", nodeMetadata.getId());
View Full Code Here

Examples of org.apache.ace.nodelauncher.amazon.JcloudsNodeLauncherConfig

            String aceLauncher = getConfigProperty(properties, ACE_LAUNCHER, "ace-launcher.jar");
            String additionalObrDownloads = getConfigProperty(properties, ADDITIONAL_OBR_DOWNLOADS, "");
            String externalDownloadUrls = getConfigProperty(properties, EXTERNAL_DOWNLOAD_URLS, "");
            String sshUser = getConfigProperty(properties, SSH_USER, "ec2-user");

            m_defaultNodeConfig = new JcloudsNodeLauncherConfig()
                    .setAccessKeyId(accessKeyId)
                    .setSecretAccessKey(secretAccessKey)
                    .setServer(server)
                    .setImageId(amiId)
                    .setImageOwnerId(amiOwnerId)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.