Search in sources :

Example 1 with Desktop

use of org.platformlayer.service.desktop.model.Desktop in project platformlayer by platformlayer.

the class DesktopController method addChildren.

@Override
protected void addChildren() throws OpsException {
    Desktop model = OpsContext.get().getInstance(Desktop.class);
    InstanceBuilder instance = InstanceBuilder.build(model.dnsName, this, model.getTags());
    instance.publicPorts.add(22);
    instance.hostPolicy.allowRunInContainer = true;
    instance.minimumMemoryMb = 4096;
    addChild(instance);
    {
        RecipeOperatingSystem os = injected(RecipeOperatingSystem.class);
        os.operatingSystem = new OperatingSystemRecipe();
        os.operatingSystem.setDistribution("debian");
        os.operatingSystem.setVersion("wheezy");
        instance.addChild(os);
    }
    // We use curl for backups
    instance.addChild(PackageDependency.build("curl"));
    {
        PublicEndpoint endpoint = injected(PublicEndpoint.class);
        // endpoint.network = null;
        endpoint.publicPort = 22;
        endpoint.backendPort = 22;
        endpoint.dnsName = model.dnsName;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
        instance.addChild(endpoint);
    }
// {
// BackupDirectory backup = injected(BackupDirectory.class);
// backup.itemKey = model.getKey();
//
// File jenkinsRoot = new File("/var/lib/jenkins");
// backup.backupRoot = jenkinsRoot;
//
// String[] excludes = { "jobs/*/workspace", "jobs/*/modules", "jobs/*/builds/*/workspace.tar.gz",
// ".m2/repository" };
//
// for (String exclude : excludes) {
// backup.excludes.add(new File(jenkinsRoot, exclude));
// }
//
// instance.addChild(backup);
// }
}
Also used : Desktop(org.platformlayer.service.desktop.model.Desktop) PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) RecipeOperatingSystem(org.platformlayer.ops.packages.RecipeOperatingSystem) OperatingSystemRecipe(org.platformlayer.images.model.OperatingSystemRecipe) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Aggregations

OperatingSystemRecipe (org.platformlayer.images.model.OperatingSystemRecipe)1 InstanceBuilder (org.platformlayer.ops.instances.InstanceBuilder)1 PublicEndpoint (org.platformlayer.ops.networks.PublicEndpoint)1 RecipeOperatingSystem (org.platformlayer.ops.packages.RecipeOperatingSystem)1 Desktop (org.platformlayer.service.desktop.model.Desktop)1