use of org.platformlayer.ops.instances.InstanceBuilder 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);
}
}
use of org.platformlayer.ops.instances.InstanceBuilder 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);
}
}
use of org.platformlayer.ops.instances.InstanceBuilder 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);
}
use of org.platformlayer.ops.instances.InstanceBuilder 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));
}
use of org.platformlayer.ops.instances.InstanceBuilder 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"));
}
Aggregations