Search in sources :

Example 26 with InstanceBuilder

use of org.platformlayer.ops.instances.InstanceBuilder in project platformlayer by platformlayer.

the class NginxServiceController method addChildren.

@Override
protected void addChildren() throws OpsException {
    NginxService model = OpsContext.get().getInstance(NginxService.class);
    InstanceBuilder instance = InstanceBuilder.build(model.dnsName, this, model.getTags());
    instance.hostPolicy.allowRunInContainer = true;
    instance.publicPorts.add(80);
    instance.publicPorts.add(443);
    addChild(instance);
    instance.addChild(PackageDependency.build("nginx"));
    instance.addChild(NginxServerBootstrap.build());
    // Can't restart collectd
    // instance.addChild(CollectdCollector.build());
    instance.addChild(ManagedService.build("nginx"));
    {
        PublicEndpoint endpoint = injected(PublicEndpoint.class);
        endpoint.publicPort = 80;
        endpoint.backendPort = 80;
        endpoint.dnsName = model.dnsName;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
        instance.addChild(endpoint);
    }
    {
        PublicEndpoint endpoint = injected(PublicEndpoint.class);
        endpoint.publicPort = 443;
        endpoint.backendPort = 443;
        endpoint.dnsName = model.dnsName;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
        instance.addChild(endpoint);
    }
    addChild(injected(NginxBackendConfiguration.class));
    addChild(injected(NginxSites.class));
}
Also used : PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) NginxService(org.openstack.service.nginx.model.NginxService) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Aggregations

InstanceBuilder (org.platformlayer.ops.instances.InstanceBuilder)26 PublicEndpoint (org.platformlayer.ops.networks.PublicEndpoint)19 File (java.io.File)9 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 PosixGroup (org.platformlayer.ops.users.PosixGroup)1 PosixUser (org.platformlayer.ops.users.PosixUser)1 IpsecForPort (org.platformlayer.ops.vpn.IpsecForPort)1 IpsecPresharedKey (org.platformlayer.ops.vpn.IpsecPresharedKey)1