Search in sources :

Example 6 with PublicEndpoint

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

the class PostgresqlServerController method addChildren.

@Override
protected void addChildren() throws OpsException {
    PostgresqlTemplateVariables template = injected(PostgresqlTemplateVariables.class);
    InstanceBuilder instance = InstanceBuilder.build(model.dnsName, this, model.getTags());
    // TODO: Memory _really_ needs to be configurable here!
    instance.publicPorts.add(5432);
    instance.minimumMemoryMb = 2048;
    addChild(instance);
    instance.addChild(PackageDependency.build("postgresql"));
    instance.addChild(PackageDependency.build("postgresql-client"));
    String postgresVersion = template.getPostgresVersion();
    if (postgresVersion.equals("8.4")) {
        instance.addChild(TemplatedFile.build(template, new File("/etc/postgresql/8.4/main/pg_hba.conf"), "8_4_pg_hba.conf"));
        instance.addChild(TemplatedFile.build(template, new File("/etc/postgresql/8.4/main/postgresql.conf"), "8_4_postgresql.conf"));
    } else if (postgresVersion.equals("9.1")) {
        instance.addChild(TemplatedFile.build(template, new File("/etc/postgresql/9.1/main/pg_hba.conf"), "9_1_pg_hba.conf"));
        instance.addChild(TemplatedFile.build(template, new File("/etc/postgresql/9.1/main/postgresql.conf"), "9_1_postgresql.conf"));
    } else {
        throw new OpsException("Unsupported postgres version: " + postgresVersion);
    }
    instance.addChild(PostgresqlServerBootstrap.build());
    instance.addChild(MetricsInstance.class);
    {
        PublicEndpoint endpoint = injected(PublicEndpoint.class);
        // endpoint.network = null;
        endpoint.publicPort = 5432;
        endpoint.backendPort = 5432;
        endpoint.dnsName = model.dnsName;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
        instance.addChild(endpoint);
    }
    instance.addChild(ManagedService.build("postgresql"));
    instance.addChild(injected(PostgresqlServerBackup.class));
}
Also used : OpsException(org.platformlayer.ops.OpsException) PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) TemplatedFile(org.platformlayer.ops.filesystem.TemplatedFile) File(java.io.File) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Example 7 with PublicEndpoint

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

the class RedisServerController method addChildren.

@Override
protected void addChildren() throws OpsException {
    RedisServer model = OpsContext.get().getInstance(RedisServer.class);
    InstanceBuilder vm;
    {
        vm = InstanceBuilder.build(model.dnsName, this, model.getTags());
        // TODO: Memory _really_ needs to be configurable here!
        vm.publicPorts.add(PORT);
        vm.minimumMemoryMb = 1024;
        vm.hostPolicy.allowRunInContainer = true;
        addChild(vm);
    }
    vm.addChild(PackageDependency.build("redis-server"));
    RedisTemplateModel template = injected(RedisTemplateModel.class);
    vm.addChild(TemplatedFile.build(template, new File("/etc/redis/redis.conf")).setFileMode("444"));
    // Collectd not restarting correctly (doesn't appear to be hostname problems??)
    // instance.addChild(CollectdCollector.build());
    {
        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);
    }
    vm.addChild(ManagedService.build("redis-server"));
}
Also used : RedisServer(org.platformlayer.service.redis.model.RedisServer) PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) TemplatedFile(org.platformlayer.ops.filesystem.TemplatedFile) File(java.io.File) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Example 8 with PublicEndpoint

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

the class SolrServerController method addChildren.

@Override
protected void addChildren() throws OpsException {
    SolrServer model = OpsContext.get().getInstance(SolrServer.class);
    int port = SolrConstants.API_PORT;
    InstanceBuilder vm;
    {
        vm = InstanceBuilder.build(model.dnsName, this, model.getTags());
        vm.publicPorts.add(port);
        vm.hostPolicy.allowRunInContainer = true;
        // TODO: This needs to be configurable...
        vm.minimumMemoryMb = 2048;
        addChild(vm);
    }
    {
        SolrInstall install = injected(SolrInstall.class);
        vm.addChild(install);
    }
    {
        SolrInstance service = injected(SolrInstance.class);
        vm.addChild(service);
    }
    {
        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 : PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) SolrServer(org.platformlayer.service.solr.model.SolrServer) PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Example 9 with PublicEndpoint

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

the class WordpressServiceController method addChildren.

@Override
protected void addChildren() throws OpsException {
    WordpressService model = OpsContext.get().getInstance(WordpressService.class);
    InstanceBuilder instance = InstanceBuilder.build(model.dnsName, this, model.getTags());
    // instance.minimumMemoryMb = 2048;
    addChild(instance);
    instance.addChild(PackageDependency.build("wordpress"));
    instance.addChild(ApacheBootstrap.build());
    {
        PlatformLayerFirewallEntry net = injected(PlatformLayerFirewallEntry.class);
        net.destItem = model.databaseItem;
        net.port = 3306;
        net.uniqueId = getFirewallUniqueId();
        PlatformLayerKey sourceKey = model.getKey();
        net.sourceItemKey = sourceKey;
        instance.addChild(net);
    }
    WordpressTemplateData templateData = Injection.getInstance(WordpressTemplateData.class);
    MysqlConnection mysql = instance.addChild(MysqlConnection.build(model.databaseItem));
    mysql.password = model.databasePassword;
    {
        MysqlDatabase db = injected(MysqlDatabase.class);
        db.databaseName = templateData.getDatabaseName();
        mysql.addChild(db);
    }
    {
        MysqlUser db = injected(MysqlUser.class);
        db.databaseName = templateData.getDatabaseName();
        db.databaseUser = templateData.getDatabaseUser();
        db.databasePassword = templateData.getDatabasePassword();
        mysql.addChild(db);
    }
    instance.addChild(WordpressBootstrap.build());
    instance.addChild(WordpressAdminUser.build());
    instance.addChild(WordpressApacheSite.build());
    // instance.addChild(CollectdCollector.build());
    // TODO: How do we bring up wordpress securely??
    // We don't have the tables until we run install.php
    // Maybe we could POST to the install.php form
    {
        PublicEndpoint endpoint = injected(PublicEndpoint.class);
        // endpoint.network = null;
        endpoint.publicPort = 80;
        endpoint.backendPort = 80;
        // We expect nginx to front-end us, so we don't put the dnsName
        // endpoint.dnsName = model.dnsName;
        endpoint.tagItem = model.getKey();
        endpoint.parentItem = model.getKey();
        instance.addChild(endpoint);
    }
    instance.addChild(ManagedService.build("apache2"));
}
Also used : PlatformLayerFirewallEntry(org.platformlayer.service.network.ops.PlatformLayerFirewallEntry) PlatformLayerKey(org.platformlayer.core.model.PlatformLayerKey) PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) WordpressService(org.platformlayer.service.wordpress.model.WordpressService) InstanceBuilder(org.platformlayer.ops.instances.InstanceBuilder)

Example 10 with PublicEndpoint

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

the class LdapServiceController method addChildren.

@Override
protected void addChildren() throws OpsException {
    LdapService model = OpsContext.get().getInstance(LdapService.class);
    // TODO: Support package pre-configuration??
    InstanceBuilder instance = InstanceBuilder.build(model.dnsName, DiskImageRecipeBuilder.loadDiskImageResource(getClass(), "DiskImageRecipe.xml"), model.getTags());
    addChild(instance);
    instance.addChild(MetricsInstance.class);
    instance.addChild(LdapMasterPassword.build(model.ldapServerPassword));
    {
        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();
        instance.addChild(endpoint);
    }
}
Also used : PublicEndpoint(org.platformlayer.ops.networks.PublicEndpoint) LdapService(org.platformlayer.service.openldap.model.LdapService) 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