Search in sources :

Example 11 with PublicEndpoint

use of org.platformlayer.ops.networks.PublicEndpoint in project platformlayer by platformlayer.

the class UserAuthServiceController method addChildren.

@Override
protected void addChildren() throws OpsException {
    String dnsName = model.dnsName;
    InstanceBuilder vm;
    {
        vm = InstanceBuilder.build(dnsName, this, model.getTags());
        // vm.publicPorts.add(port);
        vm.hostPolicy.configureCluster(template.getPlacementKey());
        // TODO: This needs to be configurable (?)
        vm.minimumMemoryMb = 2048;
        addChild(vm);
    }
    {
        UserAuthInstall install = vm.addChild(UserAuthInstall.class);
    }
    {
        UserAuthInstance service = vm.addChild(UserAuthInstance.class);
    }
    {
        PublicEndpoint endpoint = vm.addChild(PublicEndpoint.class);
        // endpoint.network = null;
        endpoint.publicPort = BACKEND_PORT;
        endpoint.backendPort = BACKEND_PORT;
        // endpoint.dnsName = dnsName;
        endpoint.transport = Transport.Ipv6;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
    }
    loadBalancing.addHttpSite(this, model, model.dnsName, template.getSslKeyPath(), SslMode.Terminate);
}
Also used : PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Example 12 with PublicEndpoint

use of org.platformlayer.ops.networks.PublicEndpoint in project platformlayer by platformlayer.

the class PlatformLayerServiceController method addChildren.

@Override
protected void addChildren() throws OpsException {
    int port = PORT;
    String dnsName = model.dnsName;
    InstanceBuilder vm;
    {
        vm = InstanceBuilder.build(dnsName, this, model.getTags());
        vm.publicPorts.add(port);
        vm.hostPolicy.configureCluster(template.getPlacementKey());
        // TODO: This needs to be configurable (?)
        vm.minimumMemoryMb = 2048;
        addChild(vm);
    }
    {
        PlatformLayerInstall install = injected(PlatformLayerInstall.class);
        vm.addChild(install);
    }
    {
        PlatformLayerInstance service = injected(PlatformLayerInstance.class);
        vm.addChild(service);
    }
    {
        PublicEndpoint endpoint = injected(PublicEndpoint.class);
        // endpoint.network = null;
        endpoint.publicPort = port;
        endpoint.backendPort = port;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
        if (model.transport != null) {
            endpoint.transport = EnumUtils.valueOfCaseInsensitive(Transport.class, model.transport);
        } else {
            endpoint.transport = Transport.Ipv6;
        }
        vm.addChild(endpoint);
    }
    if (model.dnsName != null) {
        loadBalancing.addHttpSite(this, model, model.dnsName, template.getSslKeyPath(), SslMode.Terminate);
    }
}
Also used : PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) NetworkPoint(org.platformlayer.ops.networks.NetworkPoint) PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Example 13 with PublicEndpoint

use of org.platformlayer.ops.networks.PublicEndpoint in project platformlayer by platformlayer.

the class AptCacheServiceController method addChildren.

@Override
protected void addChildren() throws OpsException {
    AptCacheService model = OpsContext.get().getInstance(AptCacheService.class);
    // TODO: Create endpoint with default port; maybe default to closed?
    // model.dnsName
    InstanceBuilder instance = InstanceBuilder.build(model.dnsName, this, model.getTags());
    instance.hostPolicy.allowRunInContainer = true;
    addChild(instance);
    instance.addChild(PackageDependency.build("squid3"));
    instance.addChild(SimpleFile.build(getClass(), new File("/etc/squid3/squid.conf")));
    instance.addChild(ManagedService.build("squid3"));
    // instance.addChild(CollectdCollector.build());
    {
        PublicEndpoint endpoint = injected(PublicEndpoint.class);
        endpoint.publicPort = PORT;
        endpoint.backendPort = PORT;
        endpoint.dnsName = model.dnsName;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
        instance.addChild(endpoint);
    }
}
Also used : AptCacheService(org.platformlayer.service.aptcache.model.AptCacheService) PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) File(java.io.File) SimpleFile(org.platformlayer.ops.filesystem.SimpleFile) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Example 14 with PublicEndpoint

use of org.platformlayer.ops.networks.PublicEndpoint in project platformlayer by platformlayer.

the class GitServerController method addChildren.

@Override
protected void addChildren() throws OpsException {
    GitService model = OpsContext.get().getInstance(GitService.class);
    InstanceBuilder vm = InstanceBuilder.build(model.dnsName, this, model.getTags());
    addChild(vm);
    vm.addChild(PackageDependency.build("apache2"));
    // Provides /usr/lib/git-core/git-http-backend
    vm.addChild(PackageDependency.build("git"));
    vm.addChild(ManagedDirectory.build(new File("/var/git"), "0755"));
    vm.addChild(ApacheModule.build("authnz_ldap"));
    vm.addChild(ApacheModule.build("ldap"));
    File apache2ConfDir = new File("/etc/apache2");
    vm.addChild(TemplatedFile.build(this, new File(apache2ConfDir, "conf.d/git")));
    vm.addChild(ManagedService.build("apache2"));
    vm.addChild(MetricsInstance.class);
    {
        PublicEndpoint endpoint = injected(PublicEndpoint.class);
        // endpoint.network = null;
        endpoint.publicPort = PORT;
        endpoint.backendPort = PORT;
        endpoint.dnsName = model.dnsName;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
        vm.addChild(endpoint);
    }
}
Also used : GitService(org.platformlayer.service.git.model.GitService) PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) TemplatedFile(org.platformlayer.ops.filesystem.TemplatedFile) File(java.io.File) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Example 15 with PublicEndpoint

use of org.platformlayer.ops.networks.PublicEndpoint in project platformlayer by platformlayer.

the class GerritServiceController method addChildren.

@Override
protected void addChildren() throws OpsException {
    // GerritInstanceModel template = injected(GerritInstanceModel.class);
    // GerritService model = template.getModel();
    String dnsName = model.dnsName;
    List<Integer> ports = getPorts();
    InstanceBuilder vm;
    {
        vm = InstanceBuilder.build(dnsName, this, model.getTags());
        vm.publicPorts.addAll(ports);
        vm.hostPolicy.configureCluster(template.getPlacementKey());
        // TODO: This needs to be configurable (?)
        vm.minimumMemoryMb = 2048;
        addChild(vm);
    }
    {
        GerritInstall install = vm.addChild(GerritInstall.class);
    }
    // Bootstrap depends on configuration file
    vm.addChild(ManagedDirectory.build(template.getDataDir(), "700").setOwner(template.getUser()).setGroup(template.getGroup()));
    vm.addChild(ManagedDirectory.build(new File(template.getDataDir(), "etc"), "700").setOwner(template.getUser()).setGroup(template.getGroup()));
    vm.addChild(GerritConfigurationFile.class);
    vm.addChild(GerritBootstrap.class);
    vm.addChild(GerritInstance.class);
    for (int port : ports) {
        PublicEndpoint endpoint = injected(PublicEndpoint.class);
        // endpoint.network = null;
        endpoint.publicPort = port;
        endpoint.backendPort = port;
        endpoint.dnsName = dnsName;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
        vm.addChild(endpoint);
    }
    vm.addChild(MetricsInstance.class);
}
Also used : PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) File(java.io.File) PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Aggregations

InstanceBuilder (org.platformlayer.ops.instances.InstanceBuilder)19 PublicEndpoint (org.platformlayer.ops.networks.PublicEndpoint)19 File (java.io.File)8 TemplatedFile (org.platformlayer.ops.filesystem.TemplatedFile)4 SimpleFile (org.platformlayer.ops.filesystem.SimpleFile)3 PlatformLayerKey (org.platformlayer.core.model.PlatformLayerKey)2 NetworkPoint (org.platformlayer.ops.networks.NetworkPoint)2 PackageDependency (org.platformlayer.ops.packages.PackageDependency)2 NginxService (org.openstack.service.nginx.model.NginxService)1 ManagedItemId (org.platformlayer.ids.ManagedItemId)1 OperatingSystemRecipe (org.platformlayer.images.model.OperatingSystemRecipe)1 Repository (org.platformlayer.images.model.Repository)1 RepositoryKey (org.platformlayer.images.model.RepositoryKey)1 OpsException (org.platformlayer.ops.OpsException)1 BackupDirectory (org.platformlayer.ops.backups.BackupDirectory)1 RecipeOperatingSystem (org.platformlayer.ops.packages.RecipeOperatingSystem)1 IpsecForPort (org.platformlayer.ops.vpn.IpsecForPort)1 IpsecPresharedKey (org.platformlayer.ops.vpn.IpsecPresharedKey)1 AptCacheService (org.platformlayer.service.aptcache.model.AptCacheService)1 Desktop (org.platformlayer.service.desktop.model.Desktop)1